-
Notifications
You must be signed in to change notification settings - Fork 1
/
zigbee2mqtt_hue_smart_button_press_and_hold_actions.yaml
68 lines (63 loc) · 1.87 KB
/
zigbee2mqtt_hue_smart_button_press_and_hold_actions.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
blueprint:
name: Zigbee2MQTT - Hue smart button - press and hold actions
description: |
This blueprint allows you to make automations based on the Hue smart button, connected to Zigbee2MQTT.
Actions can be set up for single press and hold, hold you can configure with a cooldown, to prevent your actions from running on every single hold action.
domain: automation
source_url: https://raw.githubusercontent.com/golles/Home-Assistant-Blueprints/main/zigbee2mqtt_hue_smart_button_press_and_hold_actions.yaml
input:
smart_button:
name: Smart button
description: Hue smart button to use (pick the sensor that end with _action).
selector:
entity:
integration: mqtt
domain: sensor
press_action:
name: Press
description: Action to run on button press.
default: []
selector:
action:
hold_action:
name: Hold
description: Action to run on button hold.
default: []
selector:
action:
hold_cooldown:
name: Hold cool down
description: Prevent this automation from being ran more often than only once while in this cool down.
default: 3
selector:
number:
min: 0
max: 60
unit_of_measurement: seconds
mode: single
max_exceeded: silent
trigger:
platform: state
entity_id: !input smart_button
to:
- "on"
- "off"
- "hold"
action:
- variables:
to_state: "{{ trigger.to_state.state }}"
- choose:
# Button is being pressed.
- conditions:
- "{{ to_state in ['on', 'off'] }}"
sequence: !input press_action
# Button is being hold.
- conditions:
- "{{ to_state == 'hold' }}"
sequence:
- choose:
- conditions:
- "{{ true }}"
sequence: !input hold_action
- delay:
seconds: !input hold_cooldown