magicbeing Maybe Adam can clarify whether ESPHome is an issue here
Happy to help!
The short answer is it could do it, but we’re not going to configure it that way.
Originally, when we adopted the ESPhome config, we kept many of the default options for restoring states, including the daily counter.
Some of our community, understandably, saw this as excessive and wearing out of the flash.
[Github / LocalBytes/esphome-localbytes-plug#PR10] disabled “restore” on the counter.
ESPHome doesn’t have a specific “Lifetime” counter (like the daily total), but it has a recommended code block for using an integrator. [ESPHome Docs / Total Daily Energy / Lifetime] to achieve this effect.
To quote the reasoning in PR10 that we agreed with:
We would only lose up to one day’s worth of stats which can be argued as being insignificant
- neilmartin83 on PR#10 at Jan 3, 2025
So whilst “Unfortunately, ESP home does not have a cumulative total for energy devices” is technically correct. it should probably read “We have not configured a cumulative total for our ESPHome Plugs”
(We’ve scheduled a review for next week to update that accordingly)
I believe that wording is also a carryover from before the energy dashboard existed in Home Assistant.
The total_daily is configured in Home Assistant to ignore resets, per the SensorStateClass.TOTAL_INCREASING class.
I appreciate that there is an asymmetry to Tasmota here, which is worth pointing out.
Tasmota presents a “Energy Today”, “Energy Yesterday”, and “Energy Total” in its telemetry
The Tasmota devs decided that daily usage should be volatile.
For total usage, they persist a register at midnight, and then add the daily total on-demand (eg, when producing telemetry messages).
There’s a good discussion on [Github / arendst/Tasmota#17825] with their reasoning.
If you’re interested, the relevant source is: [Github / arendst/Tasmota#xdrv_03_energy L294-L303] and [Github / arendst/Tasmota#xdrv_03_energy.ino L412-L436]
Could we do something similar in ESPHome? Yes, it’s not a bad shout.
Will we do something similar? Honestly, it’s unlikely.
We often see ESPHome used as a “periphery to Home Assistant”, and since Home Assistant now has a very comprehensive dashboard, we just don’t see much value in multiple on-device registers.
That’s not to say you shouldn’t! If you (or anyone) wants to add it to your config, go ahead, and feel free to put the YAML here for others!
I know that turned into quite the essay for what started as a clarification, but feels like useful context for future reference 🙂