hass.tibber_prices/custom_components/tibber_prices/entity_utils
Julian Pawlowski 4876a2cc29 refactor(entity_utils): extract shared helpers from sensor platform
Created entity_utils/helpers.py with platform-agnostic utility functions:
- get_price_value(): Price unit conversion (major/minor currency)
- translate_level(): Price level translation
- translate_rating_level(): Rating level translation
- find_rolling_hour_center_index(): Rolling hour window calculations

These functions moved from sensor/helpers.py as they are used by both
sensor and binary_sensor platforms. Remaining sensor/helpers.py now
contains only sensor-specific helpers (aggregate_price_data, etc.).

Updated imports:
- sensor/core.py: Import from entity_utils instead of sensor.helpers
- entity_utils/icons.py: Fixed find_rolling_hour_center_index import
- binary_sensor platforms: Can now use shared helpers

Added clear docstrings explaining:
- entity_utils/helpers.py: Platform-agnostic utilities
- sensor/helpers.py: Sensor-specific aggregation functions

Impact: Better code reuse, clearer responsibility boundaries between
platform-specific and shared utilities.
2025-11-18 20:07:17 +00:00
..
__init__.py refactor(entity_utils): extract shared helpers from sensor platform 2025-11-18 20:07:17 +00:00
attributes.py refactor(entity_utils): extract shared helpers from sensor platform 2025-11-18 20:07:17 +00:00
colors.py feat(sensors): add timing sensors for best_price and peak_price periods 2025-11-15 17:12:55 +00:00
helpers.py refactor(entity_utils): extract shared helpers from sensor platform 2025-11-18 20:07:17 +00:00
icons.py refactor(entity_utils): extract shared helpers from sensor platform 2025-11-18 20:07:17 +00:00