Skip to content

Instantly share code, notes, and snippets.

@seamus65
Last active February 2, 2024 05:46
Show Gist options
  • Save seamus65/2be0f8c665ac8c1e011fbd1a0937f9e1 to your computer and use it in GitHub Desktop.
Save seamus65/2be0f8c665ac8c1e011fbd1a0937f9e1 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