zha-device-handlers: [BUG] / Request send default response in wrong direction from quirk.
Describe the bug Our beloved TS004F Dimmer switch is re sending commands also after sending default response to it. Its described in this PR https://github.com/zigpy/zha-device-handlers/pull/1437.
To Reproduce Have sniffing tuya ZBGW and they is doing the same
Expected behavior Default response shall working OK but the device is doing all possible things wrong and this is one firmware bug. Reading little more i was finding that Smart things is sending default response for EP2-4 like this:
Frame Control Field: Profile-wide (0x00)
.... ..00 = Frame Type: Profile-wide (0x0)
.... .0.. = Manufacturer Specific: False
.... 0... = Direction: Client to Server
...0 .... = Disable Default Response: False
And Zigbee standard shall being like this and tuya ZBGW and ZHA is doing it so:
Frame Control Field: Profile-wide (0x18)
.... ..00 = Frame Type: Profile-wide (0x0)
.... .0.. = Manufacturer Specific: False
.... 1... = Direction: Server to Client
...1 .... = Disable Default Response: True
ST is doing one thing wrong you is not sending one default response for one default response but there is sending it server to client and the device is very happy and is not re sending the command and is sending the next without delay.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context
Z2M look have implanting it and looks working OK but they is sending 4 DR.
I like getting hep implanting sending “revers” DR from quirks (force Client to Server and perhaps in the future the opposite if needed) so we can getting the device responding for multiple commands without delay (is now 3 seconds between commands).
One funny but not unexpected thing is that the device is triggering reporting battery then pressing the button for EP2 and its start reporting battery on EP1 and getting one normal DR and its OK and then sending the “on” command from EP2 without delay but is being repeated then the device like having it in the reversed direction (Client to Server and not the standard Server to Client).
Sniff of attribute reported the pressing button 2 and reporting battery attribute and the command:
EP2 Event:
First its reporting battery from EP1:
ZigBee Network Layer Data, Dst: 0x0000, Src: 0xc29e
ZigBee Application Support Layer Data, Dst Endpt: 1, Src Endpt: 1
ZigBee Cluster Library Frame, Command: Report Attributes, Seq: 73
Frame Control Field: Profile-wide (0x08)
.... ..00 = Frame Type: Profile-wide (0x0)
.... .0.. = Manufacturer Specific: False
.... 1... = Direction: Server to Client
...0 .... = Disable Default Response: False
Sequence Number: 73
Command: Report Attributes (0x0a)
Attribute Field
Attribute: Battery Percentage Remaining (0x0021)
Data Type: 8-Bit Unsigned Integer (0x20)
Remaining Battery Percentage: 94,0 [%]
ZigBee Network Layer Data, Dst: 0x0000, Src: 0xc29e
ZigBee Application Support Layer Data, Dst Endpt: 1, Src Endpt: 1
ZigBee Cluster Library Frame, Command: Report Attributes, Seq: 73
Frame Control Field: Profile-wide (0x08)
.... ..00 = Frame Type: Profile-wide (0x0)
.... .0.. = Manufacturer Specific: False
.... 1... = Direction: Server to Client
...0 .... = Disable Default Response: False
Sequence Number: 73
Command: Report Attributes (0x0a)
Attribute Field
Attribute: Battery Percentage Remaining (0x0021)
Data Type: 8-Bit Unsigned Integer (0x20)
Remaining Battery Percentage: 94,0 [%]
Then is sending the command from EP2:
ZigBee Network Layer Data, Dst: 0x0000, Src: 0xc29e
ZigBee Application Support Layer Data, Dst Endpt: 1, Src Endpt: 2
ZigBee Cluster Library Frame
Frame Control Field: Cluster-specific (0x01)
.... ..01 = Frame Type: Cluster-specific (0x1)
.... .0.. = Manufacturer Specific: False
.... 0... = Direction: Client to Server
...0 .... = Disable Default Response: False
Sequence Number: 74
Command: Unknown (0xfd)
Payload
ZigBee Network Layer Data, Dst: 0xc29e, Src: 0x0000
ZigBee Application Support Layer Data, Dst Endpt: 2, Src Endpt: 2
ZigBee Cluster Library Frame, Command: Default Response, Seq: 74
Frame Control Field: Profile-wide (0x18)
.... ..00 = Frame Type: Profile-wide (0x0)
.... .0.. = Manufacturer Specific: False
.... 1... = Direction: Server to Client
...1 .... = Disable Default Response: True
Sequence Number: 74
Command: Default Response (0x0b)
Response to Command: 0xfd
Status: Success (0x00)
I think we have finding the 10 bugs / bad / not working faulty things in this device but perhaps we is finding more in the future.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 19 (11 by maintainers)
I know you are doing a lots of tests and changes and I don’t want to generate any additional noise to them. There is no hurry, but when you test if you can get logs from the retries I will take another look. I believe that the current code have a couple more of interesting debug logs.
Another round to check the repeated responses.
If I have understood correctly the device expects the response to the commands to have the direction reversed. I think it would be possible to override it as follows (just added the
commandfunction):TuyaSmartRemoteOnOffCluster
Totally untested and just trying things. If needed we can also overwrite the `expect_reply` variable.Sorry i was decalking my kaffe machines and was getting water in the power connection and the apartment was shutting down the power so have running around and doing all clocks one more time and helping some Zigbee devices that was having problems (only 3 of round 100). This 2 lines is the interesting:
And this is that parameter that need being
0and not1*direction=<Direction.Client_to_Server: 1>.I have not testing your last code then i need doing changes in the HA container and its taking little time doing right and not braking HA (if copy the INIT to the wrong folder).
I doing it later or tomorrow and reporting back 😃))