mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-29 21:03:40 +00:00
Added dedicated sensor for Home Assistant's Energy Dashboard integration and new sensors to track total period duration for best/peak price periods. New Sensors: - current_interval_price_major: Shows price in major currency (EUR/kWh, NOK/kWh) instead of minor units (ct/kWh, øre/kWh) for Energy Dashboard compatibility - best_price_period_duration: Total length of current/next best price period - peak_price_period_duration: Total length of current/next peak price period Changes: - sensor/definitions.py: Added 3 new sensor definitions with proper device_class, state_class, and suggested_display_precision - sensor/core.py: Extended native_unit_of_measurement property to return major currency unit for Energy Dashboard sensor while keeping minor units for others - sensor/core.py: Added _calc_period_duration() method to calculate period lengths - sensor/core.py: Added handler mappings for new duration sensors - const.py: Imported format_price_unit_major() for currency formatting - translations/*.json: Added entity names for all 5 languages (de, en, nb, nl, sv) - custom_translations/*.json: Added descriptions, long_descriptions, and usage_tips for all new sensors in all 5 languages Technical Details: - Energy Dashboard sensor uses 4 decimal precision (0.2534 EUR/kWh) vs 2 decimals for regular price sensors (25.34 ct/kWh) - Duration sensors return minutes (UnitOfTime.MINUTES) with 0 decimal precision - Duration sensors disabled by default (less commonly needed than end time) - All MONETARY sensors now have explicit state_class=SensorStateClass.TOTAL - All ENUM/TIMESTAMP sensors have explicit state_class=None for clarity Impact: Users can now add electricity prices to Energy Dashboard for automatic cost calculation. Duration sensors help users plan appliance usage by showing how long cheap/expensive periods last. All price statistics now properly tracked by Home Assistant's recorder. |
||
|---|---|---|
| .. | ||
| binary_sensor | ||
| config_flow_handlers | ||
| custom_translations | ||
| entity_utils | ||
| period_utils | ||
| sensor | ||
| translations | ||
| __init__.py | ||
| api.py | ||
| average_utils.py | ||
| config_flow.py | ||
| const.py | ||
| coordinator.py | ||
| data.py | ||
| diagnostics.py | ||
| entity.py | ||
| manifest.json | ||
| price_utils.py | ||
| services.py | ||
| services.yaml | ||