Action entity missing for zigbee switches - Zigbee2MQTT

I use Zigbee2MQTT for my zigbee devices. Thermostats, thermometers and window sensors, work fine but the two remotes I have recently stopped working.
Zigbee2MQTT reports having sent the message containing the button press to Mosquitto but HA does not parse the message correctly.

The device once had an sensor.fernbedinung_kai_action entity which is no longer present.

Attempted solutions:

  • Repairing of the zigbee device: no change in behaviour
  • Listening to all Zigbee2MQTT messages: the two messages from the first image get received.
1 Like

Couple thoughts…

  1. I think there have been a number of changes in Home Assistants’ interaction with MQTT devices and specifically with Zigbee2MQTT in last couple of revisions of HA. There were some sync issues between versions of HA and Zigbee2MQTT during these changes. Check change logs and carefully check versions of HA, MQTT and Zigbee2MQTT.

  2. I am kind of ‘old school’ so I do not let HA auto create my sensors, switches, lights and stuff, but rather manually create entities. If I read you post correctly, you are seeing the MQTT messages you want, just HA’s auto create if the device is not creating the entity. A bit if a hack, but you could continue to let HA create the other entities, but then manually create the missing entities by creating MQTT switches.

  3. I am not a big fan of having ‘spaces’ or other ‘special’ characters in my MQTT topics, this has caused me some ‘head scratching’ sessions in the past. Even, the difference between underscores _ and dashes - can cause some ‘burps’ in some systems that interact with MQTT. I would stay away from spaces in topic names and make your ‘nice’ names within Home Assistants ability to do that there.

Good hunting!

1 Like

I’ve been experiencing this same issue on and off for the past few months on a system which was working very well all summer. Doing some debug logging, I can see the messages as I’d expect in the Zigbee2MQTT logs. Here’s a trimmed set of logged messages that were the result of a down_triple action coming from one of my Inovelli Zigbee wall switches.

From Zigbee2MQTT:

Info 2023-11-08 10:41:53 MQTT publish: 
  topic 'zigbee2mqtt-ranch/office-hall-lights', 
  payload '{"action":"down_triple", . . . }'

Info 2023-11-08 10:41:53 MQTT publish: 
  topic 'zigbee2mqtt-ranch/office-hall-lights/action',
  payload 'down_triple'

That all looks like how I would expect it to look. Two MQTT messages published to two topics.

However, over on the Home Assistant side, I see three messages to two topics. The first has the action correctly included. It is immediately followed by a second message where the action text is suspiciously empty. This is from the HA MQTT integration settings under “Listen to a topic”:

Listening to zigbee2mqtt-ranch/office-hall-lights shows me this for that message. Again, this is a single message as reported by the Zigbee2MQTT logs, but shows as two messages on the HA side. I edited out all the other payload JSON for clarity:

Message 1 received on zigbee2mqtt-ranch/office-hall-lights at 10:41:
{
    "action": "",
    . . .
}
QoS: 0 - Retain: false

Message 0 received on zigbee2mqtt-ranch/office-hall-lights at 10:41:
{
    "action": "down_triple",
    . . . 
}
QoS: 0 - Retain: false

Listening to zigbee2mqtt-ranch/office-hall-lights/action looks like I think it should:

Message 2 received on zigbee2mqtt-ranch/office-hall-lights/action at 10:41:

down_triple

QoS: 0 - Retain: false

What I see these days is that every time I upgrade Home Assistant, all of these automations break in Home Assistant because it seems to forget nearly all of the actions for the devices. This was working great as a “down_double” action automation until I upgraded Home Assistant and then my Automation looks like this:

The trigger drop-down when I’m using the HA GUI to edit my automation only shows up_double and none of the other double or triple actions supported by the switch. If I restart Home Assistant, it even forgets the up_double. Surely this list of device actions is supposed to survive a Home Assistant restart, right?

Usually I’ve had good luck by walking around and hitting all the combinations of values on each physical switch, then shift-reloading Home Assistant and restarting Home Assistant and then pressing the combinations again and repeating those steps over and over and then eventually HA seems to learn all the actions it’s supposed to know for that device then I’m running great until the next time I upgrade Home Assistant.

I’m not having any luck with that approach now, though, with HA 2023.11 and 2023.11.1.

Does anyone know if the doubled MQTT logs/messages on the HA side is expected or possibly indicates a problem? Is there any other debugging I can provide that might be helpful?

This seems to be a new problem that’s arisen the past 2 months or so. I’m not really familiar with the MQTT integration in HA, but I do plan to continue digging to see if I can figure it out.

I’m running a standalone Zigbee2MQTT (not the HA Add-on) if that’s relevant.

This may be related to a change in Z2M and HA from last month:

And potentially resolved in the pending-release Z2M 1.33.3.

I’m no longer experiencing this problem since upgrading to Zigbee2MQTT 1.34.0