Closed wmmihaa closed 4 years ago
Hi, I'm running openzwave-shared@1.5.6 and see some weird behavior on every other time I start the application.
My code is pretty much copy/paste from the samples:
zwave.on('scan complete', function () { console.log('scan complete'); if (zwave.hasOwnProperty('beginControllerCommand')) { console.log('using legacy mode (OpenZWave version < 1.3) - no security'); zwave.beginControllerCommand('AddDevice', true); } else { console.log( 'using new security API'); zwave.addNode(false); } }); zwave.on('controller command', function (n, rv, st, msg) { console.log(`node==${n}, retval=${rv}, state=${st}, msg=${msg}`); } self.zwave.connect('/dev/ttyAMA0');
First time:
>scan complete >using new security API >node==0, retval=1, state=0, msg=AddDevice ControllerCommand - Starting >node==0, retval=8, state=0, msg=AddDevice ControllerCommand - Failed >node==0, retval=7, state=0, msg=AddDevice ControllerCommand - Completed
After the first run, all seems to work. I can control actuators and get value changed events when values are updated
Second time (after restarting the application):
>scan complete >using new security API >node==0, retval=1, state=0, msg=AddDevice ControllerCommand - Starting >node==0, retval=4, state=0, msg=AddDevice ControllerCommand - Waiting
After the second run, I get 3 value changed if I manually switch on/off a switch, but I can not programmaticly set values.
Next time I run it will work as the first time...
This has nothing to do with zwave.addNode(false) or AddDevice event. I get the same behavior when commenting out the addNode call.
You have to call zwave.removeAllListeners() after disconnecting and rebind all events on reconnect
zwave.removeAllListeners()
Thanks!
Hi, I'm running openzwave-shared@1.5.6 and see some weird behavior on every other time I start the application.
My code is pretty much copy/paste from the samples:
First time:
After the first run, all seems to work. I can control actuators and get value changed events when values are updated
Second time (after restarting the application):
After the second run, I get 3 value changed if I manually switch on/off a switch, but I can not programmaticly set values.
Next time I run it will work as the first time...
Update
This has nothing to do with zwave.addNode(false) or AddDevice event. I get the same behavior when commenting out the addNode call.