Energy usage negative values

Hi guys,
do you know how I can handle change of the energy sensor so the usage values are not negative. Every few years the counters are changed due to legalization and this causes the readings to start from 0 or other positive value (cause you dont always get new meter installed).
The sensor is defined as:
- name: gasMeterHeating
device_class: gas
unit_of_measurement: “m³”
state_class: total_increasing
state: >- …

The total_increasing definitions states:
decreasing value is interpreted as the start of a new meter cycle or the replacement of the meter.
however I see that my usage when value decreased is negative.

You can adjust the wrong value in dev tools → statistics. Click on the little slope icon on the right

Yeah, I can but this is not the solution to the problem as the counter works not as per spec

Please show your full sensor configuration properly formatted for the forum. https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

We can’t tell anything from this:

Also a history graph of the source sensor for that template sensor when the change occurred.