flixlix / energy-flow-card-plus

An upgraded Energy Distribution Card for Home Assistant, with added features like Individual Devices and refined UI enhancements, while maintaining the Energy Dashboard's original design.
155 stars 8 forks source link

Empty Energy Data at Start of Period forces Data to be All Time #115

Open dcd-projectrose opened 7 months ago

dcd-projectrose commented 7 months ago

Code in Energy Statistics has a check to see if there is no data for Start of Period, and if so set a data point of 0 for start of period. This means if there is no data for any energy entity for any start period, e.g. system offline, device offline; the data will sum for all time.

Example after a system outage that spanned midnight. This is from a custom Energy Dashboard with Energy Flow Plus card on right.

4-6th April with Data at Start of Period

Screenshot 2024-04-06 at 11 06 39 AM

5-6th April with no Data at Start of Period

Screenshot 2024-04-06 at 11 06 53 AM

This matches other reports of strange Day data, which is what I saw for 5th April. Note: System has only been on for about a week hence the lowish All Time data

https://github.com/flixlix/energy-flow-card-plus/blob/c528d988a44e91c364c8e82d20e7ddfa05784ef6/src/energy/index.ts#L160-L170

BoGnY commented 5 months ago

same problem for me, but seems only "today" is bugged