hass.tibber_prices/tests/services
Julian Pawlowski 13b9870f45 fix(get_chartdata): use proper statistics.median for chart metadata
_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.
2026-07-04 18:23:25 +00:00
..
__init__.py feat(services): improve ApexCharts segment visualization and fix header display 2025-12-01 11:14:27 +00:00
test_connect_segments.py refactor(currency)!: rename major/minor to base/subunit currency terminology 2025-12-11 08:26:30 +00:00
test_energy_calculator.py feat(services): add plan_charging service for battery/EV scheduling 2026-04-20 21:43:41 +00:00
test_find_cheapest_schedule_internals.py fix(find_cheapest_schedule): retry valid window start after time gaps 2026-07-04 18:18:42 +00:00
test_find_service_responses.py fix(services): prevent power_profile truncation during relaxation 2026-07-04 18:22:44 +00:00
test_get_chartdata_metadata.py fix(get_chartdata): use proper statistics.median for chart metadata 2026-07-04 18:23:25 +00:00
test_period_data_format.py refactor(currency)!: rename major/minor to base/subunit currency terminology 2025-12-11 08:26:30 +00:00
test_plan_charging.py fix(services): prevent plan_charging overcharge from segment-constraint bridging 2026-07-04 17:43:04 +00:00
test_power_scheduler.py fix(services): prevent plan_charging overcharge from segment-constraint bridging 2026-07-04 17:43:04 +00:00
test_search_range.py feat(services): add power-profile-weighted window selection 2026-05-03 22:16:08 +00:00
test_sequential_scheduling.py feat(services): add power-profile-weighted window selection 2026-05-03 22:16:08 +00:00
test_service_helpers.py fix(services): correct min_distance_from_avg direction for negative prices 2026-07-04 18:23:06 +00:00