-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstation-meteo.yaml
234 lines (221 loc) · 6.09 KB
/
station-meteo.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
esphome:
name: station-meteo
includes:
- multiplexed_sht.h
- davis_wind.h
libraries:
- "Wire"
- "closedcube/ClosedCube SHT31D"
- "robtillaart/PCF8574"
esp32:
board: az-delivery-devkit-v4
framework:
type: arduino
# Enable logging
logger:
level: WARN
# Enable Home Assistant API
api:
password: !secret home_assistant_password
ota:
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 10.0.3.2
gateway: 10.0.0.1
subnet: 255.255.0.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Meteo Fallback Hotspot"
password: !secret ap_password
time:
- platform: homeassistant
id: homeassistant_time
timezone: Europe/Paris
# on_time:
# - seconds: 57
# minutes: 59
# hours: 23
# then:
# - pulse_meter.set_total_pulses:
# id: gazpar
# value: 0
captive_portal:
i2c:
- id: i2c0
sda: GPIO21
scl: GPIO22
scan: True
###############################################################################
# SENSORS
text_sensor:
############################ BASICS
- platform: template
name: Uptime
id: uptime_human
icon: mdi:clock-start
entity_category: diagnostic
# Vent
# TODO: how to have text_sensor and sensor without duplicating the platform?
- platform: custom
lambda: |-
auto davis_wind = new DavisWindSensor();
App.register_component(davis_wind);
return {
davis_wind->heading_sensor
};
text_sensors:
- name: "Wind direction"
icon: mdi:compass-outline
binary_sensor:
############################ BASICS
- platform: status
name: "Statut"
button:
############################ BASICS
- platform: restart
name: "Reboot"
sensor:
############################ BASICS
- platform: wifi_signal
name: "WiFi Signal"
update_interval: 60s
unit_of_measurement: dB
accuracy_decimals: 0
force_update: false
icon: mdi:wifi
- platform: uptime
id: uptime_seconds
name: "Uptime"
update_interval: 60s
unit_of_measurement: s
accuracy_decimals: 0
force_update: false
icon: mdi:timer
on_raw_value:
then:
- text_sensor.template.publish:
id: uptime_human
state: !lambda |-
int seconds = round(id(uptime_seconds).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return (
(days ? to_string(days) + "d " : "") +
(hours ? to_string(hours) + "h " : "") +
(minutes ? to_string(minutes) + "m " : "") +
(to_string(seconds) + "s")
).c_str();
############################ METEO
# Température
- platform: custom
lambda: |-
auto multiplexed_sht = new MultiplexedShtSensor();
App.register_component(multiplexed_sht);
return {
multiplexed_sht->temperature_sensor,
multiplexed_sht->humidity_sensor,
multiplexed_sht->raw_temperature_sensors[0],
multiplexed_sht->raw_humidity_sensors[0],
multiplexed_sht->raw_temperature_sensors[1],
multiplexed_sht->raw_humidity_sensors[1],
multiplexed_sht->raw_temperature_sensors[2],
multiplexed_sht->raw_humidity_sensors[2]
};
sensors:
- name: "Temperature"
unit_of_measurement: "°C"
device_class: "temperature"
state_class: "measurement"
accuracy_decimals: 1
- name: "Humidity"
unit_of_measurement: "%"
device_class: "humidity"
state_class: "measurement"
accuracy_decimals: 1
- name: "Temperature 1"
unit_of_measurement: "°C"
device_class: "temperature"
state_class: "measurement"
accuracy_decimals: 1
entity_category: diagnostic
- name: "Humidity 1"
unit_of_measurement: "%"
device_class: "humidity"
state_class: "measurement"
accuracy_decimals: 1
entity_category: diagnostic
- name: "Temperature 2"
unit_of_measurement: "°C"
device_class: "temperature"
state_class: "measurement"
accuracy_decimals: 1
entity_category: diagnostic
- name: "Humidity 2"
unit_of_measurement: "%"
device_class: "humidity"
state_class: "measurement"
accuracy_decimals: 1
entity_category: diagnostic
- name: "Temperature 3"
unit_of_measurement: "°C"
device_class: "temperature"
state_class: "measurement"
accuracy_decimals: 1
entity_category: diagnostic
- name: "Humidity 3"
unit_of_measurement: "%"
device_class: "humidity"
state_class: "measurement"
accuracy_decimals: 1
entity_category: diagnostic
# Pluviomètre
- platform: pulse_meter
pin:
number: GPIO19
inverted: true
mode:
input: true
pullup: true
internal_filter_mode: PULSE
id: rain_gauge
unit_of_measurement: 'mm/h'
name: "Rainfall intensity"
icon: 'mdi:weather-rainy'
state_class: measurement
filters:
- multiply: 0.254
- multiply: 60
timeout: 60min
accuracy_decimals: 1
total:
name: "Rainfall total"
icon: 'mdi:weather-rainy'
unit_of_measurement: "mm"
state_class: total_increasing
accuracy_decimals: 1
filters:
- multiply: 0.254
# Vent
- platform: custom
lambda: |-
auto davis_wind = new DavisWindSensor();
App.register_component(davis_wind);
return {
davis_wind->vane_value_sensor,
davis_wind->direction_in_degrees
};
sensors:
- name: "Wind vane value"
icon: mdi:tape-measure
entity_category: diagnostic
- name: "Wind vane angle"
unit_of_measurement: '°'
icon: mdi:angle-acute
entity_category: diagnostic