node-red-contrib-openzwave icon indicating copy to clipboard operation
node-red-contrib-openzwave copied to clipboard

Multi-channel associations support

Open robertsLando opened this issue 6 years ago • 0 comments

I'm tring to add/remove associations, my device has support for multi-channel associations but there is no way to specify the target instance using the APIs provided for group/associations management.

I explain my case: my device is a thermostat and has 5 instances:

  • The thermostat (root instance 0)
  • The binary switch (instance 1)
  • Multilevel sensor of internal temperature (instance 2)
  • Multilevel sensor of external temperature (instance 3)
  • Multilevel sensor of floor temperature (instance 4)

In Open Zwave control panel I can set the target node instance using <nodeID>.<instanceID> notation but this seems not working using the openzwave-shared lib.

I'm also tring to remove and add the controller to lifeline group of node 2 and I'm able to add it but not to remove it:

Removing controller (id 1) from lifeline group (1) of nodeid 2

Command used: zwave.removeAssociation(2, 1, 1);


2018-06-27 06:33:42.378 Info, Node002, MultiChannelAssociation::Remove - Removing instance 0 on node 1 from group 1 of node 2
2018-06-27 06:33:42.378 Detail, Node002, Queuing (Send) MultiChannelAssociationCmd_Remove (Node=2): 0x01, 0x0b, 0x00, 0x13, 0x02, 0x04, 0x8e, 0x04, 0x01, 0x01, 0x25, 0xea, 0xa4
2018-06-27 06:33:42.379 Info, Node002, Get MultiChannelAssociation for group 1 of node 2
2018-06-27 06:33:42.379 Detail, Node002, Queuing (Send) MultiChannelAssociationCmd_Get (Node=2): 0x01, 0x0a, 0x00, 0x13, 0x02, 0x03, 0x8e, 0x02, 0x01, 0x25, 0xeb, 0xa4
27 Jun 06:33:42 - [info] OpenZwave: direct API call success, result=undefined
2018-06-27 06:33:42.380 Detail,
2018-06-27 06:33:42.380 Info, Node002, Sending (Send) message (Callback ID=0xea, Expected Reply=0x13) - MultiChannelAssociationCmd_Remove (Node=2): 0x01, 0x0b, 0x00, 0x13, 0x02, 0x04, 0x8e, 0x04, 0x01, 0x01, 0x25, 0xea, 0xa4
2018-06-27 06:33:42.388 Detail, Node002,   Received: 0x01, 0x04, 0x01, 0x13, 0x01, 0xe8
2018-06-27 06:33:42.388 Detail, Node002,   ZW_SEND_DATA delivered to Z-Wave stack
2018-06-27 06:33:42.405 Detail, Node002,   Received: 0x01, 0x07, 0x00, 0x13, 0xea, 0x00, 0x00, 0x02, 0x03
2018-06-27 06:33:42.405 Detail, Node002,   ZW_SEND_DATA Request with callback ID 0xea received (expected 0xea)
2018-06-27 06:33:42.405 Info, Node002, Request RTT 24 Average Request RTT 24
2018-06-27 06:33:42.405 Detail,   Expected callbackId was received
2018-06-27 06:33:42.405 Detail,   Expected reply was received
2018-06-27 06:33:42.405 Detail,   Message transaction complete
2018-06-27 06:33:42.406 Detail,
2018-06-27 06:33:42.406 Detail, Node002, Removing current message
2018-06-27 06:33:42.406 Detail,
2018-06-27 06:33:42.406 Info, Node002, Sending (Send) message (Callback ID=0xeb, Expected Reply=0x04) - MultiChannelAssociationCmd_Get (Node=2): 0x01, 0x0a, 0x00, 0x13, 0x02, 0x03, 0x8e, 0x02, 0x01, 0x25, 0xeb, 0xa4
2018-06-27 06:33:42.415 Detail, Node002,   Received: 0x01, 0x04, 0x01, 0x13, 0x01, 0xe8
2018-06-27 06:33:42.415 Detail, Node002,   ZW_SEND_DATA delivered to Z-Wave stack
2018-06-27 06:33:42.517 Detail, Node002,   Received: 0x01, 0x07, 0x00, 0x13, 0xeb, 0x00, 0x00, 0x0b, 0x0b
2018-06-27 06:33:42.518 Detail, Node002,   ZW_SEND_DATA Request with callback ID 0xeb received (expected 0xeb)
2018-06-27 06:33:42.518 Info, Node002, Request RTT 111 Average Request RTT 67
2018-06-27 06:33:42.518 Detail,   Expected callbackId was received
2018-06-27 06:33:42.531 Detail, Node002,   Received: 0x01, 0x0b, 0x00, 0x04, 0x00, 0x02, 0x05, 0x8e, 0x03, 0x01, 0x08, 0x00, 0x73
2018-06-27 06:33:42.532 Detail,
2018-06-27 06:33:42.532 Info, Node002, Response RTT 125 Average Response RTT 83
2018-06-27 06:33:42.532 Info, Node002, Received Multi Instance Association report from node 2, group 1
2018-06-27 06:33:42.532 Info, Node002,   The group contains:
2018-06-27 06:33:42.532 Detail, Node002,   Expected reply and command class was received
2018-06-27 06:33:42.532 Detail, Node002,   Message transaction complete
2018-06-27 06:33:42.533 Detail,
2018-06-27 06:33:42.533 Detail, Node002, Removing current message
2018-06-27 06:33:42.533 Detail, Node002, Notification: Group

