From 599d5c4c411d21861270307d72aac24a73990fcd Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Sun, 12 Dec 2021 19:12:49 +0100 Subject: [PATCH] enable grouped light if enabled in previous integration (#61582) --- homeassistant/components/hue/v2/group.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/hue/v2/group.py b/homeassistant/components/hue/v2/group.py index 312fef6629f..010f7ab3382 100644 --- a/homeassistant/components/hue/v2/group.py +++ b/homeassistant/components/hue/v2/group.py @@ -24,7 +24,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from ..bridge import HueBridge -from ..const import DOMAIN +from ..const import CONF_ALLOW_HUE_GROUPS, DOMAIN from .entity import HueBaseEntity ALLOWED_ERRORS = [ @@ -76,8 +76,6 @@ async def async_setup_entry( class GroupedHueLight(HueBaseEntity, LightEntity): """Representation of a Grouped Hue light.""" - # Entities for Hue groups are disabled by default - _attr_entity_registry_enabled_default = False _attr_icon = "mdi:lightbulb-group" def __init__( @@ -92,6 +90,12 @@ class GroupedHueLight(HueBaseEntity, LightEntity): self.api: HueBridgeV2 = bridge.api self._attr_supported_features |= SUPPORT_TRANSITION + # Entities for Hue groups are disabled by default + # unless they were enabled in old version (legacy option) + self._attr_entity_registry_enabled_default = bridge.config_entry.data.get( + CONF_ALLOW_HUE_GROUPS, False + ) + self._update_values() async def async_added_to_hass(self) -> None: