ZWay: notification on event

Having now my sensors now installed "properly" (well, the sensors are hell to mount on PVC) on the door and windows at home, it is time to set-up my little ZWay application to get notified when these sensors are generating some events. More precisely, when a window or door gets open...

The ZWay API provides the possibility to install some callbacks when "data holder" are changed. Therefore the first thing to investigate is the data holder.
There are a few functions to get a hand on a data holder:

  • zway_find_data(...)

That one requires a data holder as argument, so that's not the one we need.

  • zway_find_controller_data
  • zway_find_device_data
  • zway_find_device_instance_data
  • zway_find_device_instance_cc_data
These are the functions to use; to get the "root" of the data holder, you can simply provide an empty string as parameter e.g.

ZDataHolder dataHolder = zway_find_device_instance_cc_data(theZWay, 2, 0, 48, "");
Given a bit of code to display a data holder in the callback, this will display the following when my sensor ID=2 instance=0 commandClass=48 (sensor binary) will be changed:
Data change type 129
version=1
security=False
interviewDone=True
interviewCounter=9
level=True
Data change type 129
version=1
security=False
interviewDone=True
interviewCounter=9
level=False

Comments

Popular posts from this blog

ZWay: getting the device list.

First steps with the ZWay library

Libcurl: perform a REST HTTP PUT