-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathZHC5010_Dim_Blueprint
113 lines (108 loc) · 3.42 KB
/
ZHC5010_Dim_Blueprint
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
107
108
109
110
111
112
113
blueprint:
name: ZHC5010 Button Light Control
description: Control a light with a selected button on the ZHC5010 using Z-Wave JS.
domain: automation
input:
zhc5010_device:
name: ZHC5010 Device
description: Select the ZHC5010 device to use.
selector:
device:
integration: zwave_js
manufacturer: Logic Group
model: ZHC5010
target_light:
name: Target Light
description: Select the light to control.
selector:
entity:
domain: light
button:
name: ZHC5010 Button
description: Select which button on the ZHC5010 to use.
selector:
select:
options:
- Button 1
- Button 2
- Button 3
- Button 4
hold_brightness:
name: Hold Brightness
description: Brightness level to set when the button is held.
default: 50
selector:
number:
min: 1
max: 100
unit_of_measurement: "%"
mode: slider
transition_time:
name: Transition Time
description: Set the transition speed (in seconds) for light changes.
default: 1.0
selector:
number:
min: 0
max: 10
unit_of_measurement: "s"
mode: slider
step: 0.1
mode: single
max_exceeded: silent
trigger:
- platform: event
event_type: zwave_js_value_notification
event_data:
device_id: !input zhc5010_device
variables:
button_id: '{{ trigger.event.data.property_key_name }}'
button_action: '{{ trigger.event.data.value }}'
selected_button: !input button
hold_brightness: !input hold_brightness
transition_time: !input transition_time
condition:
# Ensure the event matches the selected button.
- condition: template
value_template: >
{{ (selected_button == 'Button 1' and button_id == '001') or
(selected_button == 'Button 2' and button_id == '002') or
(selected_button == 'Button 3' and button_id == '003') or
(selected_button == 'Button 4' and button_id == '004') }}
action:
- choose:
# Single button press toggles light brightness between 100% and 0%
- conditions:
- condition: template
value_template: "{{ button_action == 'KeyPressed' }}"
sequence:
- choose:
- conditions:
- condition: state
entity_id: !input target_light
state: "on"
sequence:
- service: light.turn_off
data:
entity_id: !input target_light
transition: "{{ transition_time }}"
- conditions:
- condition: state
entity_id: !input target_light
state: "off"
sequence:
- service: light.turn_on
data:
entity_id: !input target_light
brightness_pct: 100
transition: "{{ transition_time }}"
# Button hold sets light to a specific brightness
- conditions:
- condition: template
value_template: "{{ button_action == 'KeyHeldDown' }}"
sequence:
- service: light.turn_on
data:
entity_id: !input target_light
brightness_pct: !input hold_brightness
transition: "{{ transition_time }}"