-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathesphome_aguanode01.yaml
144 lines (129 loc) · 3.69 KB
/
esphome_aguanode01.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
substitutions:
hostname: 'aguanode01'
esphome:
name: ${hostname}
esp8266:
board: nodemcu
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "<secret>"
ota:
password: "<secret>"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
power_save_mode: none
reboot_timeout: 15min
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${hostname} Fallback"
password: "${hostname}"
#web_server:
# local: true
# port: 80
# auth:
# username: !secret webserver_username
# password: !secret webserver_password
# version: 2
captive_portal:
text_sensor:
############################# SENSORES DEVICE ##################################
#Informações da conexão wifi
- platform: wifi_info
#Endereço IP
ip_address:
id: ${hostname}_IP
name: ${hostname} Endereço IP
icon: mdi:ip-network
#Nome da Rede
ssid:
id: ${hostname}_SSID
name: ${hostname} Rede Wifi
icon: mdi:wifi
#Informação da versão da compilação
- platform: version
id: ${hostname}_versao
name: ${hostname} Versão
icon: mdi:information
switch:
#Comando reinicilizar esp remotamente
- platform: restart
id: ${hostname}_restart
name: ${hostname} Reiniciar
icon: mdi:restart
#Sensor temperatura
dallas:
- pin: GPIO2
update_interval: 10s
sensor:
#Sinal Wifi esp
- platform: wifi_signal
id: ${hostname}_wifi_sinal
name: ${hostname} Intensidade Wifi
icon: mdi:signal
update_interval: 60s
#Sensor de fluxo - FS300A G3/4 - 1-60 L/min
- platform: pulse_counter
pin: GPIO4
unit_of_measurement: 'L/min'
id: ${hostname}_water_usage
name: '${hostname} Consumo Atual de Água'
update_interval: 5s
device_class: water
filters:
- lambda: return (x / 396); # 396 = 6,6 * 60
- platform: integration
name: "${hostname} Consumo Total de Água"
unit_of_measurement: 'L'
sensor: ${hostname}_water_usage
time_unit: min
device_class: water
- platform: integration
name: "${hostname} Consumo Total de Água M³"
unit_of_measurement: 'm³'
sensor: ${hostname}_water_usage
time_unit: min
device_class: water
filters:
- lambda: return (x / 1000);
#Sensor temporatura
- platform: dallas
address: 0xdf3cc7f648975228
name: "${hostname} Temperatura da Água da Caixa 01"
id: ${hostname}_temperatura_agua_caixa01
#sensor distancia - medindo nivel caixa d´agua 01
- platform: ultrasonic
name: "${hostname} Nível da Água da Caixa 01"
id: ${hostname}_nivel_agua_caixa01
trigger_pin: D6
echo_pin: D7
accuracy_decimals: 6
update_interval: 5.0s
timeout: 4.0m
pulse_time: 20us
filters:
- filter_out: nan
- lambda: |-
static float OFFSET = 0.040; // adjust this or set 0.0 !
static float y = x;
float MAX_DIFFERENCE = 0.5; // adjust this!
static float last_value_t = NAN;
static int count_missed_t = 0;
x = x+OFFSET;
ESP_LOGW("sensor", "Received / Ofsset / Last_Value %.3f / %.3f / %.3f", y, x, last_value_t);
if (count_missed_t == 3) last_value_t = x;
if (isnan(last_value_t) || std::abs(x - last_value_t) < MAX_DIFFERENCE) {
if (count_missed_t)
ESP_LOGI("sensor", "New echo value %.3f", x);
count_missed_t = 0;
return last_value_t = x;
}
else {
count_missed_t += 1;
ESP_LOGW("sensor", "Missed echo value %.3f => %.3f, %d", last_value_t, x, count_missed_t);
return last_value_t;
}