1 """Support for the Elgato Avea lights."""
3 from __future__
import annotations
25 add_entities: AddEntitiesCallback,
26 discovery_info: DiscoveryInfoType |
None =
None,
28 """Set up the Avea platform."""
30 nearby_bulbs = avea.discover_avea_bulbs()
31 for bulb
in nearby_bulbs:
34 except OSError
as err:
35 raise PlatformNotReady
from err
41 """Representation of an Avea."""
43 _attr_color_mode = ColorMode.HS
44 _attr_supported_color_modes = {ColorMode.HS}
47 """Initialize an AveaLight."""
53 """Instruct the light to turn on."""
55 self.
_light_light.set_brightness(4095)
57 if ATTR_BRIGHTNESS
in kwargs:
58 bright = round((kwargs[ATTR_BRIGHTNESS] / 255) * 4095)
59 self.
_light_light.set_brightness(bright)
60 if ATTR_HS_COLOR
in kwargs:
61 rgb = color_util.color_hs_to_RGB(*kwargs[ATTR_HS_COLOR])
62 self.
_light_light.set_rgb(rgb[0], rgb[1], rgb[2])
65 """Instruct the light to turn off."""
66 self.
_light_light.set_brightness(0)
69 """Fetch new state data for this light.
71 This is the only method that should fetch new data for Home Assistant.
73 if (brightness := self.
_light_light.get_brightness())
is not None:
None turn_on(self, **Any kwargs)
None turn_off(self, **Any kwargs)
def __init__(self, light)
None add_entities(AsusWrtRouter router, AddEntitiesCallback async_add_entities, set[str] tracked)
None setup_platform(HomeAssistant hass, ConfigType config, AddEntitiesCallback add_entities, DiscoveryInfoType|None discovery_info=None)