hass.tibber_prices/custom_components/tibber_prices/binary_sensor/definitions.py
Julian Pawlowski 7629c0f628 refactor(repairs): simplify currency mode change notification to one-shot
Remove the DATA_STATISTICS_REVIEW_REQUIRED flag and all associated
persistence logic. The flag approach was over-engineered: we cannot
detect whether the Recorder statistics have been fixed, and requiring
the user to re-save display settings as acknowledgement is bad UX.

New design: show the repair notice once when the mode changes.
The user dismisses it when done reviewing. The HA Recorder will
independently show its own unit-change dialog — that is sufficient.

Changes:
- Remove DATA_STATISTICS_REVIEW_REQUIRED constant from const.py
- Remove _check_statistics_review_repair() from __init__.py
- Remove ir import from __init__.py (no longer needed there)
- Remove flag set/clear logic from options_flow.py
- Change is_persistent=False (no restart persistence needed)
- Update all 5 translations: restore simple "Dismiss this notice" ending
2026-04-15 10:00:59 +00:00

68 lines
2.5 KiB
Python

"""Binary sensor entity descriptions for tibber_prices."""
from __future__ import annotations
from homeassistant.components.binary_sensor import BinarySensorDeviceClass, BinarySensorEntityDescription
from homeassistant.const import EntityCategory
# Period lookahead removed - icons show "waiting" state if ANY future periods exist
# No artificial time limit - show all periods until midnight
ENTITY_DESCRIPTIONS = (
BinarySensorEntityDescription(
key="peak_price_period",
translation_key="peak_price_period",
icon="mdi:clock-alert",
),
BinarySensorEntityDescription(
key="best_price_period",
translation_key="best_price_period",
icon="mdi:clock-check",
),
# Price phase binary sensors — ON when current intra-day phase matches the type
BinarySensorEntityDescription(
key="in_rising_price_phase",
translation_key="in_rising_price_phase",
icon="mdi:trending-up",
),
BinarySensorEntityDescription(
key="in_falling_price_phase",
translation_key="in_falling_price_phase",
icon="mdi:trending-down",
),
BinarySensorEntityDescription(
key="in_flat_price_phase",
translation_key="in_flat_price_phase",
icon="mdi:trending-neutral",
),
BinarySensorEntityDescription(
key="connection",
translation_key="connection",
device_class=BinarySensorDeviceClass.CONNECTIVITY,
entity_category=EntityCategory.DIAGNOSTIC,
),
BinarySensorEntityDescription(
key="tomorrow_data_available",
translation_key="tomorrow_data_available",
icon="mdi:calendar-check",
device_class=None, # No specific device_class = shows generic "On/Off"
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=True, # Critical for automations
),
BinarySensorEntityDescription(
key="has_ventilation_system",
translation_key="has_ventilation_system",
icon="mdi:air-filter",
device_class=None, # No specific device_class = shows generic "On/Off"
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
),
BinarySensorEntityDescription(
key="realtime_consumption_enabled",
translation_key="realtime_consumption_enabled",
icon="mdi:speedometer",
device_class=None, # No specific device_class = shows generic "On/Off"
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
),
)