jperkin / node-openzwave

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

Multi-instance devices not working #30

Closed ekarak closed 8 years ago

ekarak commented 9 years ago

I have a Fibaro FGS-221 (2x1,5KW in-wall switch) which is a multi-instance device. ValueID's get scanned correctly by OZW, however there's currently no way to pass the "_instance" of a ValueID to the underlying C++ library. In order to do that we can: -- add the instance in the list of setValue arguments:

Handle OZW::SetValue(const Arguments& args) { HandleScope scope;

uint8_t nodeid = args[0]->ToNumber()->Value();
uint8_t comclass = args[1]->ToNumber()->Value();
uint8_t index = args[2]->ToNumber()->Value();

* uint8_t instance = args[3]->ToNumber()->Value(); *

OR --- be able to pass ValueID objects as returned by the 'value added' callback directly into openZWave, maybe through a call like "setValueID(OpenZWaveValueID, value)", perhaps?

ghost commented 9 years ago

hi maybe my problem is related to this:

I'm also owner of an FGS 221 double relay switch and the event raised in node js has the wrong instance id:

2014-12-15 23:39:34.400 Node002,   Received: 0x01, 0x09, 0x00, 0x04, 0x00, 0x02, 0x03, 0x25, 0x03, 0x00, 0xd5
2014-12-15 23:39:34.402
2014-12-15 23:39:34.404 Node002, Received SwitchBinary report from node 2: level=Off
2014-12-15 23:39:34.405 Node002, Refreshed Value: old value=true, new value=false, type=bool
2014-12-15 23:39:34.407 Node002, Changes to this value are verified
2014-12-15 23:39:34.408 Node002, Changed value (possible)--rechecking
2014-12-15 23:39:34.410 mgr,     Refreshing node 2: COMMAND_CLASS_SWITCH_BINARY index = 0 instance = 1 (to confirm a reported change)
2014-12-15 23:39:34.412 Node002, Queuing (Send) MultiChannel Encapsulated (instance=1): SwitchBinaryCmd_Get (Node=2): 0x01, 0x0d, 0x00, 0x13, 0x02, 0x06, 0x60, 0x0d, 0x01, 0x01, 0x25, 0x02, 0x25, 0x17, 0x9d
2014-12-15 23:39:34.414
2014-12-15 23:39:34.415 Node002, Sending (Send) message (Callback ID=0x17, Expected Reply=0x04) - MultiChannel Encapsulated (instance=1): SwitchBinaryCmd_Get (Node=2): 0x01, 0x0d, 0x00, 0x13, 0x02, 0x06, 0x60, x0d, 0x01, 0x01, 0x25, 0x02, 0x25, 0x17, 0x9d
2014-12-15 23:39:34.424 Node002,   Received: 0x01, 0x04, 0x01, 0x13, 0x01, 0xe8
2014-12-15 23:39:34.426 Node002,   ZW_SEND_DATA delivered to Z-Wave stack
2014-12-15 23:39:34.441 Node002,   Received: 0x01, 0x07, 0x00, 0x13, 0x17, 0x00, 0x00, 0x02, 0xfe
2014-12-15 23:39:34.442 Node002,   ZW_SEND_DATA Request with callback ID 0x17 received (expected 0x17)
2014-12-15 23:39:34.444 Node002, Request RTT 26 Average Request RTT 26
2014-12-15 23:39:34.451 Node002,   Received: 0x01, 0x0d, 0x00, 0x04, 0x00, 0x02, 0x07, 0x60, 0x0d, 0x01, 0x01, 0x25, 0x03, 0x00, 0xb8
2014-12-15 23:39:34.453
2014-12-15 23:39:34.454 Node002, Response RTT 36 Average Response RTT 36
2014-12-15 23:39:34.455 Node002, Received a MultiChannelEncap from node 2, endpoint 1 for Command Class COMMAND_CLASS_SWITCH_BINARY
2014-12-15 23:39:34.457 Node002, Received SwitchBinary report from node 2: level=Off
2014-12-15 23:39:34.458 Node002, Refreshed Value: old value=true, new value=false, type=bool
2014-12-15 23:39:34.459 Node002, Changes to this value are verified
2014-12-15 23:39:34.460 Node002, Changed value--confirmed
2014-12-15 23:39:34.462 Node002,   Expected reply and command class was received
2014-12-15 23:39:34.463 Node002,   Message transaction complete
2014-12-15 23:39:34.464
2014-12-15 23:39:34.466 Node002, Removing current message
{"0":{"type":"bool","genre":"user","instance":2,"index":0,"label":"Switch","units":"","read_only":false,"write_only":false,"min":0,"max":0,"value":false}}
node2: changed: 37:Switch:false->false

Its clearly instance 1 which gets changed here, but the json below is reporting instance 2

ekarak commented 8 years ago

resolving: please check out node-openzwave-shared in npm