hass.tibber_prices/custom_components/tibber_prices
Julian Pawlowski 51a99980df feat(sensors)!: add configurable median/mean display for average sensors
Add user-configurable option to choose between median and arithmetic mean
as the displayed value for all 14 average price sensors, with the alternate
value exposed as attribute.

BREAKING CHANGE: Average sensor default changed from arithmetic mean to
median. Users who rely on arithmetic mean behavior may use the price_mean attribue now, or must manually reconfigure
via Settings → Devices & Services → Tibber Prices → Configure → General
Settings → "Average Sensor Display" → Select "Arithmetic Mean" to get this as sensor state.

Affected sensors (14 total):
- Daily averages: average_price_today, average_price_tomorrow
- 24h windows: trailing_price_average, leading_price_average
- Rolling hour: current_hour_average_price, next_hour_average_price
- Future forecasts: next_avg_3h, next_avg_6h, next_avg_9h, next_avg_12h

Implementation:
- All average calculators now return (mean, median) tuples
- User preference controls which value appears in sensor state
- Alternate value automatically added to attributes
- Period statistics (best_price/peak_price) extended with both values

Technical changes:
- New config option: CONF_AVERAGE_SENSOR_DISPLAY (default: "median")
- Calculator functions return tuples: (avg, median)
- Attribute builders: add_alternate_average_attribute() helper function
- Period statistics: price_avg → price_mean + price_median
- Translations: Updated all 5 languages (de, en, nb, nl, sv)
- Documentation: AGENTS.md, period-calculation.md, recorder-optimization.md

Migration path:
Users can switch back to arithmetic mean via:
Settings → Integrations → Tibber Prices → Configure
→ General Settings → "Average Sensor Display" → "Arithmetic Mean"

Impact: Median is more resistant to price spikes, providing more stable
automation triggers. Statistical analysis from coordinator still uses
arithmetic mean (e.g., trailing_avg_24h for rating calculations).

Co-developed-with: GitHub Copilot <copilot@github.com>
2025-12-08 17:53:40 +00:00
..
api feat(coordinator): implement repairs system for proactive user notifications 2025-12-07 20:51:43 +00:00
binary_sensor feat(sensors)!: add configurable median/mean display for average sensors 2025-12-08 17:53:40 +00:00
config_flow_handlers feat(sensors)!: add configurable median/mean display for average sensors 2025-12-08 17:53:40 +00:00
coordinator feat(sensors)!: add configurable median/mean display for average sensors 2025-12-08 17:53:40 +00:00
custom_translations fix(translations): ensure newline at end of translation files for consistency 2025-12-07 15:17:21 +00:00
entity_utils refactor(price_info): price data handling to use unified interval retrieval 2025-11-24 10:49:34 +00:00
interval_pool feat(interval-pool): add intelligent interval caching and memory optimization 2025-11-25 20:44:39 +00:00
sensor feat(sensors)!: add configurable median/mean display for average sensors 2025-12-08 17:53:40 +00:00
services refactor(services): remove gradient_stop, use fixed 50% gradient 2025-12-05 20:51:30 +00:00
translations feat(sensors)!: add configurable median/mean display for average sensors 2025-12-08 17:53:40 +00:00
utils feat(sensors)!: add configurable median/mean display for average sensors 2025-12-08 17:53:40 +00:00
__init__.py feat(sensors): add chart_metadata sensor for lightweight chart configuration 2025-12-05 20:30:54 +00:00
config_flow.py refactor(config_flow): rename TibberPricesFlowHandler to TibberPricesConfigFlowHandler 2025-11-25 20:44:39 +00:00
const.py feat(sensors)!: add configurable median/mean display for average sensors 2025-12-08 17:53:40 +00:00
data.py feat(interval-pool): add intelligent interval caching and memory optimization 2025-11-25 20:44:39 +00:00
diagnostics.py refactor: migrate from multi-home to single-home-per-coordinator architecture 2025-11-24 16:24:37 +00:00
entity.py feat(lifecycle): implement HA entity best practices for state management 2025-12-07 17:24:41 +00:00
icons.json feat(services): add new services and icons for enhanced functionality and user experience 2025-12-02 18:46:15 +00:00
manifest.json chore(release): bump version to 0.21.0 2025-12-07 20:52:11 +00:00
services.yaml feat(apexcharts): add server-side metadata with dynamic yaxis and gradient 2025-12-05 18:14:18 +00:00