Files
homeassistant/sonoff_zigbee_button.yaml

86 lines
2.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 automations 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'