Sum per day/week of a total increasing sensor state (! state !) #528
Unanswered
r-jean-pierre
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Good evening!

I bumped into a wall when I wanted to use statistic on a total increasing sensor (which is not a measurement sensor...)
From what I understood with LongTermStats and how the plotly-graph behaves, it seems obvious that I can already forget min / max / mean, but I could hope playing with state and sum aggregation functions
My data (I checked) is hourly based and two of my sensor can output energy per hour like this:
If I use
Everything is fine, I can display and see that my raw data is correct at any time:

Each bar corresponds to what I could verify over my 2 years of history.
For example in the above screenshots, at 23:00, we must have 3.075kWh for sensor.enedis_history_hc_v2 and bingo: HA/plotly displays exactly that.
Also if I ask
even if it is not what i really want, plotly would have displayed 9529,302 for the last bar which is correct.
So what I would like to have (if possible) is the total of energy per day for a sensor.
Which, in my example of history_hc is the sum of the blue cells: 5.764+1.867+3.36+3.88+4.716+5.707+2.269+3.075=30.639 kWh
So it's not the cumulative sum since the existence of the sensor, but the sum of state value over a day
But it seems that no obvious combination of


statistic
andperiod
gives this value.Indeed,
statistic=state period=day
seems to output the last know state of the sensor for each daystatistic=sum period=day
seems also to output the last known cumulative sum of individual states for that dayIs is something related to long statistic behaviour of HA, or maybe the sensor is not well encoded (custom integration from hacs) or like always: me not using correctly the card :-D
Beta Was this translation helpful? Give feedback.
All reactions