dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.88k stars 483 forks source link

REST-API sends fake status updates when scene switch is clicked #5574

Closed Redsandro closed 2 years ago

Redsandro commented 2 years ago

Describe the bug

I connected a TS004F aka Tuya ZigBee Wireless 12 Scene Switch found here on Aliexpress to the Raspbee 2.

https://github.com/dresden-elektronik/deconz-rest-plugin/blob/39099c0ae9e078768bf2e18df2844bbd22b6b44c/bindings.cpp#L3072

Without assigning the button to any group, button 1 and 2 toggled every single connected light on and off respectively.

A deCONZ user with an Aqara Opple Switch instructed me to reset the switch again, and upon establishing the connection with deCONZ, quickly hit the reset button one more time to "disable 'master' mode". I never heard this before, but indeed it works.

The buttons no longer physically switch everything attached to deCONZ on or off.

The problem is that the REST-API still sends state updates as if everything is switched off and on. Then within half a minute or so, REST-API realizes nothing was changed, and updates the statuses back to the old value.

This causes problems when further processing is done by anything consuming the REST-API, such as OpenHAB or other domotics solutions. For example, if you use deCONZ to switch on a Zigbee light, and use deCONZ > REST-API > OpenHAB to switch on a Wifi light when the Zigbee light turns on, the result is now that only the Wifi light erroneously turns on while the Zigbee light properly stays off.

Steps to reproduce the behavior

  1. Hold reset button to bind Tuya 4-gang switch
  2. Observe button 1 and 2 function like a master switch and physically turn all groups on and off
  3. Observe statuses are communicated over REST-API
  4. Hold reset button again, this time after the connection is made (light flash) quickly hit the reset button once more
  5. Observe button 1 and 2 no longer physically turn all groups on and off
  6. Observe REST-API still sends status updates as if all groups turns on and off

Expected behavior

REST-API follows deCONZ behavior exactly.

Screenshots

Environment

deCONZ Logs

Additional context

I don't know this behavior. I don't know if this feature is related to the button itself, to Zigbee or to the deCONZ software. I tried to explain it as best as I could, but if I understood what was going on, I would probably explain it better.

Smanar commented 2 years ago

Perfect, and have found another issue with exaclty the same device.

So have removed debug line and added the _TZ3000_xabckq1v if someone is able to test the code for this one ?

Element2 commented 2 years ago

If you have time can you have a look at my question at #5493 ?

Element2 commented 2 years ago

To be clear, the 4 button Lidl TS1001 remote switch works nows as it should. So I hope you can merge it (together with the Tuya version of Redsandro) with the next Beta.

The Lidl smart extention lead (#5493) is a different device. I was just getting your attention here, because #5493 is closed and I was not sure if you get an email if a topic is closed. Maybe we can discuss it further in thread #5493.

Smanar commented 2 years ago

Mimix have reopened it.

github-actions[bot] commented 2 years ago

As there has not been any response in 21 days, this issue has been automatically marked as stale. At OP: Please either close this issue or keep it active It will be closed in 7 days if no further activity occurs.

github-actions[bot] commented 2 years ago

As there has not been any response in 28 days, this issue will be closed. @ OP: If this issue is solved post what fixed it for you. If it is not solved, request to get this opened again.

ldvc86 commented 2 years ago

@Smanar I'm willing to test for _TZ3000_xabckq1v, though I'm not sure whether I'm equipped for this, since I'm running deconz in docker

Smanar commented 2 years ago

Ha yes, I don't remember if the PR was tested for the _TZ3000_xabckq1v since the last time. But unfortunately PR are locked for the moment, to develop DDF, so not sure if it will be merged a day.

And yes, the procedure on docker is not easy, if you don't know how work dockers, for exemple https://github.com/franciscogouveia/docker-deconz-rest-plugin-test And I can't help you for that.

Redsandro commented 2 years ago

I have my _TZ3000_xabckq1v model TS004F back. I know it's not merged yet, but when the time comes, is there a relatively simple way to switch to beta channel on Raspbian Buster Headless SD-card image and switch back to stable later? Is there a relatively simple way to test the PR and switch back to stable afterwards?

Also, I'm still curious to understand how it can happen that something (in this case the quad button) can turn on/off all the light indicators on the Phoscon-GW control page, without physically toggling the actual lights. Are both actions (update the light and update the indicator) handled by different plugins?

Smanar commented 2 years ago

Switch from stable to beta is easy, and you can stay with beta, but just don't update next beta version https://phoscon.de/en/conbee2/install#raspbian

Is there a relatively simple way to test the PR and switch back to stable afterwards?

This is more complex, it s no a beta or stable branch but a special one. But yes the operation just replace 1 file, you can just make a backup of the file in another folder > /usr/share/deCONZ/plugins/libde_rest_plugin.so

To speed the process, when you send an order using the API, deconz update the state, send the request and wait for return to update the sate and correct it. And you can have the reverse, if the device have native broadcast request.