-
Notifications
You must be signed in to change notification settings - Fork 1
/
batrec_c3_1.yaml
274 lines (227 loc) · 5.78 KB
/
batrec_c3_1.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
#------------------------------
#-- batrec_c3_1.yaml
#-- Petit code pour monitorer plusieurs batteries branchées en série
#-- Lit les ports ADC du mini c3 et l'envoie sur un mqtt broker
#-- Afin de pouvoir lire des tensions >3.3V, il y a un diviseur résistif R1/R2 de 270kR/12kR !
#-- Il y a donc un facteur de correction de xx environ avec une plage de mesure de 0V à 56V
#-- location: garage
#-- zf230503.1350
#--
# sources:
# https://esphome.io/components/sensor/adc.html
# https://www.digikey.fr/fr/resources/conversion-calculators/conversion-calculator-voltage-divider
# Calcul de la durée sur une batterie: https://docs.google.com/spreadsheets/d/1I6s_R04LjGxCB0hrcvogGHNeITDwfXjM05hJhuqGkoU/edit#gid=1470557238
esphome:
name: batrec_c3_1
# platformio_options:
# board_build.flash_mode: dio
on_boot:
- light.turn_on:
id: batrec_c3_1_rgb
brightness: 100%
red: 100%
green: 0%
blue: 0%
- delay: 1s
- light.turn_off:
id: batrec_c3_1_rgb
- delay: 1s
- light.turn_on:
id: batrec_c3_1_rgb
brightness: 30%
red: 0%
green: 100%
blue: 0%
- delay: 1s
- light.turn_off:
id: batrec_c3_1_rgb
esp32:
board: esp32-c3-devkitm-1
# framework:
# type: esp-idf
# version: recommended
# Configuration WIFI
wifi:
reboot_timeout: 5min
ssid: !secret wifi_ssid_apzuzu7
password: !secret wifi_pass_apzuzu7
# networks:
# - ssid: !secret wifi_ssid_apzuzu6
# - password: !secret wifi_pass_apzuzu6
# - ssid: !secret wifi_ssid_3g_s7
# - password: !secret wifi_pass_3g_s7
# - ssid: !secret wifi_ssid_3G_zf
# - password: !secret wifi_pass_3G_zf2
# - ssid: !secret wifi_ssid_3G_zf2
# - password: !secret wifi_pass_3G_zf2
# - ssid: !secret wifi_ssid_apzuzu6_EXT
# - password: !secret wifi_pass_apzuzu6_EXT
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "batrec_c3_1 Fallback"
password: !secret ap_wifi_password
captive_portal:
# Enable logging
logger:
# level: DEBUG
level: VERBOSE
# logs:
# logger: INFO
# adc: INFO
# captive_portal: INFO
# deep_sleep: INFO
# htu21d: INFO
# i2c: INFO
# ota: INFO
# restart: INFO
# sensor: INFO
# switch: INFO
# switch.gpio: INFO
# uptime.sensor: INFO
# web_server: INFO
# wifi_signal.sensor: INFO
# mqtt: INFO
# mqtt.component: INFO
# mqtt.client: INFO
# mqtt.switch: INFO
# mqtt.sensor: INFO
# Enable Home Assistant API
api:
password: !secret api_password
ota:
password: !secret ota_password
# WEB Server
web_server:
port: 80
# # MQTT server
# mqtt:
# broker: !secret mqtt_server_dev
# port: !secret mqtt_port_dev
# username: !secret mqtt_user_dev
# password: !secret mqtt_password_dev
# birth_message:
# will_message:
# Définition des lights
light:
# LED RGB sur le mini c3 GPIO7
- platform: neopixelbus
type: GRB
variant: WS2812
pin: GPIO7
num_leds: 1
name: "batrec_c3_1 RGB"
id: batrec_c3_1_rgb
default_transition_length: 0s
# Définition des Switch's
switch:
- platform: template
name: "batrec_c3_1 LED"
# inverted: True
id: led
optimistic: true
on_turn_on:
- light.turn_on:
id: batrec_c3_1_rgb
brightness: 30%
red: 0%
green: 0%
blue: 100%
on_turn_off:
- light.turn_off:
id: batrec_c3_1_rgb
- platform: restart
name: "batrec_c3_1 Restart"
# Définition du bouton physique sur le mini c3 GPIO9
binary_sensor:
- platform: gpio
pin:
number: GPIO9
mode: INPUT_PULLUP
inverted: True
name: "batrec_c3_1 button"
on_press:
- switch.toggle: led
# Définition des Sensors
sensor:
- platform: wifi_signal
name: "batrec_c3_1 Signal Wi-Fi"
update_interval: 5s
- platform: uptime
name: "batrec_c3_1 uptime"
update_interval: 5s
# valeur brute en volts de l'ADC0
- platform: adc
pin: GPIO0
attenuation: 11db
name: "batrec_c3_1 ADC0 brut"
id: batrec_c3_1_adc0_brut
update_interval: 1s
unit_of_measurement: "V"
accuracy_decimals: 3
filters:
- multiply: 23.504
# valeur brute en volts de l'ADC1
- platform: adc
pin: GPIO1
attenuation: 11db
name: "batrec_c3_1 ADC1 brut"
id: batrec_c3_1_adc1_brut
update_interval: 1s
unit_of_measurement: "V"
accuracy_decimals: 3
filters:
- multiply: 23.707
# valeur brute en volts de l'ADC2
- platform: adc
pin: GPIO3
attenuation: 11db
name: "batrec_c3_1 ADC2 brut"
id: batrec_c3_1_adc2_brut
update_interval: 1s
unit_of_measurement: "V"
accuracy_decimals: 3
filters:
- multiply: 23.792
# # valeur brute en volts de l'ADC
# - platform: adc
# pin: A0
# name: "batrec_c3_1 ADC brut"
# id: batrec_c3_1_adc_brut
# update_interval: 15s
# unit_of_measurement: "V"
# accuracy_decimals: 3
# # valeur corrigée en volts de l'ADC
# - platform: template
# name: "batrec_c3_1 ADC Voltage"
# id: batrec_c3_1_adc_voltage
# update_interval: 15s
# unit_of_measurement: "V"
# accuracy_decimals: 2
# lambda: return id(batrec_c3_1_adc_brut).state ;
# filters:
# - multiply: 51.2
# - offset: -0.150
# Définition des Sensors text
text_sensor:
- platform: version
name: "batrec_c3_1 Version 2218"
- platform: wifi_info
ip_address:
name: batrec_c3_1 IP Address
id: wifi_ip
ssid:
name: batrec_c3_1 Connected SSID
id: wifi_ssid
# Définition des inputs numbers
number:
- platform: template
name: "batrec_c3_1 consigne alarme low"
id: batrec_c3_1_consigne_alarme_low
restore_value: true
optimistic: true
mode: box
min_value: 0.0
max_value: 0.8
step: 0.01
initial_value: 0.4
unit_of_measurement: "V"