Skip to content

Instantly share code, notes, and snippets.

@fr3nd
Last active August 11, 2025 17:31
Show Gist options
  • Save fr3nd/2d128a932708ad2238a9439fbc256514 to your computer and use it in GitHub Desktop.
Save fr3nd/2d128a932708ad2238a9439fbc256514 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"
@florentio42
Copy link

Salut , j'ai un TS0041 avec enormement de latence , dans quel dossier dois-je ajouter ton code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment