Z/IP Sample Client

Working with Binary Switch

Polling Binary Switch state

On polling for node list the client will also track device and their state values. This is applicable to Binary Switches in this version. Once a binary switch is found in the network the client will retrieve the switch's last known state from the server. This is achieved using the zwif_switch web api and the necessary input parameter for getting a BINARY_SWITCH_REPORT from the server. Every time the binary switch's state changes it will send out a report to the server which will be stored as the last known state in the server.

Toggle Binary Switch

Whenever a binary switch is detected in the network the "Toggle Switch" button will be visible in the client. Note that this is possible when a)polling the network and detecting a binary switch or b)Including a binary switch using the client.
Once the button is visible the user can manually change the state of the binary switch by clicking on the button. For example if the switch is turned off and the user presses the button it will be turned on. This is achieved using the zwif_switch web api and the necessary input parameter for doing a BINARY_SWITCH_SET to the server.

zware_sample_client_toggle_switch.jpg

Binary Switch tracking

Whenever a binary switch is removed from the network the client will inform this to the user. Once the switch is removed the "Toggle Switch" button will be no longer be visible in the client. The removal can happen either using the client's "Exclude Device" button or by removing the switch from the network manually by the user. In either case the information will be relayed to the user by the client.