-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathikea_vindriktning.yaml
271 lines (241 loc) · 7.88 KB
/
ikea_vindriktning.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
substitutions:
friendly_name: "Esp Salon Ikea Vindriktning"
friendly_name_wifiap: "Esp-Salon-Ikea-Vindriktning-Hotspot"
interval_update_court: "2s"
interval_update_normal: "20s"
interval_update_long: "180s"
esphome:
name: esp-salon-ikea-vindriktning
comment: esp8266 esp01s ikea vindriktning 2.5µm + temp + humi + eco2 + tvoc + co
esp8266:
board: esp01_1m
# 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: "zzHMGE342mPJmKen2n2lwx7Dzv3cYR72L9Mm/3U0nQ8="
ota:
password: "8ae1ac436b21b61ee6293f7afc5a5869"
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-Salon-Ikea-Vindriktning"
password: !secret wifi_esp_ap_password
captive_portal:
time:
- platform: homeassistant
timezone: "Europe/Paris"
id: ha_time
#--------------------------------------
# enable control via web server if home assistant is dead
#web_server:
# port: 80
# ota: True
# version: 1 # Defaults to 2 => 1 pour l'esp01s ou les esp8266 en général car moins gourmand
#--------------------------------------
i2c: #i2c sur gpio 0 et 2 (BME280 + CCS811)
sda: 0
scl: 2
scan: True
id: bus_a # il y a un seul bus ici donc pas vraiment necessaire
#i2c ads1115 pour lire le capteur CO adr reliee a gnd
ads1115:
- address: 0x48
#--------------------------------------
uart: #pm1006
rx_pin: 1
baud_rate: 9600
id: ikea
#--------------------------------------
binary_sensor:
- platform: status
name: "${friendly_name} Status"
id : EspSalonIkeaVindriktningStatus
#--------------------------------------
text_sensor:
- platform: template
name: "Uptime"
id: uptime_human
icon: mdi:clock-start
- platform: wifi_info
ip_address:
name: "${friendly_name} Local IP"
id: EspSalonIkeaVindriktningLocalIP
ssid:
name: "${friendly_name} SSID"
id: EspSalonIkeaVindriktningSSID
#--------------------------------------
button:
- platform: restart
name: "${friendly_name} Restart"
id: EspSalonIkeaVindriktningRestart
- platform: shutdown
name: "${friendly_name} Shutdown"
id: EspSalonIkeaVindriktningShutdown
- platform: safe_mode
name: "${friendly_name} Safe Mode"
id: EspSalonIkeaVindriktningSafeMode
#--------------------------------------
sensor:
#PM1006 passive mod (only read from the ikea vindriktning board)
- platform: pm1006
uart_id: ikea
pm_2_5:
name: "${friendly_name} 2.5µm Concentration"
id: EspSalonIkeaVindriktning25ParticuleConcentration
device_class: pm25
unit_of_measurement: 'µg/m³'
state_class: "measurement"
accuracy_decimals: 0
icon: 'mdi:blur'
#BME280
- platform: bme280
temperature:
name: "${friendly_name} Temperature"
id: EspSalonIkeaVindriktningTemp
device_class: temperature
oversampling: 16x
accuracy_decimals: 1
state_class: "measurement"
pressure:
name: "${friendly_name} Pression Atmo"
id: EspSalonIkeaVindriktningAtmo
oversampling: 16x
device_class: pressure
accuracy_decimals: 1
state_class: "measurement"
humidity:
name: "${friendly_name} Humidity"
id: EspSalonIkeaVindriktningHumi
accuracy_decimals: 1
device_class: humidity
oversampling: 16x
state_class: "measurement"
address: 0x76 #or 0x76/0x77
i2c_id: bus_a
update_interval: ${interval_update_normal}
#CCS811 baseline a recuperer dans le log. wak reliee a gnd
- platform: ccs811
eco2:
id: "EspSalonIkeaVindriktningeCO2"
name: "${friendly_name} eCO2"
device_class: carbon_dioxide
unit_of_measurement: 'ppm'
state_class: "measurement"
accuracy_decimals: 0
tvoc:
id: "EspSalonIkeaVindriktningTvoc"
name: "${friendly_name} Tvoc"
#unit_of_measurement: 'ppb'
icon: mdi:air-filter
state_class: "measurement"
accuracy_decimals: 0
address: 0x5A
baseline: 0xFEBA
i2c_id: bus_a
update_interval: ${interval_update_normal}
temperature: EspSalonIkeaVindriktningTemp
humidity: EspSalonIkeaVindriktningHumi
#Sortie analogique MICS5524 reliee sur a0 et en reliée a GND (active le prechauffage)
- platform: ads1115
multiplexer: 'A0_GND'
gain: 6.144
name: "${friendly_name} A0 Voltage"
id: EspSalonIkeaVindriktningA0Voltage
device_class: voltage
unit_of_measurement: V
state_class: "measurement"
update_interval: ${interval_update_normal}
filters:
- sliding_window_moving_average:
window_size: 7
send_every: 1
- lambda: return(x);
#float DFRobot_MICS::getCarbonMonoxide(float data)
#{
# if(data > 0.425)
# return 0.0;
# float co = (0.425 - data) / 0.000405;
# if(co > 1000.0)
# return 1000.0;
# if(co < 1.0)
# return 0.0;
# return co;
#}
# valeur co formule reprise de la librairie dfrobot https://wiki.dfrobot.com/Fermion__MEMS_Gas_Sensor___MiCS-5524_SKU_SEN0440
- platform: template
#platform: ads1115
#multiplexer: 'A0_GND'
#gain: 6.144
name: "${friendly_name} CO"
id: "EspSalonIkeaVindriktningCO"
device_class: CARBON_MONOXIDE
state_class: "measurement"
icon: "mdi:molecule-co"
unit_of_measurement: ppm
update_interval: ${interval_update_normal}
accuracy_decimals: 0
# filters:
# - calibrate_linear:
# - 0 -> 0
# - 5 -> 1000
# - sliding_window_moving_average:
# window_size: 7
# send_every: 1
# #pas de données avant 3 minutes d'uptime. temps de chauffe du capteur
# - lambda: if (id(EspSalonIkeaVindriktningUptime).state>(180+20)) { return(x); } else { return {}; }
# lambda: !lambda |-
# float v0 = id(EspSalonIkeaVindriktningA0Voltage).state;
# float rawco = (0.425 - v0) / 0.000405;
# float ppmco = 0.0;
# if ( v0 > 0.425 or rawco < 1 ) { ppmco = 0.0; }
# else { if ( rawco > 1000 ) { ppmco = 1000.0; }
# else { ppmco = rawco;} }
# if (id(EspSalonIkeaVindriktningUptime).state>200)
# { return (ppmco); }
# else { return {}; }
lambda: !lambda |-
float v0 = id(EspSalonIkeaVindriktningA0Voltage).state;
float ppmco = v0 * (10000*(0.425/32767));
if (id(EspSalonIkeaVindriktningUptime).state>200)
{ return (ppmco); }
else { return {}; }
#--------------------------------------
#wifi
- platform: wifi_signal
name: "${friendly_name} WiFi Signal"
id: EspSalonIkeaVindriktningWiFiSignal
update_interval: ${interval_update_long}
#--------------------------------------
#Uptime decomposé
- platform: uptime
name: "${friendly_name} Uptime"
id: EspSalonIkeaVindriktningUptime
#update_interval: ${interval_update_long}
on_raw_value:
then:
- text_sensor.template.publish:
id: uptime_human
state: !lambda |-
int seconds = round(id(EspSalonIkeaVindriktningUptime).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();