With less than €20, you can monitor your real-time water consumption in HomeAssistant!
You will need an ESP8266 and a flow meter to measure the water.
Connections:
The flow meter has 3 wires, usually red, black, and yellow.
Red and black wires are for power supply (red for + and black for -), which you connect to the ESP8266 with Vin=+ and Gnd=negative pins.
The yellow wire provides pulses and should be connected to GPIO15 (D8) pin on the ESP8266.
And now, here's the code for ESPHOME in HomeAssistant."
esphome:
name: waterflow-appt
platform: ESP8266
board: esp01_1m
wifi:
ssid: "votreboxe"
password: "votre PWD"
fast_connect: on
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
time:
- platform: sntp
id: my_time
sensor:
- platform: pulse_counter
id: water_flow_meter1
pin: GPIO15
name: "water_flow_meter1"
update_interval: 1s
icon: mdi:water
filters:
- lambda: return (x / 9.63);
unit_of_measurement: "l"
- platform: total_daily_energy
name: "daily_water1"
power_id: water_flow_meter1
unit_of_measurement: "l"
accuracy_decimals: 2
id: daily_water1
- platform: wifi_signal
name: "WiFi puissance_water"
update_interval: 10s
switch:
- platform: restart
name: "restart_water_flow"
It may be necessary to adjust the coefficient of -lambda:return (x / 9.63) because it depends on the pulses sent by the flow meter. As for me, I found this coefficient by measuring with a 5L bucket and adjusting the coefficient using a rule of three. Now, all that's left is for you to give it a try!