mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-29 21:03:40 +00:00
fix(statistics): handle None median value in price statistics calculation
This commit is contained in:
parent
cfb9515660
commit
ddc092a3a4
1 changed files with 2 additions and 1 deletions
|
|
@ -107,7 +107,8 @@ def calculate_period_price_statistics(period_price_data: list[dict]) -> dict[str
|
|||
}
|
||||
|
||||
price_mean = round(sum(prices_minor) / len(prices_minor), 2)
|
||||
price_median = round(calculate_median(prices_minor), 2)
|
||||
median_value = calculate_median(prices_minor)
|
||||
price_median = round(median_value, 2) if median_value is not None else 0.0
|
||||
price_min = round(min(prices_minor), 2)
|
||||
price_max = round(max(prices_minor), 2)
|
||||
price_spread = round(price_max - price_min, 2)
|
||||
|
|
|
|||
Loading…
Reference in a new issue