Skip to content

Instantly share code, notes, and snippets.

@donbobka
Forked from fr3nd/TS0041.yaml
Created January 3, 2024 23:52
Show Gist options
  • Save donbobka/0937f6830c33f949e2caec1bd4ab51eb to your computer and use it in GitHub Desktop.
Save donbobka/0937f6830c33f949e2caec1bd4ab51eb to your computer and use it in GitHub Desktop.
Zigbee2MQTT - Tuya 1-button Scene Switch (TS0041)
blueprint:
name: Zigbee2MQTT - Tuya 1-Button Scene Switch
description: Automate your Tuya 1-Button Scene Switch via Zigbee2MQTT.
domain: automation
input:
switch:
name: Tuya 1-Button Scene Switch
description: Tuya 1-Button Scene Switch to use
selector:
entity:
integration: mqtt
domain: sensor
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/fr3nd/2d128a932708ad2238a9439fbc256514
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 == 'hold' }}"
sequence: !input "button_one_long_press"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment