jperkin / node-openzwave

node.js interface to libopenzwave
Other
110 stars 55 forks source link

added _instance to SetValue to support multi-instance devices #31

Open ekarak opened 9 years ago

ekarak commented 9 years ago

Hi Jonathan, This patch is to let node-openzwave properly control multi-instance devices such as the Fibaro FGS-221 (double in-wall relay switch). It adds the missing "_instance" part of the OZW ValueId.

zwave.setValue(8, 37, 0, 1, true/false); // control 1st relay of node #8 zwave.setValue(8, 37, 0, 2, true/false); // control 2nd relay of node #8

This patch also tightens the search for ValueIds for switchOn/Off and setLevel so that they only apply affect the valueID with instance and index values of 0. This was necessary as a switchOn command affected both relays.

jperkin commented 9 years ago

Thanks! I don't currently have devices at home I can test this on to ensure it doesn't break existing, will see if I can get some and integrate this.

ekarak commented 9 years ago

ooops seems like I broke the other nodes :) - I have to amend this patch...

ekarak commented 9 years ago

OK, fixed it, the default index value for ValueId's is 1 (its apparently not 0-based). Now I can control both single and multi-instance devices. I've also updated the README.

Cheers!

ekarak commented 9 years ago

KNX+Zwave working together in harmony in Node-Red: https://groups.google.com/forum/#!topic/node-red/LKJEFYZG7MY that's what I like about Open source: Combining the effort!

2014-07-15 21:58 GMT+03:00 Jonathan Perkin notifications@github.com:

Thanks! I don't currently have devices at home I can test this on to ensure it doesn't break existing, will see if I can get some and integrate this.

— Reply to this email directly or view it on GitHub https://github.com/jperkin/node-openzwave/pull/31#issuecomment-49076927.

Elias Karakoulakis Electrical & Computer Engineer NTUA Athens Msc Information Systems, AUEB Athens KNX Advanced Partner