Use Xiaomi temperature/pressure sensor as water tank level sensor

Here is a link to a very good video about how to choose and setup an ultrasonic sensor as a level gauge. It explains the basics principals.

However I see that Home Assistant has support for Time of Flight sensors that use lasers to measure distance.

These do not cost much and have a four meter range and use the I²C interface for communication. I think that combing one of these with either a ESP32 or a ESP8266 would be a good setup.

I found this article VL53L0X Time-of-Flight sensor and ESP8266 with a working example to measure distance.

In its description it says:

Can be hidden behind many cover window materials

So even though it is not water proof it looks like it should not be too hard to make a box for it. The documentation also says:

uses ST’s latest generation ToF technology which allows absolute distance measurement whatever the target color and reflectance.

So it looks like using it to measure water height should not be an issue.

ESPHome lists the VL53L0X which only has a two meter range but the VL53L1X has a 4 meter range but use a different API. Polou that sells both on break out boards has libraries for both on GitHub (VL53L1X library).

ESPHome currently does not support the VL53L1X, but I have filed a feature request asking to support it. It maybe just a matter of switching out the libraries to support the different APIs.

1 Like