Hello,
I am trying to create a automation. So when I press my button switch (Model SNZB-01, Sonoff) I want that the light opens. How can I do it ? Please help me. Thanks.
Here’s my automation which responds to regular press, long press, and double-press on the SNZB-01:
# J's button
- alias: Sonoff ZB Button Receive
trigger:
platform: event
event_type: zha_event
event_data:
device_ieee: 00:12:4b:00:1f:9a:fa:fb
action:
- choose:
- conditions:
- '{{ trigger.event.data.command == "toggle" }}'
sequence:
- service: homeassistant.toggle
entity_id: switch.j_desk_lamp
- conditions:
- '{{ trigger.event.data.command == "on" }}'
sequence:
- service: homeassistant.toggle
entity_id: light.wall_n
- conditions:
- '{{ trigger.event.data.command == "off" }}'
sequence:
- service: homeassistant.toggle
entity_id: input_boolean.zoom_lighting
Your device_ieee value will be different.
The way to find the information you need is to use the Developer Tools, Event tab and look for events of the type zha_event. Then do the button presses. It’ll show you all the information from the event and you can choose what to use from that.
1 Like
Thank you. I will try it.