Page 1 of 1

[SOLVED]how do I find out what to "bind" to?

Posted: 24 Jul 2020 17:59
by doubledrat
Hi

I hope this is an easy question but I've failed to find the answer for myself after 3 hours!

I have a new device (a fibaro motion sensor) and I would like to execute a script when it detects motion.

I already have a script being triggered by another device, so I know the mechanics of doing this, but how do I find out the magic string that I bind to?!

thanks in advance

Re: how do I find out what to "bind" to?

Posted: 26 Jul 2020 11:01
by PoltoS
Depends on the API. On low level it should be something like zway.devices[X].SensorBinary.data[8].val.bind(FUNCTION).

Check the manual

Re: how do I find out what to "bind" to?

Posted: 26 Jul 2020 12:14
by doubledrat
for others (and myself when I need to do this again!) this is how I found it

in /var/log/z-way-server.log there is the following

Code: Select all

[2020-07-26 10:03:32.466] [D] [zway] SETDATA devices.4.instances.0.commandClasses.113.data.7.event = 8 (0x00000008)
[2020-07-26 10:03:32.477] [D] [zway] SETDATA devices.4.instances.0.commandClasses.113.data.7.eventString = "Motion detected, location unknown"
[2020-07-26 10:03:32.477] [D] [zway] SETDATA devices.4.instances.0.commandClasses.113.data.7.status = 255 (0x000000ff)
[2020-07-26 10:03:32.478] [D] [zway] SETDATA devices.4.instances.0.commandClasses.113.data.7 = Empty
[2020-07-26 10:03:40.458] [I] [core] (Mobile App Support) send notification: "Fibaro Motion Sensor (#4) : on"
that translated to

Code: Select all

zway.devices[4].instances[0].commandClasses[113].data[7].status.bind(function () {
in main.js