-
Notifications
You must be signed in to change notification settings - Fork 7
/
ESP32.yaml
132 lines (114 loc) · 2.94 KB
/
ESP32.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
esphome:
name: ESP32
platform: ESP32
board: nodemcu-32s
# déclaration du fichier source du composant custom
includes:
- my_tic_component.h
wifi:
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_pass
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "TIC Fallback Hotspot"
password: !secret wifi_pass
domain: .local
power_save_mode: LIGHT
fast_connect: false
reboot_timeout: 15min
use_address: tic.local
captive_portal:
# Enable web server
web_server:
port: 80
# 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
# Enable Home Assistant API
api:
reboot_timeout: 15min
port: 6053
password: ''
ota:
safe_mode: true
port: 3232
password: ''
# ajout du composant uart pour la communication série avec la sortie TIC du compteur
uart:
tx_pin: GPIO17
rx_pin: GPIO16
baud_rate: 1200
id: uart_bus
parity: EVEN
data_bits: 7
stop_bits: 1
# alias pour accéder l'instance du composant
substitutions:
name: "TIC"
init: 'MyTicComponent::instance(id(uart_bus));'
# déclaration du composant custom
custom_component:
- id: my_tic
lambda: |-
auto my_tic = ${init}
App.register_component(my_tic);
return {my_tic};
# déclaration des sensors numérique
# les sensors doivent être déclarés dans l'ordre de la fonction lambda
sensor:
- platform: wifi_signal
name: "WiFi Signal Sensor"
update_interval: 60s
unit_of_measurement: dB
accuracy_decimals: 0
force_update: false
icon: mdi:wifi
- platform: uptime
name: "Uptime Sensor"
update_interval: 60s
unit_of_measurement: s
accuracy_decimals: 0
force_update: false
icon: mdi:timer
- platform: custom
lambda: |-
auto my_tic = ${init}
return {my_tic->sensor_IINST, my_tic->sensor_ISOUSC, my_tic->sensor_PAPP, my_tic->sensor_BASE};
sensors:
- name: "Intensite"
unit_of_measurement: A
accuracy_decimals: 0
icon: mdi:power-plug
- name: "Intensite souscrite"
unit_of_measurement: A
accuracy_decimals: 0
icon: mdi:power-plug
- name: "Puissance"
unit_of_measurement: W
accuracy_decimals: 0
icon: mdi:power-plug
- name: "Index"
unit_of_measurement: kWh
accuracy_decimals: 0
icon: mdi:home-analytics
# déclaration du sensor texte, c'est juste l'identifiant du compteur
text_sensor:
- platform: custom
lambda: |-
auto my_tic = ${init}
return {my_tic->sensor_ADCO};
text_sensors:
name: "ADCO"
binary_sensor:
- platform: status
name: "NodeMCU Status"
# switch permettant de stopper les mises à jour
switch:
- platform: custom
lambda: |-
auto my_tic = ${init}
return{my_tic};
switches:
name: "Receive"