Bar chart of current value with midnight reset #299
-
|
Hello, I am trying to create a bar chart with some history for a measurement sensor. The value of the measurement is changing throughout the day and is naturally reset to 0.0% at midninght. So far I have tried: The bar chart indeed shows up, but the values are wrong. This seems to be related to the period: day property. Apparently it seems to do some computation on the values and does not just take the most recent sample. How can I achieve what I've described above? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 15 replies
-
|
This depends mostly on the home assistant statistics API. I think the default statistic is mean, try with another one (e.g max). Lmk if you get lost |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.



Pro tip, you can simplify:
filters: - filter: i > 0 && i < xs.length - 1 // remove first and last, since they are partial values - fn: | ({ys,xs,hass}) => ({ xs: [...xs, new Date().setHours(0,0,0)], ys: [...ys, hass.states['sensor.autarkie'].state], })And you don't even need the second trace
(Edit: added missing hass param)