mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-29 21:03:40 +00:00
Extends trend sensors from 3-level (rising/stable/falling) to 5-level scale (strongly_rising/rising/stable/falling/strongly_falling) for finer granularity. Changes: - Add PRICE_TREND_MAPPING with integer values (-2, -1, 0, +1, +2) matching PRICE_LEVEL_MAPPING pattern for consistent automation comparisons - Add configurable thresholds for strongly_rising (default: 6%) and strongly_falling (default: -6%) independent from base thresholds - Update calculate_price_trend() to return 3-tuple: (trend_state, diff_pct, trend_value) - Add trend_value attribute to all trend sensors for numeric comparisons - Update sensor entity descriptions with 5-level options - Add validation with cross-checks (strongly_rising > rising, etc.) - Update icons: chevron-double-up/down for strong trends, trending-up/down for normal Files changed: - const.py: PRICE_TREND_* constants, PRICE_TREND_MAPPING, config constants - utils/price.py: Extended calculate_price_trend() signature and return value - sensor/calculators/trend.py: Pass new thresholds, handle 3-tuple return - sensor/definitions.py: 5-level options for all 9 trend sensors - sensor/core.py: 5-level icon mapping - entity_utils/icons.py: 5-level trend icons - config_flow_handlers/: validators, schemas, options_flow for new settings - translations/*.json: Labels and error messages (en, de, nb, sv, nl) - tests/test_percentage_calculations.py: Updated for 3-tuple return Impact: Users get more nuanced trend information for automation decisions. New trend_value attribute enables numeric comparisons (e.g., > 0 for any rise). Existing automations using "rising"/"falling"/"stable" continue to work. |
||
|---|---|---|
| .. | ||
| services | ||
| __init__.py | ||
| test_avg_none_fallback.py | ||
| test_best_price_e2e.py | ||
| test_config_validators.py | ||
| test_coordinator_shutdown.py | ||
| test_interval_pool_memory_leak.py | ||
| test_interval_pool_optimization.py | ||
| test_level_filtering.py | ||
| test_lifecycle_state.py | ||
| test_mean_median_display.py | ||
| test_midnight_handler.py | ||
| test_midnight_periods.py | ||
| test_midnight_turnover.py | ||
| test_minmax_none_fallback.py | ||
| test_next_api_poll.py | ||
| test_peak_price_e2e.py | ||
| test_percentage_calculations.py | ||
| test_period_calculation.py | ||
| test_price_calculations.py | ||
| test_rating_threshold_validation.py | ||
| test_resource_cleanup.py | ||
| test_sensor_consistency.py | ||
| test_sensor_timer_assignment.py | ||
| test_time_service.py | ||
| test_timer_scheduling.py | ||
| test_tomorrow_data_refresh.py | ||
| test_user_data_validation.py | ||