I have been using the SONOFF SNZB-01P pushbuttons for a while now using Z2M and HA (both on latest docker version). Since a recent container update, the pushbuttons stopped working.
Basically I see the action with double/single state in both Z2M and in HA’s “MQTT Info → Most recent messages”, but the action is not available as an entity in HA anymore.
If I view the button device in HA, I see no fields or states in which the double/single button press is captured.
Any ideas how to fix this and get an action double/single entity or state available for use in an automation?
This is the automation that stopped working:
Here’s my automation:
- alias: Enable larm
mode: restart
trigger:
- platform: state
entity_id: sensor.alarm_knop_boven_action
to: 'single'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.alarm_always
I started experiencing the same issue recently, even though everything was working perfectly before. Could you please let me know where exactly you made these parameter changes?
If you have Studio Code Server installed, go to /config/zigbee2mqtt/configuration.yaml and add legacy_action_sensor: true under homeassistant block.
Restart the addon and the action event should be back. I’m so angry at the Z2M team for this stupid change.
The change was made to comply with how the Home Assistant team suggests button events should be handled.
Z2M’s documentation has warned (for a long time) to avoid using the legacy method to detect button events.
@teleoltre
The option you enabled is likely to be eliminated eventually. You should consider adapting your automations to use either a State Trigger with your device’s associated event entities or the MQTT Device Trigger (assuming all desired button events are supported).
Here’s a good explanation for how to use a device’s event entities.