Hi All, I am new to this Home Assistant so I am just finding my feet. On my energy dashboard, I have a negative value on the first day equal to the total energy of the last month. I have no idea how to change this and would appreciate
Data is from a sonoff clamp meter. POW Ring Smart Power Meter | POWCT - SONOFF Official
I would like to have a clean start to each month. Is there away of adding the amount on the 1st of the month to counter it or just a way to force a zero at the beginning of each month.
From the image in your original post, it looks as if you are using a sensor entity (POWCT Energy Month) that resets to zero every month. You need one that increases continually.
The problem is to do with a wrong state_class on your sensor, combined with the fact that it resets. The resetting itself is not per se bad, but it is when it does not match the state class.
Is the sensor you use one you created yourself (e.g. via a template) or from n integration?
Can you show the entity you use in the developer tools?
@Edwin_D is already going in the right direction, but to fix your history got to developer tools, statistics and click on the graph icon of the entity. Then you either can look for Outliers or set the time and date to the 1st of March (you max need to cycle through multiple time settings to find the right one). If you see a negative value simply set it to 0.
You need an input number which records the maximum value from your meter;
an automation to detect when the clamp meter resets; and the logic in the sensor to output the correct increasing value to the energy dashboard.
Here is the input number YAML - in my case in an input_number.yaml file, itself defined in the configuration.yaml.
Input number code.
# Helper to store accumulated resets #
energy_reset_accumulator:
name: Energy Reset Accumulator
min: 0
max: 1000000
step: 0.01
unit_of_measurement: kWh
Here is the meter detection code with my meter defined. If the to_state (where we are going, numerically) is less than the from_state, where we are then do the action of writing into the input number. This code goes in the automations.yaml file.