enable grouped light if enabled in previous integration (#61582)

This commit is contained in:
Marcel van der Veldt 2021-12-12 19:12:49 +01:00 committed by GitHub
parent 0194f0a06e
commit 599d5c4c41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: