WebThingsIO / zigbee-adapter

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

Ikea Tradfri Remote missing scenes #199

Closed dasfuu closed 3 years ago

dasfuu commented 4 years ago

I got a Tradfri Remote(the one with 5 buttons; E1524) last year. It paired perfectly and everything worked. Today i got a new one. The number on the underside changed: E1810. As far as I know the only difference is, that it is suited for use in a bathroom now. But now the scene buttons(left/right) were not working and did not show up in the ui too.

In the attachment you can see the configurations the gateway created. I was able to fix the problem by making a copy of the old one and only adjusting addr64 and addr16. Now everything works perfectly.

I hope this is of some help.

tradfri_remote_new.txt tradfri_remote_old.txt

Edit: I use a Conbee II USB Dongle

chas-iot commented 4 years ago

After a lot more investigation, here's what I found with some debugging, then filtering the non-relevant lines of output. Clicking the Top, then Bottom, Left, and Right in sequence.

Looked   frame.remote64 842e14fffe4fa87d from 1a4d
Rcvd: Explicit Rx   842e14fffe4fa87d ZHA 0008 genLevelCtrl stepWithOnOff
Rcvd:   payload: { stepmode: 0, stepsize: 43,   transtime: 5 }
zb-842e14fffe4fa87d-button   event: 2-pressed
Sent: Explicit Tx   842e14fffe4fa87d ZHA 0008 genLevelCtrl defaultRsp
Sent:   payload: { cmdId: 'stepWithOnOff',   statusCode: 0 }
 
Looked frame.remote64   842e14fffe4fa87d from 1a4d
Rcvd: Explicit Rx   842e14fffe4fa87d ZHA 0008 genLevelCtrl step
Rcvd:   payload: { stepmode: 1, stepsize: 43,   transtime: 5 }
zb-842e14fffe4fa87d-button   event: 3-pressed
Sent: Explicit Tx   842e14fffe4fa87d ZHA 0008 genLevelCtrl defaultRsp
Sent:   payload: { cmdId: 'step', statusCode: 0 }
 
Looked frame.remote64   842e14fffe4fa87d from 1a4d
Rcvd: Explicit Rx   842e14fffe4fa87d ZHA 0005 genScenes step
Rcvd:   payload: { stepmode: 0, stepsize: 1,   transtime: 13 }
Sent: Explicit Tx   842e14fffe4fa87d ZHA 0005 genScenes defaultRsp
Sent:   payload: { cmdId: 'step', statusCode: 0 }
 
Looked frame.remote64   842e14fffe4fa87d from 1a4d
Rcvd: Explicit Rx   842e14fffe4fa87d ZHA 0005 genScenes step
Rcvd:   payload: { stepmode: 1, stepsize: 1,   transtime: 13 }
Sent: Explicit Tx   842e14fffe4fa87d ZHA 0005 genScenes defaultRsp
Sent:   payload: { cmdId: 'step', statusCode: 0 }

From tracing around, back and forward, it appears that at initialisation, the device does not have or get "outputClusters": [ ... "0005", ... ],

see https://discourse.mozilla.org/t/ikea-tradfri-5-button-remote-control-missing-events/66139 for my original report

chas-iot commented 4 years ago

and a better choice of debugging parameters gives the following, which makes it more clear.

2020-08-22 01:24:21.258 INFO   : zigbee-adapter: handleZhaResponse: node: 842e14fffe4fa87d
2020-08-22 01:24:21.264 INFO   : zigbee-adapter: handleButtonCommand: 842e14fffe4fa87d EP:1 CL:0008 cmd:stepWithOnOff
2020-08-22 01:24:21.265 INFO   : zigbee-adapter: handleButtonStepWithOnOffCommand: 842e14fffe4fa87d property: level moveMode: 0 stepSize: 43
2020-08-22 01:24:21.265 INFO   : zigbee-adapter: handleButtonStepCommand: 842e14fffe4fa87d property: level stepeMode: 0
2020-08-22 01:24:21.266 INFO   : zigbee-adapter: zb-842e14fffe4fa87d-button event: 2-pressed
2020-08-22 01:24:22.140 INFO   : zigbee-adapter: handleZhaResponse: node: 842e14fffe4fa87d
2020-08-22 01:24:22.141 INFO   : zigbee-adapter: handleButtonCommand: 842e14fffe4fa87d EP:1 CL:0008 cmd:step
2020-08-22 01:24:22.142 INFO   : zigbee-adapter: handleButtonStepCommand: 842e14fffe4fa87d property: level stepeMode: 1
2020-08-22 01:24:22.142 INFO   : zigbee-adapter: zb-842e14fffe4fa87d-button event: 3-pressed
2020-08-22 01:24:23.059 INFO   : zigbee-adapter: handleZhaResponse: node: 842e14fffe4fa87d
2020-08-22 01:24:23.060 INFO   : zigbee-adapter: handleButtonCommand: 842e14fffe4fa87d EP:1 CL:0005 cmd:step
2020-08-22 01:24:23.061 INFO   : zigbee-adapter: handleButtonCommand: no property found for: profileId: 260 endpoint: 1 clusterId: 5
2020-08-22 01:24:24.309 INFO   : zigbee-adapter: handleZhaResponse: node: 842e14fffe4fa87d
2020-08-22 01:24:24.310 INFO   : zigbee-adapter: handleButtonCommand: 842e14fffe4fa87d EP:1 CL:0005 cmd:step
2020-08-22 01:24:24.311 INFO   : zigbee-adapter: handleButtonCommand: no property found for: profileId: 260 endpoint: 1 clusterId: 5
kgiori commented 4 years ago

@dhylands is the guru of all things Zigbee...

chas-iot commented 4 years ago

I tried a very nasty hack, which works. This is not fit for release, just a demonstration. Afterwards, the button Thing in the display gets a new scene property with values 0-15 and the left and right buttons update it. @mrstegeman @dhylands I'd be grateful for some ideas how to take this forward. In the meantime, I'll keep investigating.

In method initMultiLevelButton of zb-classifier.js

    if (node.modelId === 'TRADFRI remote control') {
      const genScenesOutputEndpoint =
        node.findZhaEndpointWithOutputClusterIdHex(CLUSTER_ID.GENSCENES_HEX);
      if (genScenesOutputEndpoint) {
        const sceneProperty =
          this.addButtonSceneProperty(node, genScenesOutputEndpoint);
        sceneProperty.buttonIndex = 4;
      } else {  // start of hack
        const sceneProperty =
          this.addButtonSceneProperty(node, 1);
        sceneProperty.buttonIndex = 4;
      }  // end of hack

      // This is the IKEA remote with a center button and 4 other
      // buttons around the edge. The center button sends a toggle
      // rather than on/off.
chas-iot commented 4 years ago

I created a draft pull request for this

chas-iot commented 3 years ago

This is fixed in the latest release 0.11.13 from Friday