Add controller to lifeline group (1) of nodeid 2 (not working):

Command used: zwave.addAssociation(2, 1, 1);


27 Jun 06:45:05 - [info] OpenZwave: attempting direct API call to addAssociation()
2018-06-27 06:45:05.246 Info, Node002, MultiChannelAssociation::Set - Adding instance 1 on node 1 to group 1 of node 2
2018-06-27 06:45:05.246 Detail, Node002, Queuing (Send) MultiChannelAssociationCmd_Set (Node=2): 0x01, 0x0d, 0x00, 0x13, 0x02, 0x06, 0x8e, 0x01, 0x01, 0x00, 0x01, 0x01, 0x25, 0x4d, 0x03
2018-06-27 06:45:05.246 Info, Node002, Get MultiChannelAssociation for group 1 of node 2
2018-06-27 06:45:05.246 Detail, Node002, Queuing (Send) MultiChannelAssociationCmd_Get (Node=2): 0x01, 0x0a, 0x00, 0x13, 0x02, 0x03, 0x8e, 0x02, 0x01, 0x25, 0x4e, 0x01
2018-06-27 06:45:05.247 Detail,
2018-06-27 06:45:05.247 Info, Node002, Sending (Send) message (Callback ID=0x4d, Expected Reply=0x13) - MultiChannelAssociationCmd_Set (Node=2): 0x01, 0x0d, 0x00, 0x13, 0x02, 0x06, 0x8e, 0x01, 0x01, 0x00, 0x01, 0x01, 0x25, 0x4d, 0x03
27 Jun 06:45:05 - [info] OpenZwave: direct API call success, result=undefined
2018-06-27 06:45:05.256 Detail, Node002,   Received: 0x01, 0x04, 0x01, 0x13, 0x01, 0xe8
2018-06-27 06:45:05.257 Detail, Node002,   ZW_SEND_DATA delivered to Z-Wave stack
2018-06-27 06:45:05.272 Detail, Node002,   Received: 0x01, 0x07, 0x00, 0x13, 0x4d, 0x00, 0x00, 0x03, 0xa5
2018-06-27 06:45:05.272 Detail, Node002,   ZW_SEND_DATA Request with callback ID 0x4d received (expected 0x4d)
2018-06-27 06:45:05.272 Info, Node002, Request RTT 24 Average Request RTT 25
2018-06-27 06:45:05.272 Detail,   Expected callbackId was received
2018-06-27 06:45:05.272 Detail,   Expected reply was received
2018-06-27 06:45:05.273 Detail,   Message transaction complete
2018-06-27 06:45:05.273 Detail,
2018-06-27 06:45:05.273 Detail, Node002, Removing current message
2018-06-27 06:45:05.273 Detail,
2018-06-27 06:45:05.273 Info, Node002, Sending (Send) message (Callback ID=0x4e, Expected Reply=0x04) - MultiChannelAssociationCmd_Get (Node=2): 0x01, 0x0a, 0x00, 0x13, 0x02, 0x03, 0x8e, 0x02, 0x01, 0x25, 0x4e, 0x01
2018-06-27 06:45:05.282 Detail, Node002,   Received: 0x01, 0x04, 0x01, 0x13, 0x01, 0xe8
2018-06-27 06:45:05.282 Detail, Node002,   ZW_SEND_DATA delivered to Z-Wave stack
2018-06-27 06:45:05.382 Detail, Node002,   Received: 0x01, 0x07, 0x00, 0x13, 0x4e, 0x00, 0x00, 0x0b, 0xae
2018-06-27 06:45:05.382 Detail, Node002,   ZW_SEND_DATA Request with callback ID 0x4e received (expected 0x4e)
2018-06-27 06:45:05.383 Info, Node002, Request RTT 109 Average Request RTT 67
2018-06-27 06:45:05.383 Detail,   Expected callbackId was received
2018-06-27 06:45:05.399 Detail, Node002,   Received: 0x01, 0x0e, 0x00, 0x04, 0x00, 0x02, 0x08, 0x8e, 0x03, 0x01, 0x08, 0x00, 0x00, 0x01, 0x01, 0x7b
2018-06-27 06:45:05.399 Detail,
2018-06-27 06:45:05.399 Info, Node002, Response RTT 125 Average Response RTT 83
2018-06-27 06:45:05.399 Info, Node002, Received Multi Instance Association report from node 2, group 1
2018-06-27 06:45:05.400 Info, Node002,   The group contains:
2018-06-27 06:45:05.400 Info, Node002,     Node 1 instance 1
2018-06-27 06:45:05.400 Detail, Node002,   Expected reply and command class was received
2018-06-27 06:45:05.400 Detail, Node002,   Message transaction complete
2018-06-27 06:45:05.400 Detail,
2018-06-27 06:45:05.400 Detail, Node002, Removing current message
2018-06-27 06:45:05.401 Detail, Node002, Notification: Group
27 Jun 06:45:06 - [info] OpenZwave: input: {"topic":"getAssociations","payload":{"args":[2,1]},"_msgid":"a43316e6.5ce1d8","_event":"node:2ed2cb0b.c90a94"}
27 Jun 06:45:06 - [info] OpenZwave: attempting direct API call to getAssociations()
27 Jun 06:45:06 - [info] OpenZwave: direct API call success, result=[]
2018-06-27 06:45:06.540 Detail, Node002, Polling: COMMAND_CLASS_SENSOR_MULTILEVEL index = 1 instance = 2 (poll queue has 0 messages)
2018-06-27 06:45:06.541 Detail, Node002, Queuing (Poll) MultiChannel Encapsulated (instance=2): SensorMultilevelCmd_Get (Node=2): 0x01, 0x0d, 0x00, 0x13, 0x02, 0x06, 0x60, 0x0d, 0x01, 0x03, 0x31, 0x04, 0x25, 0x4f, 0xd5
2018-06-27 06:45:06.541 Detail,
2018-06-27 06:45:06.541 Info, Node002, Sending (Poll) message (Callback ID=0x4f, Expected Reply=0x04) - MultiChannel Encapsulated (instance=2): SensorMultilevelCmd_Get (Node=2): 0x01, 0x0d, 0x00, 0x13, 0x02, 0x06, 0x60, 0x0d, 0x01, 0x03, 0x31, 0x04, 0x25, 0x4f, 0xd5
2018-06-27 06:45:06.550 Detail, Node002,   Received: 0x01, 0x04, 0x01, 0x13, 0x01, 0xe8
2018-06-27 06:45:06.550 Detail, Node002,   ZW_SEND_DATA delivered to Z-Wave stack
2018-06-27 06:45:06.567 Detail, Node002,   Received: 0x01, 0x07, 0x00, 0x13, 0x4f, 0x00, 0x00, 0x02, 0xa6
2018-06-27 06:45:06.567 Detail, Node002,   ZW_SEND_DATA Request with callback ID 0x4f received (expected 0x4f)
2018-06-27 06:45:06.567 Info, Node002, Request RTT 25 Average Request RTT 46
2018-06-27 06:45:06.567 Detail,   Expected callbackId was received
2018-06-27 06:45:06.583 Detail, Node002,   Received: 0x01, 0x10, 0x00, 0x04, 0x00, 0x02, 0x0a, 0x60, 0x0d, 0x03, 0x01, 0x31, 0x05, 0x01, 0x22, 0x00, 0xec, 0x77
2018-06-27 06:45:06.584 Detail,
2018-06-27 06:45:06.584 Info, Node002, Response RTT 42 Average Response RTT 62
2018-06-27 06:45:06.584 Info, Node002, Received a MultiChannelEncap from node 2, endpoint 3 for Command Class COMMAND_CLASS_SENSOR_MULTILEVEL
2018-06-27 06:45:06.584 Info, Node002, Received SensorMultiLevel report from node 2, instance 2, Temperature: value=23.6C

No error is thrown but the controller is not added to the group (as you can see from the getAssociations() call that result is [])

I think the main problem can be find in this lines:

Remove association: 2018-06-27 06:33:42.378 Info, Node002, MultiChannelAssociation::Remove - Removing instance 0 on node 1 from group 1 of node 2 Add association: 2018-06-27 06:45:05.246 Info, Node002, MultiChannelAssociation::Set - Adding instance 1 on node 1 to group 1 of node 2

The instance 1 of node 1 doesn't exist (as the controller is not multichannel instance) and there is no way to specify it using the APIs, the API should use by default instance 0 of controller and should also provide a way to specify it in the api call.

The apis should work like:

zwave.addAssociation(nodeid, group, target_nodeid.target_instanceID); zwave.removeAssociation(nodeid, group, target_nodeid.target_instanceID);

if the target_nodeid hasn't the dot the default instance is used (root instance id 0).

Here the link to multi instance support in open-zwave lib: https://github.com/OpenZWave/open-zwave/blob/master/cpp/src/Group.cpp#L269

robertsLando avatar Jun 27 '18 06:06 robertsLando