Hello everyone, for a long time I have been using various counters with esp32. that monitor the energy and various parameters in my victors. In the past the total energy meter has always worked, but now it randomly resets itself and I don’t understand why.
- platform: integration
name: "Solar Energy Produced"
sensor: pv_power
unit_of_measurement: "Wh"
time_unit: h
accuracy_decimals: 2
state_class: total_increasing
device_class: energy
INFO ESPHome 2025.3.3
INFO Reading configuration /config/esphome/victron20.yaml...
Failed config
sensor.integration: [source /config/esphome/victron20.yaml:87]
platform: integration
name: Solar Energy Produced
IDs must only consist of upper/lowercase characters, the underscorecharacter and numbers. The character '.' cannot be used.
sensor: sensor.pv_power
unit_of_measurement: Wh
time_unit: h
accuracy_decimals: 2
state_class: total_increasing
device_class: energy
I’m probably wrong, but I seem to have understood that I only had to varysensor: sensor.pv_power
Ignore everything I said and go back to your original config. I missed that this was the ESPHome component and assumed it was the home assistant integral component as you placed your post in the forum configuration category and I did not read close enough.
It looks like this sensor doesn’t automatically save to flash.
restore (Optional, boolean): Whether to store the intermediate result on the device so that the value can be restored upon power cycle or reboot. Warning: this option can wear out your flash. Defaults to false.
I will guess that your device is “randomly” resetting and that is causing the value to reset. Logs will tell you if there is a correlation with reset of the sensor and device restart.
Thanks Neel, then I can tell you that the sensor that displays the history of the accumulated energy sometimes behaves as you say. During the 24 hours the meters restart and unfortunately sometimes this too. I have two victors and the behavior is the same. I find the yaml file on git and in the coming months I could define it more stable. Furthermore , I wonder , given that in the victron the basic meter relating to the energy produced in life is always correct , was there a directive that goes to the reading of that value ? Ex. if it is reset it would be enough for HA with esp32 to read the total value of energy produced by the victron since it was first put into production.
Try looking at the attachment to see an example of what happened!
Yes, I have not changed this parameter, however it is what I have been looking for a long time, that is, a parameter that does not allow zeroing. In the specific case of accumulated energy, bringing it to zero.
3 I notice that the meter is sometimes reset together with the meter of the daily energy produced, but this does not always happen. Sometimes the total energy remains unchanged and is therefore added up the next day.
To make you understand today, for example, he did not reset the total counter but the daily one.
ok Neel , thank you . At the moment on the fly I installed uptime sensor on another esp32 device for testing and it appears as in the image. So as soon as I change the esp32 of the victron, so if you reset the total counter as it sometimes does, what value should I read on uptime? Thank you very much at the moment.
The uptime sensor shows how long it has been since the device restarted.
I suspect that the issue you are seeing with the total counter resetting is because the device is restarting (unexpectedly) and you do not have the integration sensor configured to save its value. So, when the device restarts your counter resets. The uptime sensor will either show what I said is likely or that it is not correct. Without the data, it is just a guess/hunch.
Thanks Neel, but if as you say why the meter of the energy produced “today” does not reset but only the total accumulated one?
To make you understand how you can see from today’s graph at about 11 AM this happened, but the meter of the energy produced today continues to work, while the accumulated total has returned to zero.
It is a theory. It needs data to prove it one way or the other. You have data that suggests the theory is incorrect. You might be correct about that, in which case it will still be a mystery why the total sensor is resetting and someone will need to come up with a new theory.
Or, the uptime sensor might show (as the theory suggests) that the reset is causing the total sensor to reset. Then, a reasonable question might be why doesn’t the daily sensor reset. But, as long as it doesn’t, you might be happy enough never knowing.
I think one of the two esp32 has restarted. I have a doubt, the two esp32 are fixed next to each other, so is it possible that being too close and having the wifi active they can be disturbed causing a reset?