1 """Support for Aqualink pool lights."""
3 from __future__
import annotations
7 from iaqualink.device
import AqualinkLight
12 DOMAIN
as LIGHT_DOMAIN,
21 from .
import refresh_system
22 from .const
import DOMAIN
as AQUALINK_DOMAIN
23 from .entity
import AqualinkEntity
24 from .utils
import await_or_reraise
31 config_entry: ConfigEntry,
32 async_add_entities: AddEntitiesCallback,
34 """Set up discovered lights."""
42 """Representation of a light."""
44 def __init__(self, dev: AqualinkLight) ->
None:
45 """Initialize AquaLink light."""
48 if dev.supports_effect:
51 color_mode = ColorMode.ONOFF
52 if dev.supports_brightness:
53 color_mode = ColorMode.BRIGHTNESS
59 """Return whether the light is on or off."""
60 return self.
devdev.is_on
66 This handles brightness and light effects for lights that do support
70 if effect_name := kwargs.get(ATTR_EFFECT):
72 elif brightness := kwargs.get(ATTR_BRIGHTNESS):
74 pct =
int(round(brightness * 4.0 / 255)) * 25
81 """Turn off the light."""
86 """Return current brightness of the light.
88 The scale needs converting between 0-100 and 0-255.
90 return self.
devdev.brightness * 255 / 100
94 """Return the current light effect if supported."""
95 return self.
devdev.effect
None async_turn_off(self, **Any kwargs)
_attr_supported_color_modes
None __init__(self, AqualinkLight dev)
None async_turn_on(self, **Any kwargs)
None turn_off(self, **Any kwargs)
None turn_on(self, **Any kwargs)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
None await_or_reraise(Awaitable awaitable)