From a1818444dbfa4f6b899a6c98b8a42c2f6a434c5f Mon Sep 17 00:00:00 2001 From: ruisjz Date: Tue, 4 Nov 2025 19:31:38 -0100 Subject: [PATCH] Adicionar sonoff_zigbee_button.yaml --- sonoff_zigbee_button.yaml | 86 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sonoff_zigbee_button.yaml diff --git a/sonoff_zigbee_button.yaml b/sonoff_zigbee_button.yaml new file mode 100644 index 0000000..96bb177 --- /dev/null +++ b/sonoff_zigbee_button.yaml @@ -0,0 +1,86 @@ +blueprint: + name: Sonoff Zigbee Button + description: Setup actions for three functions of the SONOFF Zigbee button with + Press, Double Press, and Hold. + domain: automation + input: + button_id: + name: Button + description: The button to configure. + selector: + device: + filter: + - manufacturer: eWeLink + model: WB01 + - manufacturer: eWeLink + model: SNZB-01 + multiple: false + mode: + name: Automation mode + description: The automation’s mode configuration option controls what happens when the automation is triggered while the actions + are still running from a previous trigger (see [Automation modes](https://www.home-assistant.io/docs/automation/modes/)). + default: single + selector: + select: + options: + - single + - restart + - queued + - parallel + press_action: + name: Press Action + description: Action to perform on Press. + default: [] + selector: + action: {} + double_press_action: + name: Double Press Action + description: Action to perform on Double Press. + default: [] + selector: + action: {} + hold_action: + name: Hold Action + description: Action to perform on Hold. + default: [] + selector: + action: {} + source_url: https://github.com/apollo1220/blueprints/blob/main/sonoff_zigbee_button.yaml +variables: + button_id: !input 'button_id' + press_action: !input 'press_action' + double_press_action: !input 'double_press_action' + hold_action: !input 'hold_action' + mode: !input 'mode' +mode: !input 'mode' +max_exceeded: silent +trigger: +- platform: event + event_type: zha_event + event_data: + device_id: !input 'button_id' + command: "toggle" +- platform: event + event_type: zha_event + event_data: + device_id: !input 'button_id' + command: "on" +- platform: event + event_type: zha_event + event_data: + device_id: !input 'button_id' + command: "off" +action: +- choose: + - conditions: + - condition: template + value_template: '{{ trigger.event.data.command == "toggle" }}' + sequence: !input 'press_action' + - conditions: + - condition: template + value_template: '{{ trigger.event.data.command == "on" }}' + sequence: !input 'double_press_action' + - conditions: + - condition: template + value_template: '{{ trigger.event.data.command == "off" }}' + sequence: !input 'hold_action' \ No newline at end of file