Accurate Graph Rendering for Spikes
This release introduces a significant improvement to the graph rendering logic, ensuring more accurate and intuitive visualizations, especially for sensors that have brief but significant spikes in their data (like an illuminance sensor).
New Features & Major Improvements
Time-Weighted Average for Graphs: [#9]
The downsampling logic has been completely overhauled. Instead of using a simple median or average for each time bucket, the card now calculates a time-weighted average. This means that values that persist for a longer duration have a greater impact on the graph than brief, momentary spikes. This prevents a short spike from making the graph appear high for an entire time bucket (e.g., an hour), resulting in a much more realistic representation of your sensor's history.
| Home Assistant History | Background Graph Entities |
|---|---|
![]() |
![]() |
Thank you to @angrycatmeowmeow for pointing me towards this issue!
Bug Fixes & Minor Enhancements
- The underlying logic for handling data buckets has been made more robust to better handle datasets with infrequent updates.
Behind the Scenes
- The test suite has been significantly updated to validate the new time-weighted average logic, ensuring its accuracy and reliability across various scenarios, including sharp spikes and empty data buckets.
Thank you for using the Background Graph Entities card! I hope you enjoy the more accurate and insightful graphs. 📈

