I'm using ai on the edge to get my water consumption via mqtt into home assistant.
That setup was working fine - but now I received a new water meter (routine change after 6 years). Ai on the edge is also working on this one, but the meter obviously starts at zero and not at my previous consumption.
This is how I've set up mqtt in the configuration.yaml:
sensor:
- name: "Wasserzaehler"
unique_id: "b7d975f7-6258-453c-b7b3-215f962bc686"
state_topic: "wasserzaehler/main/json"
value_template: "{{ value_json.value }}"
unit_of_measurement: "m³"
icon: "mdi:water"
device_class: water
state_class: total_increasing
To test if everything is working fine I now have configured ai on the edge to report to my test system. I was expecting state_class: total_increasing to handle the new, lower value as a meter reset. However I'm now seeing negative water consumption in the energy dashboard.
How can I avoid that? A solution might be to change the value_template to add the previous readings to the new readings but that feels like an unclean hack.
What's the proper way to deal with this?
Any hints are much appreciated.
Here's a screenshot of my energy dashboard: