hass.tibber_prices/custom_components/tibber_prices
Julian Pawlowski 07517660e3 refactor(volatility): migrate to coefficient of variation calculation
Replaced absolute volatility thresholds (ct/øre) with relative coefficient
of variation (CV = std_dev / mean * 100%) for scale-independent volatility
measurement that works across all price levels.

Changes to volatility calculation:
- price_utils.py: Rewrote calculate_volatility_level() to accept price list
  instead of spread value, using statistics.mean() and statistics.stdev()
- sensor.py: Updated volatility sensors to pass price lists (not spread)
- services.py: Modified _get_price_stats() to calculate CV from prices
- period_statistics.py: Extract prices for CV calculation in period summaries
- const.py: Updated default thresholds to 15%/30%/50% (was 5/15/30 ct)
  with comprehensive documentation explaining CV-based approach

Dead code removal:
- period_utils/core.py: Removed filter_periods_by_volatility() function
  (86 lines of code that was never actually called)
- period_utils/__init__.py: Removed dead function export
- period_utils/relaxation.py: Simplified callback signature from
  Callable[[str|None, str|None], bool] to Callable[[str|None], bool]
- coordinator.py: Updated lambda callbacks to match new signature
- const.py: Replaced RELAXATION_VOLATILITY_ANY with RELAXATION_LEVEL_ANY

Bug fix:
- relaxation.py: Added int() conversion for max_relaxation_attempts
  (line 435: attempts = max(1, int(max_relaxation_attempts)))
  Fixes TypeError when config value arrives as float

Configuration UI:
- config_flow.py: Changed volatility threshold unit display from "ct" to "%"

Translations (all 5 languages):
- Updated volatility descriptions to explain coefficient of variation
- Changed threshold labels from "spread ≥ value" to "CV ≥ percentage"
- Languages: de, en, nb, nl, sv

Documentation:
- period-calculation.md: Removed volatility filter section (dead feature)

Impact: Breaking change for users with custom volatility thresholds.
Old absolute values (e.g., 5 ct) will be interpreted as percentages (5%).
However, new defaults (15%/30%/50%) are more conservative and work
universally across all currencies and price levels. No data migration
needed - existing configs continue to work with new interpretation.
2025-11-14 01:12:47 +00:00
..
custom_translations fix(translations): restore corrupted Norwegian and Dutch translations 2025-11-09 15:31:56 +00:00
period_utils refactor(volatility): migrate to coefficient of variation calculation 2025-11-14 01:12:47 +00:00
translations refactor(volatility): migrate to coefficient of variation calculation 2025-11-14 01:12:47 +00:00
__init__.py fix: handle unknown integration version in setup entry 2025-11-09 16:04:04 +00:00
api.py fix: update return type annotation for API request method and ensure exceptions are raised 2025-11-09 16:04:12 +00:00
average_utils.py feat: Add function to calculate average price for the next N hours 2025-11-06 22:35:53 +00:00
binary_sensor.py feat(periods): add adaptive filter relaxation for minimum period guarantee 2025-11-10 03:34:09 +00:00
config_flow.py refactor(volatility): migrate to coefficient of variation calculation 2025-11-14 01:12:47 +00:00
const.py refactor(volatility): migrate to coefficient of variation calculation 2025-11-14 01:12:47 +00:00
coordinator.py refactor(volatility): migrate to coefficient of variation calculation 2025-11-14 01:12:47 +00:00
data.py refactoring 2025-04-23 16:42:31 +00:00
diagnostics.py update dev environment 2025-11-03 15:54:01 +00:00
entity.py fix: Remove unused model_id attribute from TibberPricesEntity 2025-11-07 14:45:33 +00:00
manifest.json chore(release): bump version to 0.6.0 2025-11-14 00:18:32 +00:00
price_utils.py refactor(volatility): migrate to coefficient of variation calculation 2025-11-14 01:12:47 +00:00
sensor.py refactor(volatility): migrate to coefficient of variation calculation 2025-11-14 01:12:47 +00:00
services.py refactor(volatility): migrate to coefficient of variation calculation 2025-11-14 01:12:47 +00:00
services.yaml update 2025-05-25 22:15:25 +00:00