-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathth0.yaml
185 lines (146 loc) · 3.82 KB
/
th0.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
#------------------------------
#-- th0.yaml
#-- Petit code mini manilste pour mesurer la température et l'humidité
#-- Lit la tmpérature et l'humidité du capteur HTU21D
#-- location: chambre à Chloé bureau zf
#-- zf210720.1021, zf230219.2321, zf230926.1815
#--
# sources:
# https://esphome.io/components/sensor/htu21d.html
# Google Sheet pour la calibation: https://docs.google.com/spreadsheets/d/1iXrqRoCMJt91MejVzX4IAtF0g-0zK2hgI-jhiC7n6G8
# Schéma LDR: https://docs.google.com/document/d/1GOp2zN0aFk80cv2Hz6DmlEwY84OPwVK38da-KSO77zw/edit#heading=h.cqejpm6wn83l
esphome:
name: th0
platform: ESP8266
board: nodemcuv2
# Configuration WIFI
wifi:
ssid: !secret wifi_ssid_apzuzu7
password: !secret wifi_pass_apzuzu7
# networks:
# - ssid: !secret wifi_ssid_apzuzu7
# - password: !secret wifi_pass_apzuzu7
# - ssid: !secret wifi_ssid_apzuzu6
# - password: !secret wifi_pass_apzuzu6
# - 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_3g_s7
# - password: !secret wifi_pass_3g_s7
# - ssid: !secret wifi_ssid_apzuzu6_EXT
# - password: !secret wifi_pass_apzuzu6_EXT
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: th0 Fallback"
password: !secret ap_wifi_password
captive_portal:
# Enable logging
logger:
level: VERBOSE
# Enable Home Assistant API
api:
# password: !secret api_password
encryption:
key: !secret api_encryption_key
ota:
password: !secret ota_password
# Définition des Switch's
switch:
- platform: gpio
name: "th0 LED"
inverted: True
id: led
pin: D4
- platform: restart
name: "th0 Restart"
# Définition du bouton physique
binary_sensor:
- platform: gpio
pin:
number: D3
mode: INPUT_PULLUP
inverted: True
name: "th0 button"
on_press:
- switch.toggle: led
# WEB Server
web_server:
port: 80
# I2C conf
i2c:
sda: D5
scl: D6
# Sensors
sensor:
- platform: wifi_signal
name: "th0 Signal Wi-Fi"
update_interval: 60s
- platform: uptime
name: "th0 uptime"
update_interval: 60s
- platform: htu21d
temperature:
name: "th0 Température"
humidity:
name: "th0 Humidité"
update_interval: 15s
# valeur brute en volts de la photo résistance
- platform: adc
pin: A0
name: "th0 luminosite en volts"
id: th0_luminosite_en_volts
update_interval: 2s
unit_of_measurement: "V"
# valeur calibrée en 8 bits de la photo résistance
- platform: template
name: "th0 luminosite"
update_interval: 2s
unit_of_measurement: "/255"
lambda: return id(th0_luminosite_en_volts).state ;
# lambda: return id(th0_consigne_brightness).state ;
filters:
# linéarise la photo résistance
- calibrate_polynomial:
degree: 2
datapoints:
- 0.0-> 0.0
- 0.4 -> 64
- 0.8 -> 255
# arondi le résultat
- lambda: return floor(x);
# filtre la valeur minimale
- lambda: |-
if (x >= 2)
return x;
else
return 2;
# filtre la valeur maximale
- lambda: |-
if (x <= 255)
return x;
else
return 255;
# Sensors text
text_sensor:
- platform: version
name: "th0 Version 2330"
- platform: wifi_info
ip_address:
name: th0 IP Address
id: wifi_ip
ssid:
name: th0 Connected SSID
id: wifi_ssid
# Définition des inputs numbers
number:
- platform: template
name: "th0 consigne brightness"
restore_value: true
optimistic: true
min_value: 0.0
max_value: 0.8
step: 0.01
initial_value: 0.4
unit_of_measurement: "V"
id: th0_consigne_brightness