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.
2 Likes

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

Iā€™m seeing exactly this issue - actions ā€œdisappearā€ (showing as Unknown trigger in automations). It has happened with one of my Xiaomi Aqara buttons for a while, but has now also affected an Xiaomi light switches (when used ā€˜detachedā€™ with an automation for more advanced actions), and an Ikea button. Itā€™s driving me crazy!

Unfortunately Iā€™m already running Zigbee2MQTT 1.36.0 - so if it is the same issue that was fixed in 1.34.0, itā€™s broken again.

Does anyone have any suggestions on how I can diagnose (and hopefully fix) this? Thanks in advance.

Same issue here: my 2 aqara switches (Mi wireless switch (WXKG01LM)) seem to not have any action. Of course, any associated automation does not work any more as they do not have a trigger any more.
zigbee2mqtt [1.36.0] commit: [86ed71c]

It may be a coincidence, however I feel this issue happens since core update 2024.7.2

Hi, is anybody experiencing this issue again in January 2025 with the most recent version of Zigbee2MQTT (2.0.0) and Home Assistant (2025.1.0)?
Unfortunately Iā€™ve upgraded both at the same time and I have no clue which one broke my Aqara mini switches this time;-)
[edit]
It seems to be a feature of the new Zigbee2MQTT version: Zigbee2MQTT 2.0.0 breaking changes Ā· Koenkk/zigbee2mqtt Ā· Discussion #24198 Ā· GitHub

5 Likes

The Z2M upgrade broke a couple of my scene switches, they lost their Action trigger. I managed to fix them however, I donā€™t think it is the best method. I am posting this here hoping someone will come along and help me fix it the proper way.

Visit:

HA/Zigbee2MQTT/Settings/Home Assistant Integration

Then check the ā€œHome Assistant legacy action sensorsā€ box and SUBMIT. My scene devices came back online immediately.

7 Likes

Iā€™m having same issue after installing ZigBee2MQTT 2.0.0-1.
I can see action in Z2M web interface, but action doesnā€™t appear in MQTT device interface.
My version of HA Core is 2024.12.5
Any help.
Thanks

SAme here. I did upgrade only ZigBee2MQTT 2.0.0-1 yesterdsay. All my xxx_actions are gone. I restored the backup and they donā€™t reappear.

You need to use event entities now, see: Home Assistant | Zigbee2MQTT

Thereā€™s some discussion on the breaking changes in this update over on the Discord channel.

Iā€™m going to hold off updating for now.

I found a workaround.

All my entities have a technical name that is different from their friendly name.
In the past, zigbee2mqtt was maintaining the ā€œtechnical name_actionā€ but now after reactivating the settings to keep legacy fashion, the entity is "friendly name_action"

I am investigatingt to replace it by tthe ā€œplatform mqttā€ triggering.

Why not just use the new event.xxx entities instead of the sensor.xxx entities you were using?

This is how things work from 2.0 onwards.

Thanks, it worked for me with my TF0044 4 buttons scene switches!

Do you have an example or a link ?

Yep, a couple of posts up: Action entity missing for zigbee switches - Zigbee2MQTT - #12 by tom_l

Just an FYI for those looking into this:
As someone mentioned previously, go to the Z2M settings page - home assistant integration and enable one of two options: or the legacy, or the experimental.
for me both were dissabled so I did not get the event nor the action entities

1 Like

Loads of breaking changes in this z2m update, particularly if you setup z2m years ago.

  1. Before updating to the latest z2m Iā€™ve enabled the option ā€œHome assistant experimental event entitiesā€ in Settings ā†’ Home Assistant Integration. Iā€™ve left the legacy options intact for now
  2. Restart z2m
  3. Check the States page in Home Assistant for all of the new event.xyz_action entities that have appeared
    4. In your YAML, update the old sensor.xyz_action entity name with the new event.xyz_action entity name.

In my case I donā€™t think any other changes are required? My event.xyz_action entities are named exactly the same as my sensor.xyz_action entities, so I only have to swap sensor for event in my YAML. And the actions themselves seem to be the same. ie ā€œoff-holdā€, ā€œsingleā€ etc

Sample YAML where Iā€™ve only needed to swap out sensor with event:

</s> <s> - platform: state # zigbee2mqtt event</s> <s> entity_id: event.sitting_room_hue_dimmer_switch_action</s> <s> attribute: action</s> <s> to: "off-hold"</s> <s>

Iā€™m not updating z2m yet though as I have to make this change across many YAML automations and also have to work out the impacts from the removal of legacy entity attributes; Iā€™ve had that option enabled from day one and I think I have a lot of custom sensors and automations that rely on this.

EDIT: check my post below for some issues with this approach, such as automations not triggering where the same button is pressed more than once: Action entity missing for zigbee switches - Zigbee2MQTT - #25 by jdbrookes

You should instead follow the guide below to handle the new event entities: Using the new action events in Zigbee2MQTT 2.0 - Configuration / Zigbee - Home Assistant Community

2 Likes