Bind to SensorBinary Data -JS API

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
scolari-IRE
Posts: 2
Joined: 12 Aug 2017 18:42

Bind to SensorBinary Data -JS API

Post by scolari-IRE »

Hi All,

New to this forum, zway..... and zwave in general. Love it!

Im having a bit of an issue trying to bind to my MultiSensor. I want to bind to the motion sensor. Reading the docs I see you can do this with the following - http://YOURIP:8083/JS/Run/zway.devices[3].*: Client Side URL access using the JS API

Here is my SensorBinary data:
http://192.168.0.206:8083/JS/Run/zway.devices[4].SensorBinary.data[1].level --- this will return the following:

Result:
{
invalidateTime: 1502547598,
updateTime: 1502552454,
type: "bool",
value: true
}


So, should the following work when called in the browser?
http://192.168.0.206:8083/JS/Run/zway.devices[4].SensorBinary.data[1].level.bind(function(){console.log('CHANGED TO: ' + this.value + '\n');});

Kind Regards
scolari-IRE
Posts: 2
Joined: 12 Aug 2017 18:42

Re: Bind to SensorBinary Data -JS API

Post by scolari-IRE »

As what usually happens I have answered my own question.
I can no see that every time my event is triggered the /var/log/z-way-server.log is being updated with my output.

I did change the http command to use debugPrint rather than console.log.

So this is the working command:
http://192.168.0.206:8083/JS/Run/zway.d ... d(function() {
debugPrint('Motion Sensor Activation: ' + this.value);
});

The log output:
[2017-08-12 19:50:36.231] [core] Notification: device-info (device-OnOff): {"dev":"PIR (#4)","l":"off","location":1}
[2017-08-12 19:50:36.244] [core] Motion Sensor Activation: false
Post Reply