WebThingsIO / zigbee-adapter

Zigbee adapter add-on for WebThings Gateway
Mozilla Public License 2.0
46 stars 29 forks source link

Tradfri scene fixes and other cleanups. #246

Closed chas-iot closed 3 years ago

chas-iot commented 3 years ago

The Scenes buttons and property on the TRADFRI remote control are functional again. While working through I found a number of cleanups. I sequenced these into a series of commits from most straightforward through to possibly intrusive.

Therefore I suggest that this is reviewed on a commit by commit basis, rather than looking at the PR as a whole.

mrstegeman commented 3 years ago
chas-iot commented 3 years ago

regarding node.type, it is still used to build the node.defaultName and node.name see ```zb-classifier

  classify(node) {
...
    // Now that we know the type, set the default name.
    node.defaultName = `${node.id}-${node.type}`;
    if (!node.name) {
      node.name = node.defaultName;
    }

regarding node.onOffProperty - oops, my fail, I thought I searched for this. It still needs a change - if there are multiple endpoints, I assume that the first endpoint should have precedence, not the last.

mrstegeman commented 3 years ago

regarding node.type, it is still used to build the node.defaultName and node.name see ```zb-classifier

  classify(node) {
...
    // Now that we know the type, set the default name.
    node.defaultName = `${node.id}-${node.type}`;
    if (!node.name) {
      node.name = node.defaultName;
    }

Ah, ok. Makes sense.

regarding node.onOffProperty - oops, my fail, I thought I searched for this. It still needs a change - if there are multiple endpoints, I assume that the first endpoint should have precedence, not the last.

Yes, probably the first should have precedence.