In search for a better filter
https://blog.narf.ssji.net/2025/05/10/in-search-for-a-better-filter/
Linear vs. Polynomial calibration to get water level from sensor reading are pretty much the same.
Low-pass filtering too slow to react to actual changes
Works well enough for immediate reading and daily consumption aggregate
Too noisy for hourly readings and other event detection
Water delivery took hours to register the full scale
Kalman?
I thought it was for sensor fusion, but it also works for single-sensor filtering.
Good videos: https://www.youtube.com/watch?v=HCd-leV8OkU https://www.youtube.com/watch?v=qCZ2UTgLM_g
Home Assistant has some integration for Kalman filters, but they seem unmaintained https://community.home-assistant.io/t/kalman-filter/58483
ESPHome: https://esphome.io/components/sensor/combination.html
Dug out and translated the sheet that came with the current loop liquid pressure sensor. It looked like an ad, but actually contained useful info on the characteristics of the sensor.
Likely useful to calibrate the Kalman filter
Also has a “debugging” / calibration method, which would allow to get a wider range.
Adding a Kalman-filtered entity in ESPHome
Error on the sensor Got the process stddev from overnight data from Home Assistant (when the water level is expected not to change), and chucked it into LibreOffice’s STDEV function: ~600L
Standard deviation on the process: change per second. For lack of a better estimate, using the baseline of 400L/day use: 400/(24*3600) = 0.00462963
This seem very low as “A low value here will place high importance on the current state and be slow to respond to changes in the measured samples.”
Also trying a larger value for likely changes, e.g., one tap running for a minute at 9L/min: 0.15
[…]