mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-07-27 17:26:48 +00:00
_calculate_metadata()'s inline calc_stats() computed the median as a naive sorted(data)[len(data) // 2], which returns the upper-middle value for even-length datasets instead of averaging the two middle values. A full day is always an even interval count (96 quarter-hours or 24 hours), so this silently overstated "median" and "median_position" in nearly every price_stats block of the get_chartdata response. The rest of the codebase already has a correct calculate_median() in utils/average.py; this was an isolated inline duplicate with the bug. Impact: get_chartdata's price_stats.combined/dayN.median and median_position now report the statistically correct median for chart annotations and metadata-driven dashboards. |
||
|---|---|---|
| .. | ||
| charging | ||
| __init__.py | ||
| debug_clear_tomorrow.py | ||
| entity_resolver.py | ||
| find_cheapest_block.py | ||
| find_cheapest_hours.py | ||
| find_cheapest_schedule.py | ||
| find_most_expensive_block.py | ||
| find_most_expensive_hours.py | ||
| formatters.py | ||
| get_apexcharts_yaml.py | ||
| get_chartdata.py | ||
| get_price.py | ||
| helpers.py | ||
| plan_charging.py | ||
| refresh_user_data.py | ||
| relaxation.py | ||