I have a Sonoff SNZB-01P Zigbee button, and I’m using it with the Sonoff Zigbee Bridge Pro. I first paired the button using the eWeLink app, and then integrated it into Home Assistant using the SonoffLAN integration.
The device shows up in Home Assistant, but when I try to create an automation, I can only use battery status as a trigger — there are no options for button presses (single, double, long press, etc).
Is there any way to capture button press events using SonoffLAN and the Zigbee Bridge Pro?
Show us the device view. And I would use the device trigger, rather state trigger. So please check if your device has a action or event or any other entity in the device (give us screen)
Make an automation and as a trigger use entity, not device.
This is how I have it for SNZB-01 (non-P version)
triggers:
- trigger: state
entity_id:
// here change the entity to your one
- event.bathroom_washing_machine_button_action
attribute: event_type
to: single
conditions:
actions:
... my actions here
mode: single
But I use the Zigbee2MQTT without Sonoff bridge, so you need to inspect your device.
“Alright, I was able to get a trigger from the button this way. But there’s only a single trigger for single, double, and hold presses. Is there a way to handle this?”
Use an entity-based State trigger, not a Device trigger.
triggers:
- trigger: state
entity_id: sensor.snzb_01p #or whatever your actual entity ID is
Use Conditions (also known as “And If” in the Automation editor). You will need to use a Template condition like:
conditions:
- alias: Check if it was a single press.
condition: template
value_template: "{{ trigger.to_state.state == 'single' }}"
If you want, you could use the conditions within a Choose action instead of in the general Condition block, so that one automation covers all the different button press types.