Turning zigbee switches on/off via automation doesn't always happen

I have 19 zigbee devices. Some of these I turn on/off via automation. However I have noticed that every once in a while a “turn on” or “turn off” action doesn’t happen. In the log it says that it has done it, but I can see on the device that it has not.

How can I debug this issue?

Start with the basics. Are the devices you have issued with routers or end devices?

Also are you using ZHA or Z2M?

I’m using Zigbee2MQTT and the devices are a Sonoff ZBMiniL2 and a Aqara Smart Plug.
I’m not sure how to determine if they are “routers”. They are both powered by 230v.

Both of those are router devices (most mains powered devices are with just a few exceptions).

Are they both missing commands or just one of them?

Both of them are missing commands. Not always, but sometimes.

Hmmm :thinking: What controller are you using? The only thing I can think of is that maybe your controller isn’t sending out messages properly. Or perhaps it might be interference from other, nearby devices.

Typically if you look at the Z2M logs, you can see the reason why a command fails. But you said your logs are not showing any errors, right? That leads me to think either your controller is having issues OR you have some interference problem where the message is being sent, but being lost.

Look inside the Zigbee2MQTT UI (Device page will show EndDevice or Router). I don’t think the ZbMiniL is a router, as it is a no neutral switch.

this may be too naive of a question, but have you already checked the lqi for those devices on the map and verify that the signals are strong to them? I see flakiness if mine are lower lqi…

The sonoff ZBminiL2 has been reported to be slow to respond a few times in this forum. Nothing much you can do about it.

The Aqara plug, on the other hand, should report instantly. Can you check the map in Z2Mqtt to see whether it’s connected directly to the coordinator, or whether it’s connected via a router?

This is the map (with the 2 problematic devices outlined):

I don’t use zigbee but I’ve seen this situation with zwave and nest thermostats. So I built a set of HA scripts that retry. They are here

This is my zigbee map:


.

Only this one particular dimmer, which is well meshed, can take 5-10 seconds to turn on sometimes:


.

I have no idea why. It’s a module rather than a switch mechanism so I’m going to try repositioning it next time I can be bothered getting up in the roof space. If that does not work I’ll try replacing it.

your map looks tenuous to me. in addition to those two that have no redundancy in connectivity, you have 3 others that look weak and the door sensor not connected at all…

i don’t know that you need to achieve @tom_l level map insestuousnes, but getting your zigbee family more connected would probably help. can you get a repeater closer to those two problematic ones?

I got it working again. I had to remove 1 device and add it again. All of my lights and switches are “smart” using another solution (IHC - not zigbee), so I don’t have that many router devices, which I guess is somewhat of a problem.

Thanks to everyone who tried to help :slight_smile:

My zigbee network now looks like this: