zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

New device - 30s timeout for every state change

Open fredrikgk opened this issue 7 years ago β€’ 30 comments

I am running: zigbee2mqtt version 1.0.1 (commit #9380bbc) CC2531 FW version 20180815

I am trying to add support for http://proff.elko.no/elko-smart-home-316gled/esh-plus-316gled-dimmer-rf-ph-article2658-1781.html (this is in Norwegian since the brand is only sold in the Scandinavian markets) - Basically a dimmer switch with a Silabs Zigbee module integrated.

I have successfully set it up so that HomeAssistant receives status from the dimmer switch, and can also send commands to it.

When I change state of the dimmer from HomeAssistant, the dimmer updates immediately. However, then something happens (or does not happen) which effectively blocks any new command from being sent over the air. I can see in the log that the first message sent is reported as failed with a 30 s timeout, although it seems like the dimmer has actually acknowledged the first message.

Any message sent after the initial command will be transmitted over the air right after the 30 s timeout, but will trigger a new similar timeout.

Here is a log of an OFF command until the timeout happens: https://pastebin.com/0KuAmHtY

Here is a log of an OFF command sent with an ON command following immediately after: https://pastebin.com/RyfwYXaW

If required I can provide a sniffer capture of the actual Zigbee communication.

I am in over my head here with limited knowledge about Zigbee and even less about JS. Any help is appreciated.

Thanks, Fredrik

fredrikgk avatar Jan 21 '19 20:01 fredrikgk

Can you try setting https://github.com/Koenkk/zigbee2mqtt/blob/master/lib/extension/devicePublish.js#L24

to

this.queue.concurrency = 10;

Koenkk avatar Jan 22 '19 14:01 Koenkk

That does the trick, sort of. I am now able to send commands back to back, but I do still get the "failed with error Error" timeouts after 30 s. Sending more than 10 commands also halts the system.

Any insight into what causes the error?

fredrikgk avatar Jan 22 '19 18:01 fredrikgk

The clogging issues should be fixed in the dev branch, can you confirm this?

I'm not sure yet what causes the timeout errors.

Koenkk avatar Jan 22 '19 19:01 Koenkk

I confirm that clogging issues are resolved on the dev branch.

fredrikgk avatar Jan 23 '19 20:01 fredrikgk

Great, despite the errors in the log, does everything work? If so, can you make a PR?

About the errors, it's hard to debug but my guess is that the device is not fully ZCL compliant.

Koenkk avatar Jan 26 '19 18:01 Koenkk

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 27 '19 19:03 stale[bot]

@Koenkk

I just updated to the latest version on the dev branch, and this problem has reappeared. There seems to have been significant changes in devicePublish.js since the proposed workaround above, as well as the official fix you added at the end of January.

Any suggestion on how to fix this (again)?

fredrikgk avatar Jun 05 '19 14:06 fredrikgk

Did you change the firmware? Can you post the DEBUG=* npm start log?

Koenkk avatar Jun 06 '19 09:06 Koenkk

I have not updated the FW. I will try that first.

fredrikgk avatar Jun 08 '19 05:06 fredrikgk

I updated to the 20190425 FW and the problem is still there. It is only affecting the dimmer switches, I can toggle my TrΓ₯dfri outlet while waiting for the 30s timeout of the dimmer.

Here is the DEBUG=* nom start output: https://pastebin.com/2ZPDTG3x

fredrikgk avatar Jun 11 '19 20:06 fredrikgk

The reasons of these errors seems that zigbee-shepherd is waiting for an APS ACK of the device while the device never does this. Can you confirm this by sniffing the zigbee traffic?

Koenkk avatar Jun 12 '19 07:06 Koenkk

That is the case, indeed! Is there anyway to work around this issue?

Capture

fredrikgk avatar Jul 07 '19 19:07 fredrikgk

Probably yes, can you add a section like this https://github.com/Koenkk/zigbee-shepherd-converters/blob/master/devices.js#L4424 to the device in devices.js

Koenkk avatar Jul 08 '19 06:07 Koenkk

Adding the disFeedbackRsp option does not solve the issue. It stops commands to other similar devices from being blocked, but commands to the same device is still blocked for 30 s.

fredrikgk avatar Jul 10 '19 05:07 fredrikgk

Can you try changing https://github.com/Koenkk/zigbee-herdsman/blob/master/src/lib/components/af.ts#L797 to

    var afOptions = ZSC.AF.options.DISCV_ROUTE;

Koenkk avatar Jul 10 '19 16:07 Koenkk

Nah, that did not do it either.

I have sent an email to the manufacturer also. This is probably not an issue for them as they only support their own gateway, so I am not sure they will actually fix it.

fredrikgk avatar Jul 15 '19 08:07 fredrikgk

Did you change the .ts or .js file? The .ts file requires recompilation (forgot to mention that, sorry). Therefore I would advise changing the .js file

Koenkk avatar Jul 15 '19 19:07 Koenkk

I did actually change the .js file.

fredrikgk avatar Jul 18 '19 05:07 fredrikgk

Ok, so https://github.com/Koenkk/zigbee2mqtt/issues/914#issuecomment-509913662 does make a difference right? Can you post the DEBUG* npm start logging when running with this?

Koenkk avatar Jul 20 '19 15:07 Koenkk

I took a step back and updated to the latest version on the dev branch. This also meant that I switched from Shepherd to Herdsman.

Out of the box, this gave a 30 s delay, but only for the same device. Meaning I could control multiple devices sequentially without delays, but any consecutive command would be halted for 30 s.

var afOptions = ZSC.AF.options.DISCV_ROUTE; does not change anything

options: { disFeedbackRsp: true, however, now resolves the problem.

Thanks for all your help! I will let you know if I here anything from the manufacturer.

Do you want me to do a PR to zigbee-shepherd-converters or can you add the line directly?

fredrikgk avatar Jul 22 '19 07:07 fredrikgk