---
title: "Z_Wave_Vera_SwitchPower"
canonical: "https://docs.cuesystem.com/space/CVCDD/607715744/Z_Wave_Vera_SwitchPower"
format: markdown
---
> Macro (toc)

---

Ver 1.00

The definition of **SwitchPower1** device is defined as SwitchPower1 UPnP device type.

Note that most products of this type are combining SwitchPower1 functionality with EnergyMetering1 device type. If such a product is to be used in the CVC project and functionality of both types are to be used, then there is necessary to put both these devices into CVC configuration and set their property “ID” to the same value as assigned in the Vera project

# Properties

|  |  |  |  |
| --- | --- | --- | --- |
| Property name | Data type | Default value | Description |
| Device |
| ID | Byte | 0 | ID of this device - see [https://cue.atlassian.net/wiki/spaces/CVCDD/pages/619446713](https://cue.atlassian.net/wiki/spaces/CVCDD/pages/619446713). |
| Pooling |
| Period | Time | :1 | Time period in which the driver is pooling the actual device to check its current status to recognize its status changes to generate event. |
| Event OnStatusChange |
| Enable | Boolean | No | Yes/No enables/disables generation of event when device status change was detected |
| Debug |
| Debug print | Boolean | No | Yes/No enables/disables the debug prints report from the driver. |

# Events

## OnStatusChange

This event is generated whenever the driver recognizes the change in the device state (ON or OFF). Note that event must be enabled by the appropriate property (see above). The current status of the device is pooled in time period also set by the driver property (see above)

Syntax

```visualbasic
Event OnStatusChange As Process(newstatus As Long)
```

#### Parameters

newstatus

Long - status of SwitchPower1 device where value 0  means OFF and 1 means ON

#### Example

```visualbasic
Process Z_Wave_SwitchPower1_OnStatusChange(newstate As Long) Link Z_Wave_SwitchPower1.OnStatusChange
  DebugPrintFormat ( " NEW status {n}",newstate)
End Process
```

# Commands

## GetMyID

This command returns current value of this device property “ID”

#### Syntax

```visualbasic
Function GetMyId() As Byte
```

#### Return value

Byte - ID in range 3-255

#### Example

```visualbasic
Id := Z_Wave_SwitchPower1.GetMyId()
//reads ID of the device Z_Wave_SwitchPower1
```

## GetStatus

This command reads current status from Z_Wave device of type SwitchPower1

#### Syntax

```visualbasic
Function GetStatus() As Byte
```

#### Return value

Byte  -  current status - where 0 means OFF, 1 means ON

#### Example

```visualbasic
iLevel := Z_Wave_SwitchPower1.GetStatus()
//reads status of this SwitchPower1 device
```

## SetStatus

This command sends new status to Z_Wave device type SwitchPower1

#### Syntax

```visualbasic
Function SetStatus(iNewStatus As Byte)
```

#### Parameters

iNewStatus

Byte - new status where 0 means OFF, 1 means ON  

#### Example

```visualbasic
Z_Wave_SwitchPower1.SetStatus(1)
//set ON this SwitchPower1 device
```