Use _attr_supported_features in osram light (#82255)
parent
2453f95b24
commit
8a084cf94d
|
@ -187,7 +187,6 @@ class Luminary(LightEntity):
|
|||
self._changed = changed
|
||||
|
||||
self._unique_id = None
|
||||
self._supported_features = []
|
||||
self._effect_list = []
|
||||
self._is_on = False
|
||||
self._available = True
|
||||
|
@ -205,9 +204,9 @@ class Luminary(LightEntity):
|
|||
"""Get a unique ID (not implemented)."""
|
||||
raise NotImplementedError
|
||||
|
||||
def _get_supported_color_modes(self):
|
||||
def _get_supported_color_modes(self) -> set[ColorMode]:
|
||||
"""Get supported color modes."""
|
||||
color_modes = set()
|
||||
color_modes: set[ColorMode] = set()
|
||||
if "temp" in self._luminary.supported_features():
|
||||
color_modes.add(ColorMode.COLOR_TEMP)
|
||||
|
||||
|
@ -222,7 +221,7 @@ class Luminary(LightEntity):
|
|||
|
||||
return color_modes
|
||||
|
||||
def _get_supported_features(self):
|
||||
def _get_supported_features(self) -> LightEntityFeature | int:
|
||||
"""Get list of supported features."""
|
||||
features = 0
|
||||
if "lum" in self._luminary.supported_features():
|
||||
|
@ -271,11 +270,6 @@ class Luminary(LightEntity):
|
|||
"""Return True if the device is on."""
|
||||
return self._is_on
|
||||
|
||||
@property
|
||||
def supported_features(self):
|
||||
"""List of supported features."""
|
||||
return self._supported_features
|
||||
|
||||
@property
|
||||
def effect_list(self):
|
||||
"""List of supported effects."""
|
||||
|
@ -360,11 +354,11 @@ class Luminary(LightEntity):
|
|||
self._luminary = luminary
|
||||
self.update_static_attributes()
|
||||
|
||||
def update_static_attributes(self):
|
||||
def update_static_attributes(self) -> None:
|
||||
"""Update static attributes of the luminary."""
|
||||
self._unique_id = self._get_unique_id()
|
||||
self._attr_supported_color_modes = self._get_supported_color_modes()
|
||||
self._supported_features = self._get_supported_features()
|
||||
self._attr_supported_features = self._get_supported_features()
|
||||
self._effect_list = self._get_effect_list()
|
||||
if ColorMode.COLOR_TEMP in self._attr_supported_color_modes:
|
||||
self._min_mireds = color_util.color_temperature_kelvin_to_mired(
|
||||
|
@ -441,11 +435,11 @@ class OsramLightifyGroup(Luminary):
|
|||
# users.
|
||||
return f"{self._luminary.lights()}"
|
||||
|
||||
def _get_supported_features(self):
|
||||
def _get_supported_features(self) -> LightEntityFeature | int:
|
||||
"""Get list of supported features."""
|
||||
features = super()._get_supported_features()
|
||||
if self._luminary.scenes():
|
||||
features = features | LightEntityFeature.EFFECT
|
||||
features |= LightEntityFeature.EFFECT
|
||||
|
||||
return features
|
||||
|
||||
|
|
Loading…
Reference in New Issue