hass.tibber_prices/tests
Julian Pawlowski 5fc1f4db33 feat(sensors): add 5-level price trend scale with configurable thresholds
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.
2026-01-20 13:36:01 +00:00
..
services refactor(currency)!: rename major/minor to base/subunit currency terminology 2025-12-11 08:26:30 +00:00
__init__.py test: add pytest framework and midnight-crossing tests 2025-11-21 23:47:01 +00:00
test_avg_none_fallback.py test(sensors): add comprehensive test coverage for mean/median display 2025-12-18 15:14:22 +00:00
test_best_price_e2e.py refactor(currency)!: rename major/minor to base/subunit currency terminology 2025-12-11 08:26:30 +00:00
test_config_validators.py refactor(config): use negative values for Best Price min_distance 2025-11-22 04:44:57 +00:00
test_coordinator_shutdown.py refactor(currency)!: rename major/minor to base/subunit currency terminology 2025-12-11 08:26:30 +00:00
test_interval_pool_memory_leak.py refactor(interval_pool): improve reliability and test coverage 2025-12-23 10:10:35 +00:00
test_interval_pool_optimization.py refactor(scripts): reorganize and standardize development scripts 2025-11-26 13:11:52 +00:00
test_level_filtering.py fix(period_handlers): normalize flex and min_distance to absolute values 2025-11-22 13:01:01 +00:00
test_lifecycle_state.py fix(sensors): ensure connection/tomorrow_data/lifecycle consistency 2025-11-22 04:45:57 +00:00
test_mean_median_display.py test(sensors): add comprehensive test coverage for mean/median display 2025-12-18 15:14:22 +00:00
test_midnight_handler.py feat(coordinator): add atomic midnight turnover coordination 2025-11-22 04:45:41 +00:00
test_midnight_periods.py fix(periods): Periods are now correctly recalculated after tomorrow prices became available. 2025-12-09 16:57:57 +00:00
test_midnight_turnover.py fix(tests): remove unused mock_config_entry and update price_avg to base currency in percentage calculations 2025-12-13 14:07:16 +00:00
test_minmax_none_fallback.py fix(calculations): handle negative electricity prices correctly 2025-11-22 04:45:23 +00:00
test_next_api_poll.py test(timers): comprehensive timer architecture validation 2025-11-22 04:46:30 +00:00
test_peak_price_e2e.py refactor(currency)!: rename major/minor to base/subunit currency terminology 2025-12-11 08:26:30 +00:00
test_percentage_calculations.py feat(sensors): add 5-level price trend scale with configurable thresholds 2026-01-20 13:36:01 +00:00
test_period_calculation.py test(period): document period calculation testing strategy 2025-11-22 04:47:09 +00:00
test_price_calculations.py refactor: migrate from multi-home to single-home-per-coordinator architecture 2025-11-24 16:24:37 +00:00
test_rating_threshold_validation.py fix(rating): improve gap tolerance to find dominant large blocks 2025-12-22 13:28:25 +00:00
test_resource_cleanup.py test: fix async mocking and add noqa comments for private access 2025-11-25 20:44:39 +00:00
test_sensor_consistency.py refactor: migrate from multi-home to single-home-per-coordinator architecture 2025-11-24 16:24:37 +00:00
test_sensor_timer_assignment.py fix(tests): include current_interval_price_base in interval sensors and remove from known exceptions 2026-01-20 12:06:10 +00:00
test_time_service.py test(time): add boundary tolerance and DST handling tests 2025-11-22 04:46:53 +00:00
test_timer_scheduling.py test(timers): comprehensive timer architecture validation 2025-11-22 04:46:30 +00:00
test_tomorrow_data_refresh.py refactor: migrate from multi-home to single-home-per-coordinator architecture 2025-11-24 16:24:37 +00:00
test_user_data_validation.py fix(validation): enhance user data validation to require active subscription and price info. 2026-01-20 12:33:45 +00:00