-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrow_room_temperature_control.yaml
More file actions
204 lines (180 loc) · 5.63 KB
/
grow_room_temperature_control.yaml
File metadata and controls
204 lines (180 loc) · 5.63 KB
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
blueprint:
name: Grow Room Heater Control
description: >
Controls a grow room temperature based on lights ON/OFF,
sensor validation, and absolute safety cutoffs.
domain: automation
input:
temperature_sensor:
name: Temperature Sensor
selector:
entity:
domain: sensor
heater_switch:
name: Heater Switch
selector:
entity:
domain: switch
lights_switch:
name: Lights Switch
selector:
entity:
domain: switch
day_temp_low:
name: Day Temperature Low
selector:
entity:
domain: input_number
day_temp_high:
name: Day Temperature High
selector:
entity:
domain: input_number
night_temp_low:
name: Night Temperature Low
selector:
entity:
domain: input_number
night_temp_high:
name: Night Temperature High
selector:
entity:
domain: input_number
absolute_max_temp:
name: Absolute Maximum Temperature
selector:
entity:
domain: input_number
absolute_min_temp:
name: Absolute Minimum Temperature
selector:
entity:
domain: input_number
mode: restart
trigger:
- platform: state
entity_id:
- !input temperature_sensor
- !input lights_switch
- !input day_temp_low
- !input day_temp_high
- !input night_temp_low
- !input night_temp_high
- !input absolute_max_temp
- !input absolute_min_temp
action:
# --- SENSOR INVALID FAILSAFE ---
- choose:
- conditions:
- condition: state
entity_id: !input temperature_sensor
state:
- "unknown"
- "unavailable"
sequence:
- service: switch.turn_off
target:
entity_id: !input heater_switch
- stop: "Temperature sensor invalid"
# --- ABSOLUTE MAX FAILSAFE ---
- choose:
- conditions:
- condition: numeric_state
entity_id: !input temperature_sensor
above: !input absolute_max_temp
sequence:
- service: switch.turn_off
target:
entity_id: !input heater_switch
- stop: "Absolute max temperature reached"
# --- ABSOLUTE MIN FAILSAFE ---
- choose:
- conditions:
- condition: numeric_state
entity_id: !input temperature_sensor
below: !input absolute_min_temp
sequence:
- service: switch.turn_off
target:
entity_id: !input heater_switch
- stop: "Absolute min temperature reached"
# --- CONFIGURATION SANITY CHECK ---
- choose:
# Day min >= Day max
- conditions:
- condition: numeric_state
entity_id: !input day_temp_low
above: !input day_temp_high
sequence:
- service: switch.turn_off
target:
entity_id: !input heater_switch
- stop: "Invalid DAY temperature config (low >= high)"
# Night min >= Night max
- conditions:
- condition: numeric_state
entity_id: !input night_temp_low
above: !input night_temp_high
sequence:
- service: switch.turn_off
target:
entity_id: !input heater_switch
- stop: "Invalid NIGHT temperature config (low >= high)"
# Absolute min >= Absolute max
- conditions:
- condition: numeric_state
entity_id: !input absolute_min_temp
above: !input absolute_max_temp
sequence:
- service: switch.turn_off
target:
entity_id: !input heater_switch
- stop: "Invalid ABSOLUTE temperature config (min >= max)"
# --- NORMAL CONTROL ---
- choose:
# DAY MODE
- conditions:
- condition: state
entity_id: !input lights_switch
state: "on"
sequence:
- choose:
- conditions:
- condition: numeric_state
entity_id: !input temperature_sensor
below: !input day_temp_low
sequence:
- service: switch.turn_on
target:
entity_id: !input heater_switch
- conditions:
- condition: numeric_state
entity_id: !input temperature_sensor
above: !input day_temp_high
sequence:
- service: switch.turn_off
target:
entity_id: !input heater_switch
# NIGHT MODE
- conditions:
- condition: state
entity_id: !input lights_switch
state: "off"
sequence:
- choose:
- conditions:
- condition: numeric_state
entity_id: !input temperature_sensor
below: !input night_temp_low
sequence:
- service: switch.turn_on
target:
entity_id: !input heater_switch
- conditions:
- condition: numeric_state
entity_id: !input temperature_sensor
above: !input night_temp_high
sequence:
- service: switch.turn_off
target:
entity_id: !input heater_switch