Skip to content

Instantly share code, notes, and snippets.

@dcramer
Forked from seamus65/ZHA - Sonoff SNZB-01.yaml
Created September 4, 2021 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcramer/26d11847e3a4773d0f64d94b17f7609a to your computer and use it in GitHub Desktop.
Save dcramer/26d11847e3a4773d0f64d94b17f7609a to your computer and use it in GitHub Desktop.
blueprint:
name: ZHA - Sonoff SNZB-01
description: 'Perform actions with the Sonoff SNZB-01 Button.
You can set functions for single press, double press and hold. This allows you to assign,
e.g., a scene or anything else.'
domain: automation
input:
remote:
name: Remote
description: Sonoff Button to use
selector:
device:
integration: zha
manufacturer: eWeLink
model: WB01
single_press:
name: Single press
description: Action to run on single press
default: []
selector:
action: {}
double_press:
name: Double press
description: Action to run on double press
default: []
selector:
action: {}
hold:
name: Hold
description: Action to run on hold
default: []
selector:
action: {}
source_url: https://gist.github.com/seamus65/2be0f8c665ac8c1e011fbd1a0937f9e1
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input 'remote'
action:
- variables:
command: '{{ trigger.event.data.command }}'
cluster_id: '{{ trigger.event.data.cluster_id }}'
endpoint_id: '{{ trigger.event.data.endpoint_id }}'
- choose:
- conditions:
- '{{ command == "toggle" }}'
- '{{ cluster_id == 6 }}'
- '{{ endpoint_id == 1 }}'
sequence: !input 'single_press'
- conditions:
- '{{ command == "on" }}'
- '{{ cluster_id == 6 }}'
- '{{ endpoint_id == 1 }}'
sequence: !input 'double_press'
- conditions:
- '{{ command == "off" }}'
- '{{ cluster_id == 6 }}'
- '{{ endpoint_id == 1 }}'
sequence: !input 'hold'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment