Skip to content

Instantly share code, notes, and snippets.

@ramoncardena
Created January 4, 2024 19:00
Show Gist options
  • Save ramoncardena/6986515d61d4bf8ed281de8fd46c0906 to your computer and use it in GitHub Desktop.
Save ramoncardena/6986515d61d4bf8ed281de8fd46c0906 to your computer and use it in GitHub Desktop.
Sonoff WB01 Blueprint
---
blueprint:
name: Sonoff Zigbee Switch
description: Automate the Sonoff Zigbee WB01
domain: automation
input:
sonoff_button:
name: Sonoff Switch
selector:
device:
integration: zha
manufacturer: eWeLink
model: WB01
toggle_action:
name: Single Press
description: Action to run on single press
default: []
selector:
action: {}
on_action:
name: Double Press
description: Action to run on double press
default: []
selector:
action: {}
off_action:
name: Long Press
description: Action to run on long press
default: []
selector:
action: {}
mode: single
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input sonoff_button
variables:
toggle_action: !input toggle_action
on_action: !input on_action
off_action: !input off_action
action:
- variables:
command: '{{ trigger.event.data.command }}'
- choose:
- conditions:
- '{{ command == "toggle" }}'
sequence: !input toggle_action
- conditions:
- '{{ command == "on" }}'
sequence: !input on_action
- conditions:
- '{{ command == "off" }}'
sequence: !input off_action
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment