Initialize static shorthand attributes outside of constructor for BAF (#99202)
Initialize static shorthand attributes outside of init
This commit is contained in:
parent
60844954d2
commit
3f0a8b7a56
1 changed files with 7 additions and 9 deletions
|
@ -39,6 +39,8 @@ async def async_setup_entry(
|
||||||
class BAFLight(BAFEntity, LightEntity):
|
class BAFLight(BAFEntity, LightEntity):
|
||||||
"""Representation of a Big Ass Fans light."""
|
"""Representation of a Big Ass Fans light."""
|
||||||
|
|
||||||
|
_attr_name = None
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _async_update_attrs(self) -> None:
|
def _async_update_attrs(self) -> None:
|
||||||
"""Update attrs from device."""
|
"""Update attrs from device."""
|
||||||
|
@ -63,23 +65,19 @@ class BAFLight(BAFEntity, LightEntity):
|
||||||
class BAFFanLight(BAFLight):
|
class BAFFanLight(BAFLight):
|
||||||
"""Representation of a Big Ass Fans light on a fan."""
|
"""Representation of a Big Ass Fans light on a fan."""
|
||||||
|
|
||||||
_attr_name = None
|
_attr_supported_color_modes = {ColorMode.BRIGHTNESS}
|
||||||
|
_attr_color_mode = ColorMode.BRIGHTNESS
|
||||||
def __init__(self, device: Device) -> None:
|
|
||||||
"""Init a fan light."""
|
|
||||||
super().__init__(device)
|
|
||||||
self._attr_supported_color_modes = {ColorMode.BRIGHTNESS}
|
|
||||||
self._attr_color_mode = ColorMode.BRIGHTNESS
|
|
||||||
|
|
||||||
|
|
||||||
class BAFStandaloneLight(BAFLight):
|
class BAFStandaloneLight(BAFLight):
|
||||||
"""Representation of a Big Ass Fans light."""
|
"""Representation of a Big Ass Fans light."""
|
||||||
|
|
||||||
|
_attr_supported_color_modes = {ColorMode.COLOR_TEMP}
|
||||||
|
_attr_color_mode = ColorMode.COLOR_TEMP
|
||||||
|
|
||||||
def __init__(self, device: Device) -> None:
|
def __init__(self, device: Device) -> None:
|
||||||
"""Init a standalone light."""
|
"""Init a standalone light."""
|
||||||
super().__init__(device)
|
super().__init__(device)
|
||||||
self._attr_supported_color_modes = {ColorMode.COLOR_TEMP}
|
|
||||||
self._attr_color_mode = ColorMode.COLOR_TEMP
|
|
||||||
self._attr_min_mireds = color_temperature_kelvin_to_mired(
|
self._attr_min_mireds = color_temperature_kelvin_to_mired(
|
||||||
device.light_warmest_color_temperature
|
device.light_warmest_color_temperature
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue