Skip to content

Instantly share code, notes, and snippets.

@haade-administrator
Created November 28, 2023 14:55
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 haade-administrator/1a9c217a3f2cdf0ba149d4f2f186e6d4 to your computer and use it in GitHub Desktop.
Save haade-administrator/1a9c217a3f2cdf0ba149d4f2f186e6d4 to your computer and use it in GitHub Desktop.
Automate Sonoff SNZB-01P switch with blueprint for Home Assistant
blueprint:
name: Zigbee2MQTT - Sonoff SNZB-01P Scene Switch
description: Automate your Sonoff SNZB-01P Scene Switch via Zigbee2MQTT.
domain: automation
input:
switch:
name: Tuya 1-Button Scene Switch
description: Sonoff SNZB-01P Scene Switch to use
selector:
entity:
integration: mqtt
domain:
- sensor
multiple: false
button_one_short_press:
name: Single Press - Button
description: Action to run on button single press
default: []
selector:
action: {}
button_one_double_press:
name: Double Press - Button
description: Action to run on button double press
default: []
selector:
action: {}
button_one_long_press:
name: Long Press - Button
description: Action to run on button long press
default: []
selector:
action: {}
source_url: https://gist.github.com/haade-administrator/1a9c217a3f2cdf0ba149d4f2f186e6d4
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id: !input switch
attribute: action
action:
- variables:
command: "{{ trigger.to_state.state }}"
- choose:
- conditions:
- "{{ command == 'single' }}"
sequence: !input button_one_short_press
- conditions:
- "{{ command == 'double' }}"
sequence: !input button_one_double_press
- conditions:
- "{{ command == 'long' }}"
sequence: !input button_one_long_press
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment