-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathz2m_huedimmerv2_bp.yaml
106 lines (106 loc) · 3.56 KB
/
z2m_huedimmerv2_bp.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
blueprint:
name: Philips Hue Dimmer switch v2 (Zigbee2MQTT)
description:
"Hacked up version of Philips Hue Dimmer switch v2 (Zigbee2MQTT) to work with the new z2m v2
"
domain: automation
input:
hue_dimmer_v2_device:
name: Philips Hue v2 Smart Dimmer Switch and Remote
description: List of available Philips Hue v2 Smart Dimmer Switch and Remote devices
selector:
device:
integration: zha
model: RWL022
on_press:
name: ON button press
description: Action to run
default: []
selector:
action: {}
source_url: "https://gist.github.com/CrazyCoder/28d660d9e2e8464458e591ad79b3698e"
mode: restart
max_exceeded: silent
triggers:
- trigger: state
event_type: state_changed
entity_id: !input hue_dimmer_v2_device
condition:
- condition: template
value_template: '{{ trigger.event.data.new_state.state not in ("", "None", "unknown") }}'
action:
- variables:
helper_last_controller_event: !input helper_last_controller_event
command: "{{ trigger.event.data.new_state.state }}"
prev_command: "{{ states(helper_last_controller_event) }}"
# - service: logbook.log
# data:
# name: "command: "
# message: >
# {{ command }} - {{ prev_command }}
- service: input_text.set_value
data:
entity_id: !input helper_last_controller_event
value: "{{ command }}"
- choose:
- conditions:
- '{{ command == "on_press" }}'
sequence: !input on_press
- conditions:
- '{{ command == "on_press_release" }}'
sequence: !input on_press_release
- conditions:
- '{{ command == "on_hold" }}'
sequence: !input on_hold
- conditions:
- '{{ command == "on_hold_release" }}'
sequence: !input on_hold_release
- conditions:
- '{{ command == "up_press" }}'
sequence: !input up_press
- conditions:
- '{{ command == "up_press_release" }}'
sequence: !input up_press_release
- conditions:
- '{{ command == "up_hold" }}'
sequence: !input up_hold
- conditions:
- '{{ command == "up_hold_release" }}'
sequence: !input up_hold_release
- conditions:
- '{{ command == "down_press" }}'
sequence: !input down_press
- conditions:
- '{{ command == "down_press_release" }}'
sequence: !input down_press_release
- conditions:
- '{{ command == "down_hold" }}'
sequence: !input down_hold
- conditions:
- '{{ command == "down_hold_release" }}'
sequence: !input down_hold_release
- conditions:
- '{{ command == "off_press" }}'
sequence: !input off_press
- conditions:
- '{{ command == "off_press_release" }}'
sequence: !input off_press_release
- conditions:
- '{{ command == "off_hold" }}'
sequence: !input off_hold
- conditions:
- '{{ command == "off_hold_release" }}'
sequence: !input off_hold_release
- choose:
- conditions:
- '{{ command == "on_hold" and prev_command == "on_press" }}'
sequence: !input on_hold_once
- conditions:
- '{{ command == "up_hold" and prev_command == "up_press" }}'
sequence: !input up_hold_once
- conditions:
- '{{ command == "down_hold" and prev_command == "down_press" }}'
sequence: !input down_hold_once
- conditions:
- '{{ command == "off_hold" and prev_command == "off_press" }}'
sequence: !input off_hold_once