Skip to content

Instantly share code, notes, and snippets.

@niklaszerozero
Last active January 7, 2025 16:30
Show Gist options
  • Save niklaszerozero/e527557ead5836473ad1625e45bb3fd9 to your computer and use it in GitHub Desktop.
Save niklaszerozero/e527557ead5836473ad1625e45bb3fd9 to your computer and use it in GitHub Desktop.
mode: single
max_exceeded: silent
blueprint:
name: Sonoff Wireless Switch
description: "
Trigger actions using a Sonoff Wireless Switch like the SNZB-01.
This blueprint supports event entities and therefore is compatible with Zigbee2MQTT 2.0.0.
**Version**: 0.0.1
"
source_url: https://gist.github.com/NiklasZeroZero/e527557ead5836473ad1625e45bb3fd9
domain: automation
input:
switch_entity:
name: Action Entity
description: The action entity published by the Sonoff Wireless Switch
default: ""
selector:
entity:
filter:
- domain: event
multiple: false
action_single_press:
name: Single Press Action
description: The action that should be executed when the switch is pressed a once.
selector:
action:
action_double_press:
name: Double Press Action
description: The action that should be executed when the switch is pressed a twice.
selector:
action:
trigger:
- platform: state
entity_id:
- !input switch_entity
not_from: unavailable
action:
- variables:
action: "{{ trigger.to_state.attributes.event_type }}"
- choose:
- conditions:
- condition: template
value_template: "{{action == 'single'}}"
sequence: !input action_single_press
- conditions:
- condition: template
value_template: "{{action == 'double'}}"
sequence: !input action_double_press
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment