1 """Light/LED support for the Skybell HD Doorbell."""
3 from __future__
import annotations
7 from aioskybell.helpers.const
import BRIGHTNESS, RGB_COLOR
14 LightEntityDescription,
20 from .const
import DOMAIN
21 from .entity
import SkybellEntity
25 hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
27 """Set up Skybell switch."""
30 for coordinator
in hass.data[DOMAIN][entry.entry_id]
35 """A light implementation for Skybell devices."""
37 _attr_color_mode = ColorMode.RGB
38 _attr_supported_color_modes = {ColorMode.RGB}
42 """Turn on the light."""
43 if ATTR_RGB_COLOR
in kwargs:
44 await self.
_device_device.async_set_setting(RGB_COLOR, kwargs[ATTR_RGB_COLOR])
45 if ATTR_BRIGHTNESS
in kwargs:
46 level =
int((kwargs.get(ATTR_BRIGHTNESS, 0) * 100) / 255)
47 await self.
_device_device.async_set_setting(BRIGHTNESS, level)
50 """Turn off the light."""
51 await self.
_device_device.async_set_setting(ATTR_BRIGHTNESS, 0)
55 """Return true if device is on."""
56 return self.
_device_device.led_intensity > 0
60 """Return the brightness of the light."""
61 return int((self.
_device_device.led_intensity * 255) / 100)
65 """Return the rgb color value [int, int, int]."""
66 return self.
_device_device.led_rgb
SkybellDevice _device(self)
tuple[int, int, int]|None rgb_color(self)
None async_turn_on(self, **Any kwargs)
None async_turn_off(self, **Any kwargs)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)