Water meter using an ESP32 and sonar sensor to be used in Home Assistant
Note that the configuration of your yaml file may differ, especially around keys like esphome:
and esp32:
The hardware used in this project is a standard ESP-32 development board, a waterproof enclosure and an HC-SR04P Ultrasonic Module. This project is mains powered, and the polling time on the sensor is short. If you choose to make this a solar/battery-powered project, you will need to change this.
Drill two holes in the bottom of the enclosure for the two ultrasonic sensors to stick out of and seal around them to ensure moisture can't work its way into the enclosure. Preferably with silicon or hot glue.
For displaying the water tank level in Home Assistant I went with a bar cardhttps://github.com/custom-cards/bar-card through HACS. Note this is no longer maintained, but works great for this application.
The exposed sensors in home assistant are:
- Water level as total Litres remaining
- Water level percentage
- Distance Sensor - The current distance to the top of the water