I have a water tank with a pressure sensor, which measures the usage of water (maximum 5000L). It works pretty well, but now I want to determine daily (or monthly usage). My issue is that the tank gets filled automatically when water is consumed, but I want to track the actual usage. In the screenshot you can see how water has been consumed, and the tank is now filling up. The water consumption with the Utility Helper will however calculate negative (to 5000L), and eventually back to zero when the tank is full. It is great to see this graph, but what I want to do, is to be able to add up all the negative numbers, so I can get a daily, weekly or monthly cycle. This has to be a positive number, which I can then use in the Energy monitor. Assistance please? I suspect a sum over a cycle period?
As FYI. The input sensor ranges from 0 to 5000L, and is always positive. It is the consumption and tracking to 5000L from the Utility meter which takes it negative and back to zero. That’s my issue/
Create a utility meeter with two tariffs, Filling and Emptying.
Use an automation to switch between the tariffs when the slope of the graph is rising or falling. This can be accomplished by triggering on the state of a trend sensor (see the last example):
Thanks for the great advice @tom_l. Took me a bit to work it out and make it work. I have added the following to configuration.yaml, and equally the automations as below. Would you mind and have a look, and if you spot any mistakes let me know. As s summary the sensor.water_volume_3 comes via MQTT every 60sec, and then I do a median over 10 minutes for the value. I have looked at sensor.water_volume_2 (same MQTT every 60 seconds, but with no median). The data is gathered faster but it’s too noisy.
In general it seems to work, I’ll revert if there are any more issues. Thanks again.