So after todays release of 2021.08 with the new long term statistics and energy focus I wanted to include my IKEA Sparsnäs reciever. I read up on the info page Sensor Entity | Home Assistant Developer Docs and added what I thought was the required parts to my mqtt:
Seems that after a day (the normal reset period), or maybe even directly after you’ve added it to the Energy dashboard you should remove this customization.
The time when an accumulating sensor such as an electricity usage meter, gas meter, water meter etc. was initialized. If the time of initialization is unknown and the meter will never reset, set to UNIX epoch 0: homeassistant.util.dt.utc_from_timestamp(0). Note that the datetime.datetime returned by the last_reset property will be converted to an ISO 8601-formatted string when the entity’s state attributes are updated. When changing last_reset, the state must be a valid number.
very interesting if this works, since I would have expected an actual value & not a function to get a value. This is also not a template field afaik (typically surrounded by {{ }}
From Hass 2021.09 the solution going forward would be to use a new state class, state_class: total_increasing. Then you do not need any last_reset, last_reset_topic or last_reset_value_template attributes any more