-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaircon_temperature_control.yaml
366 lines (366 loc) · 13.3 KB
/
aircon_temperature_control.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
#에어컨 온도제어(날자, clipman@naver.com)
#version: 2023-07-21 에어컨 온도제어 공개
blueprint:
name: 에어컨 온도제어(날자)
description: 외부 온도/습도 센서로 계산된 불쾌지수를 기준으로 에어컨의 목표온도를 제어합니다.
출입문과 창문의 열림상태를 에어컨 제어에 활용합니다.
domain: automation
input:
input_boolean_aircon:
name: 가상 스위치
description: input_boolean, 에어컨을 켜고 끄는데 사용하는 가상 에어컨입니다.
selector:
entity:
domain: input_boolean
climate_aircon:
name: 에어컨
selector:
entity:
domain: climate
sensor_temperature:
name: 온도센서
selector:
entity:
domain: sensor
#device_class: temperature
sensor_humidity:
name: 습도센서
selector:
entity:
domain: sensor
#device_class: humidity
sensor_door:
name: 도어센서
description: 문이 잠깐 열려 있으면 에어컨의 목표온도를 변경하고, 오래 열려 있으면 에어컨을 끄고 자동화를 종료합니다.
selector:
entity:
domain: binary_sensor
sensor_window:
name: 창문센서
description: 창문을 열면 에어컨을 끄고 자동화를 종료합니다.
selector:
entity:
domain: binary_sensor
input_number_target_discomfort_Index:
name: 목표 불쾌지수
description: input_number (20~30, 0.1), 목표 불쾌지수를 설정하며 외부에서 변경이 가능합니다.
selector:
entity:
domain: input_number
index_offset:
name: 불쾌지수 공차
description: 목표 불쾌지수가 25.0, 공차 0.1이면 24.9~25.1 유지하며, 범위를 벗어나면 에어컨의 목표온도를 변경합니다.
default: 0.1
selector:
number:
min: 0
max: 1
step: 0.1
target_aircon_cool_mode:
name: 에어컨 냉방모드
description: 에어컨 냉방모드로 가동시 동작할 에어컨 모드를 선택합니다.
default: cool
selector:
select:
options:
- "cool"
- "dry"
target_aircon_fan_mode:
name: 에어컨 팬모드
description: 에어컨마다 지원하는 값이 다르므로 에어컨의 fan_modes 속성을 참고하여 입력합니다.
(auto, low, medium, high, turbo, middle, ...)
default: auto
selector:
text:
target_aircon_cool_temperature:
name: 에어컨 동작시 목표온도
description: 에어컨 동작시 에어컨에 설정하는 온도입니다.
에어컨 팬모드가 자동일 경우에도 이 값이 영향을 미치므로 적당한 값을 입력합니다.
default: 22
selector:
number:
min: 18
max: 25
step: 1
unit_of_measurement: "°C"
# target_aircon_fan_temperature:
# name: 에어컨 미동작시 목표온도(OFF)
# description: 에어컨 미동작시 에어컨에 설정하는 온도입니다.
# 에어컨 미동작시 에어컨의 모드를 변경하지 않고 목표온도를 설정한 값으로 변경합니다.
# default: 28
# selector:
# number:
# min: 25
# max: 30
# step: 1
# unit_of_measurement: "°C"
idle_time:
name: 문이 잠깐 열리는 시간
description: 설정한 시간보다 오랫동안 문이 열려있으면 에어컨의 목표온도를 변경합니다.
default:
hours: 0
minutes: 0
seconds: 30
selector:
duration:
off_time:
name: 문이 오래 열리는 시간
description: 설정한 시간보다 오랫동안 문이 열려있으면 에어컨을 끄고 자동화를 종료합니다.
default:
hours: 0
minutes: 5
seconds: 0
selector:
duration:
variables:
climate_aircon: !input climate_aircon
sensor_temperature: !input sensor_temperature
sensor_humidity: !input sensor_humidity
input_number_target_discomfort_Index: !input input_number_target_discomfort_Index
index_offset: !input index_offset
target_aircon_cool_mode: !input target_aircon_cool_mode
target_aircon_fan_mode: !input target_aircon_fan_mode
target_aircon_cool_temperature: !input target_aircon_cool_temperature
# target_aircon_fan_temperature: !input target_aircon_fan_temperature
trigger:
- platform: state
id: 온도습도목표변경
entity_id:
- !input sensor_temperature
- !input sensor_humidity
- !input input_number_target_discomfort_Index
- platform: state
id: 스위치ON
entity_id: !input input_boolean_aircon
from: 'off'
to: 'on'
- platform: state
id: 스위치OFF
entity_id: !input input_boolean_aircon
from: 'on'
to: 'off'
- platform: state
id: 에어컨OFF
entity_id: !input climate_aircon
to: 'off'
- platform: state
id: 문닫힘
entity_id: !input sensor_door
from: 'on'
to: 'off'
- platform: state
id: 문열림
entity_id: !input sensor_door
from: 'off'
to: 'on'
for: !input idle_time
- platform: state
id: 오랫동안문열림
entity_id: !input sensor_door
from: 'off'
to: 'on'
for: !input off_time
- platform: state
id: 창문열림
entity_id: !input sensor_window
from: 'off'
to: 'on'
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: 온도습도목표변경
- condition: state
entity_id: !input input_boolean_aircon
state: 'on'
- condition: template
value_template: '{{ trigger.from_state.state != trigger.to_state.state }}'
- condition: state
entity_id: !input sensor_door
state: 'off'
sequence:
- if:
- condition: not
conditions:
- condition: template
value_template: '{{ is_state(climate_aircon, target_aircon_cool_mode) }}'
then:
- service: climate.set_hvac_mode
data:
hvac_mode: '{{ target_aircon_cool_mode }}'
target:
entity_id: !input climate_aircon
- if:
- condition: not
conditions:
- condition: template
value_template: '{{ is_state_attr(climate_aircon, "fan_mode", target_aircon_fan_mode) }}'
then:
- service: climate.set_fan_mode
data:
fan_mode: '{{ target_aircon_fan_mode }}'
target:
entity_id: !input climate_aircon
- if:
- condition: template
value_template: '{{ (states(sensor_temperature)|float(default=0)-0.55*(1-states(sensor_humidity)|float(default=0)/100)*(states(sensor_temperature)|float(default=0)-14.5))|round(1) > (states(input_number_target_discomfort_Index)|float(default=0) + index_offset|float(default=0)) }}'
- condition: not
conditions:
- condition: template
value_template: '{{ is_state_attr(climate_aircon, "temperature", target_aircon_cool_temperature) }}'
then:
- service: climate.set_temperature
data:
temperature: '{{ target_aircon_cool_temperature }}'
target:
entity_id: !input climate_aircon
else:
- if:
- condition: template
value_template: '{{ (states(sensor_temperature)|float(default=0)-0.55*(1-states(sensor_humidity)|float(default=0)/100)*(states(sensor_temperature)|float(default=0)-14.5))|round(1) < (states(input_number_target_discomfort_Index)|float(default=0) - index_offset|float(default=0)) }}'
- condition: not
conditions:
- condition: template
# value_template: '{{ is_state_attr(climate_aircon, "temperature", target_aircon_fan_temperature) }}'
value_template: '{{ is_state_attr(climate_aircon, "temperature", 26 if state_attr(climate_aircon, "current_temperature") is none else state_attr(climate_aircon, "current_temperature") + 1) }}'
then:
- service: climate.set_temperature
data:
# temperature: '{{ target_aircon_fan_temperature }}'
temperature: '{{ 26 if state_attr(climate_aircon, "current_temperature") is none else state_attr(climate_aircon, "current_temperature") + 1 }}'
target:
entity_id: !input climate_aircon
- conditions:
- condition: trigger
id: 스위치ON
- condition: state
entity_id: !input climate_aircon
state: 'off'
sequence:
- service: climate.turn_on
target:
entity_id: !input climate_aircon
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- service: climate.set_hvac_mode
data:
hvac_mode: '{{ target_aircon_cool_mode }}'
target:
entity_id: !input climate_aircon
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- service: climate.set_temperature
data:
temperature: '{{ target_aircon_cool_temperature }}'
target:
entity_id: !input climate_aircon
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- service: climate.set_fan_mode
data:
fan_mode: '{{ target_aircon_fan_mode }}'
target:
entity_id: !input climate_aircon
- conditions:
- condition: trigger
id: 스위치OFF
- condition: not
conditions:
- condition: state
entity_id: !input climate_aircon
state: 'off'
sequence:
- service: climate.turn_off
target:
entity_id: !input climate_aircon
data: {}
- conditions:
- condition: trigger
id: 에어컨OFF
- condition: state
entity_id: !input input_boolean_aircon
state: 'on'
sequence:
- service: input_boolean.turn_off
target:
entity_id: !input input_boolean_aircon
data: {}
- conditions:
- condition: trigger
id: 문닫힘
- condition: state
entity_id: !input input_boolean_aircon
state: 'on'
- condition: not
conditions:
- condition: template
value_template: '{{ is_state_attr(climate_aircon, "temperature", target_aircon_cool_temperature) }}'
sequence:
- service: climate.set_temperature
data:
temperature: '{{ target_aircon_cool_temperature }}'
target:
entity_id: !input climate_aircon
- conditions:
- condition: trigger
id: 문열림
- condition: state
entity_id: !input input_boolean_aircon
state: 'on'
- condition: not
conditions:
- condition: template
# value_template: '{{ is_state_attr(climate_aircon, "temperature", target_aircon_fan_temperature) }}'
value_template: '{{ is_state_attr(climate_aircon, "temperature", 26 if state_attr(climate_aircon, "current_temperature") is none else state_attr(climate_aircon, "current_temperature") + 1) }}'
sequence:
- service: climate.set_temperature
data:
# temperature: '{{ target_aircon_fan_temperature }}'
temperature: '{{ 26 if state_attr(climate_aircon, "current_temperature") is none else state_attr(climate_aircon, "current_temperature") + 1 }}'
target:
entity_id: !input climate_aircon
- conditions:
- condition: trigger
id: 오랫동안문열림
- condition: not
conditions:
- condition: state
entity_id: !input climate_aircon
state: 'off'
sequence:
- service: climate.turn_off
target:
entity_id: !input climate_aircon
data: {}
- service: input_boolean.turn_off
target:
entity_id: !input input_boolean_aircon
data: {}
- conditions:
- condition: trigger
id: 창문열림
- condition: not
conditions:
- condition: state
entity_id: !input climate_aircon
state: 'off'
sequence:
- service: climate.turn_off
target:
entity_id: !input climate_aircon
data: {}
- service: input_boolean.turn_off
target:
entity_id: !input input_boolean_aircon
data: {}
mode: queued