-
Notifications
You must be signed in to change notification settings - Fork 0
/
esp_rack.yaml
272 lines (241 loc) · 8.63 KB
/
esp_rack.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
substitutions:
interval_update: "180s"
esphome:
name: esp-8266-test
friendly_name: esp-8266-test
platform: ESP8266
board: esp01_1m
comment: esp8266 esp01s gestion ventilateurs du rack info selon la temperature
# Enable logging
logger:
#baud_rate: 0 # disable logging via UART, help to avoid numerous crash with ESP_LOGD
#level: INFO # INFO for less log, put DEBUG to view all the linky's "étiquettes" received in the logs
esp8266_store_log_strings_in_flash: False # :doc:`recommanded for ESP8266 </components/sensor/custom>`
# Enable Home Assistant API
api:
# encryption:
# key: "RS7LrmRAyQf10wh0xdRfp713EfIZetnIvM7O3/O14Bo="
ota:
password: "681f143c1b37884c3c384c2a4f8717de"
wifi:
networks:
- ssid: !secret wifi_maison_ssid
password: !secret wifi_maison_password
- ssid: !secret wifi_maison_2_ssid
password: !secret wifi_maison_2_password
reboot_timeout : 2min #reboot si pas de wifi actif
power_save_mode: none
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp-Cellier-RackInfo-Fan-Hotspot"
password: !secret wifi_esp_ap_password
captive_portal:
i2c:
sda: 1
scl: 3
scan: true
id: bus_a
web_server:
port: 80
version: 1
time:
- platform: homeassistant
timezone: "Europe/Paris"
id: ha_time
- platform: sntp
on_time:
# toutes les 45 minutes action(s) : template impossible ici pour les minutes ?
- seconds: 0
minutes: /45
then:
- if:
condition:
and:
- switch.is_off: EspCellierRackInfoFanRelay
- switch.is_off: EspCellierRackInfoFanForceFan
- lambda: |-
return id(EspCellierRackInfoFanTemperature).state >= id(EspCellierRackInfoSeuilTemperature).state;
# return id(temp_rackinfo).state >= id(EspCellierRackInfoSeuilTemperature).state;
then:
- switch.turn_on: EspCellierRackInfoFanRelay
# - delay: !lambda "return round(id(EspCellierRackInfoDureeVentilation).state)*1000*60;"
# - delay: !lambda return (to_string(round(id(EspCellierRackInfoDureeVentilation).raw_state)) +"min").c_str();
else:
- if:
condition:
and:
- switch.is_on: EspCellierRackInfoFanRelay
- switch.is_off: EspCellierRackInfoFanForceFan
- lambda: |-
return id(EspCellierRackInfoFanTemperature).state < id(EspCellierRackInfoSeuilTemperature).state;
# return id(temp_rackinfo).state < id(EspCellierRackInfoSeuilTemperature).state;
then:
- switch.turn_off: EspCellierRackInfoFanRelay
else:
- if:
condition:
and:
- switch.is_off: EspCellierRackInfoFanRelay
- switch.is_off: EspCellierRackInfoFanForceFan
- lambda: |-
return id(EspCellierRackInfoFanTemperature).state < id(EspCellierRackInfoSeuilTemperature).state;
# return id(temp_rackinfo).state < id(EspCellierRackInfoSeuilTemperature).state;
then:
- delay: 1s
else:
- if:
condition:
and:
- switch.is_off: EspCellierRackInfoFanRelay
- switch.is_off: EspCellierRackInfoFanForceFan
then:
- switch.turn_on: EspCellierRackInfoFanRelay
binary_sensor:
- platform: status
name: "Esp Cellier RackInfo Fan Status"
text_sensor:
# - platform: template
# name: "Cellier RackInfo Fan Uptime"
# id: uptime_human
# icon: mdi:clock-start
- platform: wifi_info
ip_address:
name: "Esp Cellier RackInfo Fan Local IP"
ssid:
name: "Esp Cellier RackInfo Fan SSID"
button:
- platform: restart
name: "Esp Cellier RackInfo Fan Restart"
- platform: shutdown
name: "Esp Cellier RackInfo Fan Shutdown"
- platform: safe_mode
name: "Esp Cellier RackInfo Fan Safe Mode"
switch:
- platform: gpio
pin:
number: 0
inverted: true
name: "Esp Cellier RackInfo Fan Relay"
id: EspCellierRackInfoFanRelay
icon: "mdi:fan"
restore_mode: "ALWAYS_ON"
- platform: template
name: Esp Cellier RackInfo Fan Force Fan
id: EspCellierRackInfoFanForceFan
icon: "mdi:fan-alert"
restore_state: false
optimistic: true
turn_on_action:
then:
- if:
condition:
switch.is_off: EspCellierRackInfoFanForceFan
then:
- switch.turn_on: EspCellierRackInfoFanRelay
turn_off_action:
then:
- if:
condition:
switch.is_on: EspCellierRackInfoFanForceFan
then:
- switch.turn_off: EspCellierRackInfoFanRelay
number:
- platform: template
name: "Esp Cellier RackInfo Seuil Temperature"
id: EspCellierRackInfoSeuilTemperature
optimistic: true
unit_of_measurement: '°C'
icon: mdi:thermometer-alert
min_value: 15.0
max_value: 40.0
step: 1
initial_value: 30.0
restore_value: true
mode: 'slider'
# - platform: template
# name: "Esp Cellier RackInfo Duree Ventilation"
# id: EspCellierRackInfoDureeVentilation
# optimistic: true
# unit_of_measurement: 'minutes'
# icon: mdi:timer-sand
# min_value: 5
# max_value: 300
# step: 5
# initial_value: 180
# restore_value: true
# mode: 'slider'
sensor:
- platform: wifi_signal
name: "Esp Cellier RackInfo Fan WiFi Signal"
update_interval: 900s
- platform: sht3xd
temperature:
name: "Esp Cellier RackInfo Fan Temperature"
id: "EspCellierRackInfoFanTemperature"
filters:
- offset: 0
on_value_range:
- above: !lambda return id(EspCellierRackInfoSeuilTemperature).state;
then:
- if:
condition:
switch.is_off: EspCellierRackInfoFanForceFan
then:
- switch.turn_on: EspCellierRackInfoFanRelay
humidity:
name: "Esp Cellier RackInfo Fan Humidity"
id: "EspCellierRackInfoFanHumidity"
address: 0x44
i2c_id: bus_a
update_interval: ${interval_update}
# - platform: dht
# model: dht22
# pin: 1 #txd pin
# temperature:
# name: "Esp Cellier RackInfo Fan Temperature"
# id: "EspCellierRackInfoFanTemperature"
# filters:
# - offset: 0
# on_value_range:
# - above: !lambda return id(EspCellierRackInfoSeuilTemperature).state;
# then:
# - if:
# condition:
# switch.is_off: EspCellierRackInfoFanForceFan
# then:
# - switch.turn_on: EspCellierRackInfoFanRelay
# humidity:
# name: "Esp Cellier RackInfo Fan Humidity"
# id: "EspCellierRackInfoFanHumidity"
# update_interval: 10s
# - platform: homeassistant
# id: temp_rackinfo
# entity_id: sensor.temperature_49
# on_value_range:
# - above: !lambda return id(EspCellierRackInfoSeuilTemperature).state;
# then:
# - if:
# condition:
# switch.is_off: EspCellierRackInfoFanForceFan
# then:
# - switch.turn_on: EspCellierRackInfoFanRelay
# - platform: uptime
# name: "Esp Cellier RackInfo Fan Uptime"
# id: uptime_sensor
# update_interval: 900s
# on_raw_value:
# then:
# - text_sensor.template.publish:
# id: uptime_human
# state: !lambda |-
# int seconds = round(id(uptime_sensor).raw_state);
# int days = seconds / (24 * 3600);
# seconds = seconds % (24 * 3600);
# int hours = seconds / 3600;
# seconds = seconds % 3600;
# int minutes = seconds / 60;
# return (
# (days ? to_string(days) + "d " : "") +
# (hours ? to_string(hours) + "h " : "") +
# (minutes ? to_string(minutes) + "m " : "")
# ).c_str();