MQTT Zigbee Switch doesn't change state

Hi there,

I’ve come across a weird issue - without any changes (maybe an HASS update?) on my side and after this worked for months.
I have multiple Nous A1Z controlled/metered power switches installed, and I am controlling / reading them via Zigbee2MQTT.

For my washing machine I have an automation to switch the machine on at a programmed time and this is where I noticed the issue, cause I got home and the machine hadn’t started.

Turns out the switch cannot change state from HASS interface anymore, it always resets after ~2s, it still reports the power draw without any issues and can be controlled manually with the button on the hardware.

I have compared its settings with an identical device, and everything is the same (except the name, and some values like link quality (but within 8%)). The only difference I see is the above script.

I’m not even sure how to troubleshoot this.
In the Zigbee2MQTT logs I can see those messages when I switch another one on

2024-03-20 06:54:18MQTT publish: topic 'zigbee2mqtt/Küchengeräte', payload '{"child_lock":"UNLOCK","current":0.04,"energy":44.99,"indicator_mode":"off/on","linkquality":152,"power":0,"power_outage_memory":"restore","state":"ON","update":{"installed_version":-1,"latest_version":-1,"state":null},"update_available":null,"voltage":229}'


2024-03-20 06:54:18MQTT publish: topic 'zigbee2mqtt/Küchengeräte', payload '{"child_lock":"UNLOCK","current":0.04,"energy":44.99,"indicator_mode":"off/on","linkquality":152,"power":0,"power_outage_memory":"restore","state":"ON","update":{"installed_version":-1,"latest_version":-1,"state":null},"update_available":null,"voltage": 229}'

And they don’t happen when I flick the switch for the “buggy” one.
I’ve checked in the HASS dev tools for the status of the ‘switch.WaMa’ and I can set it from there for the interface - but it doesn’t reflect the actual state and does not affect it.
So somehow this entity got “disconnected” from its MQTT entity?

Any idea how to proceed?

Edit: Further things I tried:

  • Turning the switch(switched socket) on and off (unplugging - wait 10s - replugging)
  • Restarting Homeassistant

You mean the switch in HA, or the physical button on the plug itself?

If the physical button doesn’t cause it to toggle the load connected to the plug, you’ve got a dead relay inside.
If the physical button works, then try setting Z2MQTT logs to debug and click reconfigure (yellow icon on the device page).

Did you try to switch it in the Zigbee2MQTT UI ?

I was referring to the switch in HA, I did not control the logs when I used the physical button.

@francisp
I’m not sure whether I found that toggle in the z2mqtt section (at that point), but testing it now:

everything works as intended… which is almost worse than it not working, cause I have no idea why/what happened… Maybe I fixed it by using the toggle in the Zigbee2MQTT settings, but I doubt it…

How strong/weak is the signal strength (LQI) with that particular switch? Or maybe the switch sits close to a WiFi device which interferes with the Zigbee signal?

If it is rather weak (< 40) it can happen that the switch misses the command to switch to ON. Especially if the idle time before any other command to that switch has been long.

As a workaround I configured the action-part (switch.turn_on or homeassistant.turn_on) within the referring HA-automation for switches with a rather weak LQI to run twice with a 2 seconds delay inbetween:

  action:
    - service: switch.turn_on
      target:
        entity_id: switch.küchengeräte
    - delay:
        seconds: 2
    - service: switch.turn_on
      target:
        entity_id: switch.küchengheräte

Works well here.

LQI is 164 and others that are working fine had lower numbers… So I doubt this is the issue… no wifi devices within 2m and at least 1 wall in between, and even then only small clients…