hass.tibber_prices/config/configuration.yaml
Julian Pawlowski 11d4cbfd09 feat(config_flow): add price level gap tolerance for Tibber API level field
Implement gap tolerance smoothing for Tibber's price level classification
(VERY_CHEAP/CHEAP/NORMAL/EXPENSIVE/VERY_EXPENSIVE), separate from the existing
rating_level gap tolerance (LOW/NORMAL/HIGH).

New feature:
- Add CONF_PRICE_LEVEL_GAP_TOLERANCE config option with separate UI step
- Implement _apply_level_gap_tolerance() using same bidirectional gravitational
  pull algorithm as rating gap tolerance
- Add _build_level_blocks() and _merge_small_level_blocks() helper functions

Config flow changes:
- Add new "price_level" options step with dedicated schema
- Add menu entry "🏷️ Preisniveau" / "🏷️ Price Level"
- Include translations for all 5 languages (de, en, nb, nl, sv)

Bug fixes:
- Use copy.deepcopy() for price intervals before enrichment to prevent
  in-place modification of cached raw API data, which caused gap tolerance
  changes to not take effect when reverting settings
- Clear transformation cache in invalidate_config_cache() to ensure
  re-enrichment with new settings

Logging improvements:
- Reduce options update handler from 4 INFO messages to 1 DEBUG message
- Move level_filtering and period_overlap debug logs to .details logger
  for granular control via configuration.yaml

Technical details:
- level_gap_tolerance is tracked separately in transformation config hash
- Algorithm: Identifies small blocks (≤ tolerance) and merges them into
  the larger neighboring block using gravitational pull calculation
- Default: 1 (smooth single isolated intervals), Range: 0-4

Impact: Users can now stabilize Tibber's price level classification
independently from the internal rating_level calculation. Prevents
automation flickering caused by brief price level changes in Tibber's API.
2025-12-22 20:25:30 +00:00

73 lines
3.1 KiB
YAML

# Development-friendly config that excludes go2rtc which has compatibility issues
# https://www.home-assistant.io/integrations/homeassistant/
homeassistant:
debug: true
# Disable analytics, diagnostics and error reporting for development instance
# https://www.home-assistant.io/integrations/analytics/
analytics:
# Disable usage analytics to prevent skewing production statistics
# https://analytics.home-assistant.io should only reflect real user installations
# https://www.home-assistant.io/integrations/system_health/
system_health:
# https://www.home-assistant.io/integrations/diagnostics/
# Note: Diagnostics integration cannot be disabled, but without analytics
# and with internal_url set, no data is sent externally
# Core integrations needed for development
http:
automation:
script:
scene:
energy:
# https://www.home-assistant.io/integrations/logger/
logger:
default: info
logs:
# Main integration logger - applies to ALL sub-loggers by default
custom_components.tibber_prices: debug
# Reduce verbosity for details loggers (change to 'debug' for deep debugging)
# API client details (raw requests/responses - very verbose!)
custom_components.tibber_prices.api.client.details: info
# Period calculation details (all set to 'info' by default, change to 'debug' as needed):
# Relaxation strategy details (flex levels, per-day results)
custom_components.tibber_prices.coordinator.period_handlers.relaxation.details: info
# Filter statistics and criteria checks
custom_components.tibber_prices.coordinator.period_handlers.period_building.details: info
# Outlier/spike detection details
custom_components.tibber_prices.coordinator.period_handlers.outlier_filtering.details: info
# Period overlap resolution details
custom_components.tibber_prices.coordinator.period_handlers.period_overlap.details: info
# Outlier flex capping
custom_components.tibber_prices.coordinator.period_handlers.core.details: info
# Level filtering details (min_distance scaling)
custom_components.tibber_prices.coordinator.period_handlers.level_filtering.details: info
# Interval pool details (cache operations, GC):
# Cache lookup/miss, gap detection, fetch group additions
custom_components.tibber_prices.interval_pool.manager.details: info
# Garbage collection details (eviction, dead interval cleanup)
custom_components.tibber_prices.interval_pool.garbage_collector.details: info
# Gap detection and API fetching details
custom_components.tibber_prices.interval_pool.fetcher.details: info
# API endpoint routing decisions
custom_components.tibber_prices.interval_pool.routing.details: info
# Cache fetch group operations
custom_components.tibber_prices.interval_pool.cache.details: info
# Index rebuild operations
custom_components.tibber_prices.interval_pool.index.details: info
# Storage save operations
custom_components.tibber_prices.interval_pool.storage.details: info
# API helpers details (response validation):
# Data emptiness checks, structure validation
custom_components.tibber_prices.api.helpers.details: info