-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlutron_pico_5_fan.yaml
187 lines (181 loc) · 5.24 KB
/
lutron_pico_5_fan.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
blueprint:
name: Lutron Pico 5 Button - Fan Entity Control
description: "This blueprint allows for the association of a Lutron Pico 5 Button (model PJ2-3BRL-GXX-X01) remote with one or more fan entities. It is designed to simulate the operation of a standard Lutron Caseta fan controller including the press and hold functionality for the raise/lower buttons. It allows for the assignment of any action to the middle button."
domain: automation
input:
pico:
name: Pico Device
description: "Pico remote to associate with entity."
selector:
device:
filter:
model: PJ2-3BRL-GXX-F01 (Pico3ButtonRaiseLower)
entity:
name: Fan Entity
description: "Fan entity to control."
selector:
entity:
filter:
domain: fan
speeds:
name: Speeds
description: "The number of speed settings the fan entity supports."
selector:
select:
options:
- "4"
- "6"
on_speed:
name: On Speed
description: "The speed percentage at which the fan will be set when the on button is pressed."
selector:
number:
min: 15
max: 100
default: 100
middle_button_action:
name: Middle (Favorite) Button Action - Optional
description: "Action(s) to execute when MIDDLE button is pressed."
selector:
action: {}
default:
source_url: https://gist.github.com/cymone-smart/9814a750a0d0cfb196fa1fa7ae3630bb
variables:
speeds: !input speeds
middle_button_action: !input middle_button_action
trigger:
- platform: device
device_id: !input pico
domain: lutron_caseta
type: press
subtype: "on"
id: on_pressed
- platform: device
device_id: !input pico
domain: lutron_caseta
type: press
subtype: "raise"
id: up_pressed
- platform: device
device_id: !input pico
domain: lutron_caseta
type: release
subtype: "raise"
id: up_released
- platform: device
device_id: !input pico
domain: lutron_caseta
type: press
subtype: "stop"
id: stop_pressed
- platform: device
device_id: !input pico
domain: lutron_caseta
type: press
subtype: "lower"
id: down_pressed
- platform: device
device_id: !input pico
domain: lutron_caseta
type: release
subtype: "lower"
id: down_released
- platform: device
device_id: !input pico
domain: lutron_caseta
type: press
subtype: "off"
id: off_pressed
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: on_pressed
sequence:
- service: fan.turn_on
data:
percentage: !input on_speed
target:
entity_id: !input entity
- conditions:
- condition: trigger
id: up_pressed
sequence:
- repeat:
sequence:
- service: fan.increase_speed
data:
percentage_step: "{{ (100 / speeds | int) | round }}"
target:
entity_id: !input entity
- delay:
milliseconds: 500
until:
- condition: state
entity_id: !input entity
attribute: percentage
state: "100"
- conditions:
- condition: trigger
id: up_released
sequence:
- delay:
milliseconds: 100
- conditions:
- condition: trigger
id: stop_pressed
sequence:
- choose:
- conditions: "{{ middle_button_action != none }}"
sequence: !input middle_button_action
default:
- if:
- condition: state
entity_id: !input entity
attribute: direction
state: reverse
then:
- service: fan.set_direction
data:
direction: forward
target:
entity_id: !input entity
else:
- service: fan.set_direction
data:
direction: reverse
target:
entity_id: !input entity
- conditions:
- condition: trigger
id: down_pressed
sequence:
- repeat:
sequence:
- service: fan.decrease_speed
data:
percentage_step: "{{ (100 / speeds | int) | round }}"
target:
entity_id: !input entity
- delay:
milliseconds: 500
until:
- condition: numeric_state
entity_id: !input entity
attribute: percentage
below: 1
- conditions:
- condition: trigger
id: down_released
sequence:
- delay:
milliseconds: 100
- conditions:
- condition: trigger
id: off_pressed
sequence:
- service: fan.turn_off
target:
entity_id: !input entity
mode: restart