From 4e64cf7598ad09048b8ce202691b2c466b0e2ff2 Mon Sep 17 00:00:00 2001 From: Julian Pawlowski Date: Sat, 15 Nov 2025 21:47:09 +0000 Subject: [PATCH] refactor(sensors): optimize default entity activation for better UX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adjusted entity_registry_enabled_default flags to reduce initial entity count while keeping most useful sensors active by default. Changes: - Disabled rating sensors (current/next interval, hourly, daily) - Level sensors provide better granularity (5 levels vs 3) for automations - Disabled leading 24h window sensors (avg/min/max) - Advanced use case, overlaps with tomorrow statistics - Disabled additional volatility sensors (tomorrow, next_24h, today_tomorrow) - Today's volatility sufficient for typical use cases Rationale: - Price level sensors (5 states: very_cheap → very_expensive) are more commonly used than rating sensors (3 states: low → high) - Leading 24h windows overlap with tomorrow daily statistics which have clearer boundaries - Single volatility indicator (today) covers most automation needs Impact: Reduces default active entities from ~65 to ~50 while maintaining all essential functionality. Advanced users can enable additional sensors as needed. Improves initial setup experience by focusing on most relevant sensors. --- .../tibber_prices/sensor/definitions.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/custom_components/tibber_prices/sensor/definitions.py b/custom_components/tibber_prices/sensor/definitions.py index f998955..cc13e24 100644 --- a/custom_components/tibber_prices/sensor/definitions.py +++ b/custom_components/tibber_prices/sensor/definitions.py @@ -136,6 +136,7 @@ INTERVAL_RATING_SENSORS = ( device_class=SensorDeviceClass.ENUM, state_class=None, # Enum values: no statistics options=["low", "normal", "high"], + entity_registry_enabled_default=False, # Level is more commonly used ), SensorEntityDescription( key="next_interval_price_rating", @@ -145,6 +146,7 @@ INTERVAL_RATING_SENSORS = ( device_class=SensorDeviceClass.ENUM, state_class=None, # Enum values: no statistics options=["low", "normal", "high"], + entity_registry_enabled_default=False, # Level is more commonly used ), SensorEntityDescription( key="previous_interval_price_rating", @@ -222,6 +224,7 @@ ROLLING_HOUR_RATING_SENSORS = ( device_class=SensorDeviceClass.ENUM, state_class=None, # Enum values: no statistics options=["low", "normal", "high"], + entity_registry_enabled_default=False, # Level is more commonly used ), SensorEntityDescription( key="next_hour_price_rating", @@ -232,6 +235,7 @@ ROLLING_HOUR_RATING_SENSORS = ( device_class=SensorDeviceClass.ENUM, state_class=None, # Enum values: no statistics options=["low", "normal", "high"], + entity_registry_enabled_default=False, # Level is more commonly used ), ) @@ -355,6 +359,7 @@ DAILY_RATING_SENSORS = ( device_class=SensorDeviceClass.ENUM, state_class=None, # Enum values: no statistics options=["low", "normal", "high"], + entity_registry_enabled_default=False, # Level is more commonly used ), SensorEntityDescription( key="tomorrow_price_rating", @@ -365,6 +370,7 @@ DAILY_RATING_SENSORS = ( device_class=SensorDeviceClass.ENUM, state_class=None, # Enum values: no statistics options=["low", "normal", "high"], + entity_registry_enabled_default=False, # Level is more commonly used ), ) @@ -391,6 +397,7 @@ WINDOW_24H_SENSORS = ( icon="mdi:chart-line-variant", device_class=SensorDeviceClass.MONETARY, state_class=SensorStateClass.TOTAL, # MONETARY requires TOTAL or None + entity_registry_enabled_default=False, # Advanced use case suggested_display_precision=1, ), SensorEntityDescription( @@ -420,6 +427,7 @@ WINDOW_24H_SENSORS = ( icon="mdi:arrow-collapse-down", device_class=SensorDeviceClass.MONETARY, state_class=SensorStateClass.TOTAL, # MONETARY requires TOTAL or None + entity_registry_enabled_default=False, # Advanced use case suggested_display_precision=1, ), SensorEntityDescription( @@ -429,6 +437,7 @@ WINDOW_24H_SENSORS = ( icon="mdi:arrow-collapse-up", device_class=SensorDeviceClass.MONETARY, state_class=SensorStateClass.TOTAL, # MONETARY requires TOTAL or None + entity_registry_enabled_default=False, # Advanced use case suggested_display_precision=1, ), ) @@ -635,6 +644,7 @@ VOLATILITY_SENSORS = ( device_class=SensorDeviceClass.ENUM, state_class=None, # Enum values: no statistics options=["low", "moderate", "high", "very_high"], + entity_registry_enabled_default=False, # Today's volatility is usually sufficient ), SensorEntityDescription( key="next_24h_volatility", @@ -645,6 +655,7 @@ VOLATILITY_SENSORS = ( device_class=SensorDeviceClass.ENUM, state_class=None, # Enum values: no statistics options=["low", "moderate", "high", "very_high"], + entity_registry_enabled_default=False, # Advanced use case ), SensorEntityDescription( key="today_tomorrow_volatility", @@ -655,6 +666,7 @@ VOLATILITY_SENSORS = ( device_class=SensorDeviceClass.ENUM, state_class=None, # Enum values: no statistics options=["low", "moderate", "high", "very_high"], + entity_registry_enabled_default=False, # Advanced use case ), )