Adjust inheritance in rflink lights (#69541)

* Add color-more to RflinkLight

* Adjust inheritance
This commit is contained in:
epenet 2022-04-07 10:34:24 +02:00 committed by GitHub
parent 54bb86d198
commit 4fe6b0c140
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -174,6 +174,9 @@ async def async_setup_platform(
class RflinkLight(SwitchableRflinkDevice, LightEntity): class RflinkLight(SwitchableRflinkDevice, LightEntity):
"""Representation of a Rflink light.""" """Representation of a Rflink light."""
_attr_color_mode = COLOR_MODE_ONOFF
_attr_supported_color_modes = {COLOR_MODE_ONOFF}
class DimmableRflinkLight(SwitchableRflinkDevice, LightEntity): class DimmableRflinkLight(SwitchableRflinkDevice, LightEntity):
"""Rflink light device that support dimming.""" """Rflink light device that support dimming."""
@ -225,7 +228,7 @@ class DimmableRflinkLight(SwitchableRflinkDevice, LightEntity):
return self._brightness return self._brightness
class HybridRflinkLight(DimmableRflinkLight, LightEntity): class HybridRflinkLight(DimmableRflinkLight):
"""Rflink light device that sends out both dim and on/off commands. """Rflink light device that sends out both dim and on/off commands.
Used for protocols which support lights that are not exclusively on/off Used for protocols which support lights that are not exclusively on/off
@ -249,7 +252,7 @@ class HybridRflinkLight(DimmableRflinkLight, LightEntity):
await self._async_handle_command("turn_on") await self._async_handle_command("turn_on")
class ToggleRflinkLight(SwitchableRflinkDevice, LightEntity): class ToggleRflinkLight(RflinkLight):
"""Rflink light device which sends out only 'on' commands. """Rflink light device which sends out only 'on' commands.
Some switches like for example Livolo light switches use the Some switches like for example Livolo light switches use the
@ -258,9 +261,6 @@ class ToggleRflinkLight(SwitchableRflinkDevice, LightEntity):
and if the light is off and 'on' gets sent, the light will turn on. and if the light is off and 'on' gets sent, the light will turn on.
""" """
_attr_color_mode = COLOR_MODE_ONOFF
_attr_supported_color_modes = {COLOR_MODE_ONOFF}
def _handle_event(self, event): def _handle_event(self, event):
"""Adjust state if Rflink picks up a remote command for this device.""" """Adjust state if Rflink picks up a remote command for this device."""
self.cancel_queued_send_commands() self.cancel_queued_send_commands()