1 """Light platform support for yeelight."""
3 from __future__
import annotations
5 from collections.abc
import Callable, Coroutine
8 from typing
import Any, Concatenate
10 import voluptuous
as vol
12 from yeelight
import Flow, RGBTransition, SleepTransition, flows
13 from yeelight.aio
import AsyncBulb
14 from yeelight.enums
import BulbType, LightType, PowerMode, SceneClass
15 from yeelight.main
import BulbException
44 color_temperature_kelvin_to_mired
as kelvin_to_mired,
45 color_temperature_mired_to_kelvin
as mired_to_kelvin,
48 from .
import YEELIGHT_FLOW_TRANSITION_SCHEMA
57 CONF_NIGHTLIGHT_SWITCH,
65 MODELS_WITH_DELAYED_ON_TRANSITION,
66 POWER_STATE_CHANGE_TIME,
68 from .device
import YeelightDevice
69 from .entity
import YeelightEntity
71 _LOGGER = logging.getLogger(__name__)
73 ATTR_MINUTES =
"minutes"
75 SERVICE_SET_MODE =
"set_mode"
76 SERVICE_SET_MUSIC_MODE =
"set_music_mode"
77 SERVICE_START_FLOW =
"start_flow"
78 SERVICE_SET_COLOR_SCENE =
"set_color_scene"
79 SERVICE_SET_HSV_SCENE =
"set_hsv_scene"
80 SERVICE_SET_COLOR_TEMP_SCENE =
"set_color_temp_scene"
81 SERVICE_SET_COLOR_FLOW_SCENE =
"set_color_flow_scene"
82 SERVICE_SET_AUTO_DELAY_OFF_SCENE =
"set_auto_delay_off_scene"
84 EFFECT_DISCO =
"Disco"
85 EFFECT_TEMP =
"Slow Temp"
86 EFFECT_STROBE =
"Strobe epilepsy!"
87 EFFECT_STROBE_COLOR =
"Strobe color"
88 EFFECT_ALARM =
"Alarm"
89 EFFECT_POLICE =
"Police"
90 EFFECT_POLICE2 =
"Police2"
91 EFFECT_CHRISTMAS =
"Christmas"
93 EFFECT_RANDOM_LOOP =
"Random Loop"
94 EFFECT_FAST_RANDOM_LOOP =
"Fast Random Loop"
96 EFFECT_SLOWDOWN =
"Slowdown"
97 EFFECT_WHATSAPP =
"WhatsApp"
98 EFFECT_FACEBOOK =
"Facebook"
99 EFFECT_TWITTER =
"Twitter"
102 EFFECT_NIGHT_MODE =
"Night Mode"
103 EFFECT_DATE_NIGHT =
"Date Night"
104 EFFECT_MOVIE =
"Movie"
105 EFFECT_SUNRISE =
"Sunrise"
106 EFFECT_SUNSET =
"Sunset"
107 EFFECT_ROMANCE =
"Romance"
108 EFFECT_HAPPY_BIRTHDAY =
"Happy Birthday"
109 EFFECT_CANDLE_FLICKER =
"Candle Flicker"
110 EFFECT_TEA_TIME =
"Tea Time"
112 YEELIGHT_TEMP_ONLY_EFFECT_LIST = [EFFECT_TEMP, EFFECT_STOP]
114 YEELIGHT_MONO_EFFECT_LIST = [
123 EFFECT_CANDLE_FLICKER,
125 *YEELIGHT_TEMP_ONLY_EFFECT_LIST,
128 YEELIGHT_COLOR_EFFECT_LIST = [
134 EFFECT_FAST_RANDOM_LOOP,
143 EFFECT_HAPPY_BIRTHDAY,
144 *YEELIGHT_MONO_EFFECT_LIST,
148 EFFECT_DISCO: flows.disco,
149 EFFECT_TEMP: flows.temp,
150 EFFECT_STROBE: flows.strobe,
151 EFFECT_STROBE_COLOR: flows.strobe_color,
152 EFFECT_ALARM: flows.alarm,
153 EFFECT_POLICE: flows.police,
154 EFFECT_POLICE2: flows.police2,
155 EFFECT_CHRISTMAS: flows.christmas,
156 EFFECT_RGB: flows.rgb,
157 EFFECT_RANDOM_LOOP: flows.random_loop,
158 EFFECT_LSD: flows.lsd,
159 EFFECT_SLOWDOWN: flows.slowdown,
160 EFFECT_HOME: flows.home,
161 EFFECT_NIGHT_MODE: flows.night_mode,
162 EFFECT_DATE_NIGHT: flows.date_night,
163 EFFECT_MOVIE: flows.movie,
164 EFFECT_SUNRISE: flows.sunrise,
165 EFFECT_SUNSET: flows.sunset,
166 EFFECT_ROMANCE: flows.romance,
167 EFFECT_HAPPY_BIRTHDAY: flows.happy_birthday,
168 EFFECT_CANDLE_FLICKER: flows.candle_flicker,
169 EFFECT_TEA_TIME: flows.tea_time,
172 VALID_BRIGHTNESS = vol.All(vol.Coerce(int), vol.Range(min=1, max=100))
174 SERVICE_SCHEMA_SET_MODE: VolDictType = {
175 vol.Required(ATTR_MODE): vol.In([mode.name.lower()
for mode
in PowerMode])
178 SERVICE_SCHEMA_SET_MUSIC_MODE: VolDictType = {vol.Required(ATTR_MODE_MUSIC): cv.boolean}
180 SERVICE_SCHEMA_START_FLOW = YEELIGHT_FLOW_TRANSITION_SCHEMA
182 SERVICE_SCHEMA_SET_COLOR_SCENE: VolDictType = {
183 vol.Required(ATTR_RGB_COLOR): vol.All(
184 vol.Coerce(tuple), vol.ExactSequence((cv.byte, cv.byte, cv.byte))
186 vol.Required(ATTR_BRIGHTNESS): VALID_BRIGHTNESS,
189 SERVICE_SCHEMA_SET_HSV_SCENE: VolDictType = {
190 vol.Required(ATTR_HS_COLOR): vol.All(
194 vol.All(vol.Coerce(float), vol.Range(min=0, max=359)),
195 vol.All(vol.Coerce(float), vol.Range(min=0, max=100)),
199 vol.Required(ATTR_BRIGHTNESS): VALID_BRIGHTNESS,
202 SERVICE_SCHEMA_SET_COLOR_TEMP_SCENE: VolDictType = {
203 vol.Required(ATTR_KELVIN): vol.All(vol.Coerce(int), vol.Range(min=1700, max=6500)),
204 vol.Required(ATTR_BRIGHTNESS): VALID_BRIGHTNESS,
207 SERVICE_SCHEMA_SET_COLOR_FLOW_SCENE = YEELIGHT_FLOW_TRANSITION_SCHEMA
209 SERVICE_SCHEMA_SET_AUTO_DELAY_OFF_SCENE: VolDictType = {
210 vol.Required(ATTR_MINUTES): vol.All(vol.Coerce(int), vol.Range(min=1, max=60)),
211 vol.Required(ATTR_BRIGHTNESS): VALID_BRIGHTNESS,
217 """Parse transitions config into initialized objects."""
218 transition_objects = []
219 for transition_config
in transitions:
220 transition, params =
list(transition_config.items())[0]
221 transition_objects.append(getattr(yeelight, transition)(*params))
223 return transition_objects
229 for config
in effects_config:
230 params = config[CONF_FLOW_PARAMS]
231 action = Flow.actions[params[ATTR_ACTION]]
234 effects[config[CONF_NAME]] = {
235 ATTR_COUNT: params[ATTR_COUNT],
237 ATTR_TRANSITIONS: transitions,
243 def _async_cmd[_YeelightBaseLightT: YeelightBaseLight, **_P, _R](
244 func: Callable[Concatenate[_YeelightBaseLightT, _P], Coroutine[Any, Any, _R]],
245 ) -> Callable[Concatenate[_YeelightBaseLightT, _P], Coroutine[Any, Any, _R |
None]]:
246 """Define a wrapper to catch exceptions from the bulb."""
248 async
def _async_wrap(
249 self: _YeelightBaseLightT, *args: _P.args, **kwargs: _P.kwargs
251 for attempts
in range(2):
253 _LOGGER.debug(
"Calling %s with %s %s", func, args, kwargs)
254 return await func(self, *args, **kwargs)
255 except TimeoutError
as ex:
261 f
"Timed out when calling {func.__name__} for bulb "
262 f
"{self.device.name} at {self.device.host}: {str(ex) or type(ex)}"
264 except OSError
as ex:
266 self.device.async_mark_unavailable()
267 self.async_state_changed()
269 f
"Error when calling {func.__name__} for bulb "
270 f
"{self.device.name} at {self.device.host}: {str(ex) or type(ex)}"
272 except BulbException
as ex:
275 f
"Error when calling {func.__name__} for bulb "
276 f
"{self.device.name} at {self.device.host}: {str(ex) or type(ex)}"
285 config_entry: ConfigEntry,
286 async_add_entities: AddEntitiesCallback,
288 """Set up Yeelight from a config entry."""
291 device = hass.data[DOMAIN][DATA_CONFIG_ENTRIES][config_entry.entry_id][DATA_DEVICE]
292 _LOGGER.debug(
"Adding %s", device.name)
294 nl_switch_light = device.config.get(CONF_NIGHTLIGHT_SWITCH)
298 device_type = device.type
300 def _lights_setup_helper(klass):
301 lights.append(klass(device, config_entry, custom_effects=custom_effects))
303 if device_type == BulbType.White:
304 _lights_setup_helper(YeelightGenericLight)
305 elif device_type == BulbType.Color:
306 if nl_switch_light
and device.is_nightlight_supported:
307 _lights_setup_helper(YeelightColorLightWithNightlightSwitch)
308 _lights_setup_helper(YeelightNightLightModeWithoutBrightnessControl)
310 _lights_setup_helper(YeelightColorLightWithoutNightlightSwitchLight)
311 elif device_type == BulbType.WhiteTemp:
312 if nl_switch_light
and device.is_nightlight_supported:
313 _lights_setup_helper(YeelightWithNightLight)
314 _lights_setup_helper(YeelightNightLightMode)
316 _lights_setup_helper(YeelightWhiteTempWithoutNightlightSwitch)
317 elif device_type == BulbType.WhiteTempMood:
318 if nl_switch_light
and device.is_nightlight_supported:
319 _lights_setup_helper(YeelightNightLightModeWithAmbientSupport)
320 _lights_setup_helper(YeelightWithAmbientAndNightlight)
322 _lights_setup_helper(YeelightWithAmbientWithoutNightlight)
323 _lights_setup_helper(YeelightAmbientLight)
325 _lights_setup_helper(YeelightGenericLight)
327 "Cannot determine device type for %s, %s. Falling back to white only",
338 """Set up custom services."""
340 async
def _async_start_flow(entity, service_call):
341 params = {**service_call.data}
342 params.pop(ATTR_ENTITY_ID)
344 await entity.async_start_flow(**params)
346 async
def _async_set_color_scene(entity, service_call):
347 await entity.async_set_scene(
349 *service_call.data[ATTR_RGB_COLOR],
350 service_call.data[ATTR_BRIGHTNESS],
353 async
def _async_set_hsv_scene(entity, service_call):
354 await entity.async_set_scene(
356 *service_call.data[ATTR_HS_COLOR],
357 service_call.data[ATTR_BRIGHTNESS],
360 async
def _async_set_color_temp_scene(entity, service_call):
361 await entity.async_set_scene(
363 service_call.data[ATTR_KELVIN],
364 service_call.data[ATTR_BRIGHTNESS],
367 async
def _async_set_color_flow_scene(entity, service_call):
369 count=service_call.data[ATTR_COUNT],
370 action=Flow.actions[service_call.data[ATTR_ACTION]],
373 await entity.async_set_scene(SceneClass.CF, flow)
375 async
def _async_set_auto_delay_off_scene(entity, service_call):
376 await entity.async_set_scene(
377 SceneClass.AUTO_DELAY_OFF,
378 service_call.data[ATTR_BRIGHTNESS],
379 service_call.data[ATTR_MINUTES],
382 platform = entity_platform.async_get_current_platform()
384 platform.async_register_entity_service(
385 SERVICE_SET_MODE, SERVICE_SCHEMA_SET_MODE,
"async_set_mode"
387 platform.async_register_entity_service(
388 SERVICE_START_FLOW, SERVICE_SCHEMA_START_FLOW, _async_start_flow
390 platform.async_register_entity_service(
391 SERVICE_SET_COLOR_SCENE, SERVICE_SCHEMA_SET_COLOR_SCENE, _async_set_color_scene
393 platform.async_register_entity_service(
394 SERVICE_SET_HSV_SCENE, SERVICE_SCHEMA_SET_HSV_SCENE, _async_set_hsv_scene
396 platform.async_register_entity_service(
397 SERVICE_SET_COLOR_TEMP_SCENE,
398 SERVICE_SCHEMA_SET_COLOR_TEMP_SCENE,
399 _async_set_color_temp_scene,
401 platform.async_register_entity_service(
402 SERVICE_SET_COLOR_FLOW_SCENE,
403 SERVICE_SCHEMA_SET_COLOR_FLOW_SCENE,
404 _async_set_color_flow_scene,
406 platform.async_register_entity_service(
407 SERVICE_SET_AUTO_DELAY_OFF_SCENE,
408 SERVICE_SCHEMA_SET_AUTO_DELAY_OFF_SCENE,
409 _async_set_auto_delay_off_scene,
411 platform.async_register_entity_service(
412 SERVICE_SET_MUSIC_MODE, SERVICE_SCHEMA_SET_MUSIC_MODE,
"async_set_music_mode"
417 """Abstract Yeelight light."""
419 _attr_color_mode = ColorMode.BRIGHTNESS
420 _attr_supported_color_modes = {ColorMode.BRIGHTNESS}
421 _attr_supported_features = (
422 LightEntityFeature.TRANSITION
423 | LightEntityFeature.FLASH
424 | LightEntityFeature.EFFECT
426 _attr_should_poll =
False
430 device: YeelightDevice,
432 custom_effects: dict[str, dict[str, Any]] |
None =
None,
434 """Initialize the Yeelight light."""
442 model_specs = self.
_bulb_bulb.get_model_specs()
457 """Call when the device changes state."""
458 if not self.
_device_device.available:
463 """Handle entity which will be added."""
467 DATA_UPDATED.format(self.
_device_device.host),
475 """Return the list of supported effects."""
480 """Return the color temperature."""
487 """Return true if device is on."""
492 """Return the brightness of this light between 1..255."""
496 brightness_property = (
499 brightness = self.
_get_property_get_property(brightness_property)
or 0
500 return round(255 * (
int(brightness) / 100))
504 """Return dict with custom effects."""
509 """Return list with custom effects names."""
514 """Return light type."""
519 """Return the color property."""
522 if hue
is None or sat
is None:
525 return (
int(hue),
int(sat))
529 """Return the color property."""
535 green = (rgb >> 8) & 0xFF
536 red = (rgb >> 16) & 0xFF
538 return (red, green, blue)
542 """Return the current effect."""
543 return self.
_effect_effect
if self.
devicedevice.is_color_flow_enabled
else None
547 return self.
devicedevice.bulb
551 return self.
_bulb_bulb.last_properties
if self.
_bulb_bulb
else {}
566 return PowerMode.LAST
570 return YEELIGHT_MONO_EFFECT_LIST
574 """Return the device specific state attributes."""
576 "flowing": self.
devicedevice.is_color_flow_enabled,
577 "music_mode": self.
_bulb_bulb.music_mode,
580 if self.
devicedevice.is_nightlight_supported:
581 attributes[
"night_light"] = self.
devicedevice.is_nightlight_enabled
587 """Return yeelight device."""
591 """Update light properties."""
595 """Set the music mode on or off."""
598 except AssertionError
as ex:
599 _LOGGER.error(
"Unable to turn on music mode, consider disabling it: %s", ex)
603 """Set the music mode on or off wrapped with _async_cmd."""
604 bulb = self.
_bulb_bulb
606 await bulb.async_start_music()
608 await bulb.async_stop_music()
612 """Set bulb brightness."""
617 and self.
_bulb_bulb.model
not in MODELS_WITH_DELAYED_ON_TRANSITION
619 _LOGGER.debug(
"brightness already set to: %s", brightness)
625 _LOGGER.debug(
"Setting brightness: %s", brightness)
627 brightness / 255 * 100, duration=duration, light_type=self.
light_typelight_type
632 """Set bulb's color."""
640 not self.
devicedevice.is_color_flow_enabled
644 _LOGGER.debug(
"HS already set to: %s", hs_color)
650 _LOGGER.debug(
"Setting HS: %s", hs_color)
651 await self.
_bulb_bulb.async_set_hsv(
652 hs_color[0], hs_color[1], duration=duration, light_type=self.
light_typelight_type
657 """Set bulb's color."""
665 not self.
devicedevice.is_color_flow_enabled
669 _LOGGER.debug(
"RGB already set to: %s", rgb)
675 _LOGGER.debug(
"Setting RGB: %s", rgb)
677 *rgb, duration=duration, light_type=self.
light_typelight_type
682 """Set bulb's color temperature."""
689 temp_in_k = mired_to_kelvin(colortemp)
692 not self.
devicedevice.is_color_flow_enabled
696 _LOGGER.debug(
"Color temp already set to: %s", temp_in_k)
702 await self.
_bulb_bulb.async_set_color_temp(
703 temp_in_k, duration=duration, light_type=self.
light_typelight_type
708 """Set current options as default."""
713 """Activate flash."""
717 _LOGGER.error(
"Flash supported currently only in RGB mode")
720 transition =
int(self.
configconfig[CONF_TRANSITION])
721 if flash == FLASH_LONG:
723 duration = transition * 5
724 if flash == FLASH_SHORT:
726 duration = transition * 2
731 transitions.append(RGBTransition(255, 0, 0, brightness=10, duration=duration))
732 transitions.append(SleepTransition(duration=transition))
739 flow = Flow(count=count, transitions=transitions)
744 """Activate effect."""
748 if effect == EFFECT_STOP:
749 await self.
_bulb_bulb.async_stop_flow(light_type=self.
light_typelight_type)
754 elif effect
in EFFECTS_MAP:
755 flow = EFFECTS_MAP[effect]()
756 elif effect == EFFECT_FAST_RANDOM_LOOP:
757 flow = flows.random_loop(duration=250)
758 elif effect == EFFECT_WHATSAPP:
759 flow = flows.pulse(37, 211, 102, count=2)
760 elif effect == EFFECT_FACEBOOK:
761 flow = flows.pulse(59, 89, 152, count=2)
762 elif effect == EFFECT_TWITTER:
763 flow = flows.pulse(0, 172, 237, count=2)
772 """Turn on the bulb for with a transition duration wrapped with _async_cmd."""
780 """Turn the bulb on."""
781 brightness = kwargs.get(ATTR_BRIGHTNESS)
782 colortemp = kwargs.get(ATTR_COLOR_TEMP)
783 hs_color = kwargs.get(ATTR_HS_COLOR)
784 rgb = kwargs.get(ATTR_RGB_COLOR)
785 flash = kwargs.get(ATTR_FLASH)
786 effect = kwargs.get(ATTR_EFFECT)
788 duration =
int(self.
configconfig[CONF_TRANSITION])
789 if ATTR_TRANSITION
in kwargs:
790 duration =
int(kwargs[ATTR_TRANSITION] * 1000)
795 if self.
configconfig[CONF_MODE_MUSIC]
and not self.
_bulb_bulb.music_mode:
806 if self.
configconfig[CONF_SAVE_ON_CHANGE]
and (brightness
or colortemp
or rgb):
813 """Cancel a pending state check."""
820 """Schedule a poll if the change failed to get pushed back to us.
822 Some devices (mainly nightlights) will not send back the on state
823 so we need to force a refresh.
827 async
def _async_update_if_state_unexpected(*_):
829 if self.
is_onis_onis_on != expected_power_state:
833 self.
hasshass, POWER_STATE_CHANGE_TIME, _async_update_if_state_unexpected
838 """Turn off with a given transition duration wrapped with _async_cmd."""
846 duration =
int(self.
configconfig[CONF_TRANSITION])
847 if ATTR_TRANSITION
in kwargs:
848 duration =
int(kwargs[ATTR_TRANSITION] * 1000)
855 """Set a power mode."""
856 await self.
_bulb_bulb.async_set_power_mode(PowerMode[mode.upper()])
862 flow = Flow(count=count, action=Flow.actions[action], transitions=transitions)
867 """Set the light directly to the specified state.
869 If the light is off, it will first be turned on.
875 """Representation of a generic Yeelight."""
881 """Representation of a Color Yeelight light support."""
883 _attr_supported_color_modes = {ColorMode.COLOR_TEMP, ColorMode.HS, ColorMode.RGB}
887 """Return the color mode."""
892 return ColorMode.COLOR_TEMP
895 _LOGGER.debug(
"Light reported unknown color mode: %s", color_mode)
896 return ColorMode.UNKNOWN
900 return YEELIGHT_COLOR_EFFECT_LIST
904 """Representation of a White temp Yeelight light."""
907 _attr_color_mode = ColorMode.COLOR_TEMP
908 _attr_supported_color_modes = {ColorMode.COLOR_TEMP}
912 return YEELIGHT_TEMP_ONLY_EFFECT_LIST
916 """Representation of a Yeelight nightlight support."""
920 return PowerMode.NORMAL
924 """A mix-in for yeelights without a nightlight switch."""
931 if self.
devicedevice.is_nightlight_enabled:
933 return super()._brightness_property
937 """Return the color temperature."""
938 if self.
devicedevice.is_nightlight_enabled:
941 return super().color_temp
945 YeelightColorLightSupport, YeelightWithoutNightlightSwitchMixIn
947 """Representation of a Color Yeelight light."""
951 YeelightColorLightWithoutNightlightSwitch
953 """Representation of a Color Yeelight light."""
959 YeelightNightLightSupport, YeelightColorLightSupport, YeelightBaseLight
961 """Representation of a Yeelight with rgb support and nightlight.
963 It represents case when nightlight switch is set to light.
970 """Return true if device is on."""
971 return super().is_on
and not self.
devicedevice.is_nightlight_enabled
975 YeelightWhiteTempLightSupport, YeelightWithoutNightlightSwitchMixIn
977 """White temp light, when nightlight switch is not set to light."""
983 YeelightNightLightSupport, YeelightWhiteTempLightSupport, YeelightBaseLight
985 """Representation of a Yeelight with temp only support and nightlight.
987 It represents case when nightlight switch is set to light.
994 """Return true if device is on."""
995 return super().is_on
and not self.
devicedevice.is_nightlight_enabled
999 """Representation of a Yeelight when in nightlight mode."""
1001 _attr_color_mode = ColorMode.BRIGHTNESS
1002 _attr_supported_color_modes = {ColorMode.BRIGHTNESS}
1003 _attr_translation_key =
"nightlight"
1007 """Return a unique ID."""
1008 unique = super().unique_id
1009 return f
"{unique}-nightlight"
1013 """Return true if device is on."""
1014 return super().is_on
and self.
devicedevice.is_nightlight_enabled
1022 return PowerMode.MOONLIGHT
1026 """Flag no supported features."""
1031 """Representation of a Yeelight, with ambient support, when in nightlight mode."""
1039 """Representation of a Yeelight, when in nightlight mode.
1041 It represents case when nightlight mode brightness control is not supported.
1044 _attr_color_mode = ColorMode.ONOFF
1045 _attr_supported_color_modes = {ColorMode.ONOFF}
1049 """Representation of a Yeelight which has ambilight support.
1051 And nightlight switch type is none.
1062 """Representation of a Yeelight which has ambilight support.
1064 And nightlight switch type is set to light.
1075 """Representation of a Yeelight ambient light."""
1077 _attr_translation_key =
"ambilight"
1079 PROPERTIES_MAPPING = {
"color_mode":
"bg_lmode"}
1082 """Initialize the Yeelight Ambient light."""
1091 """Return a unique ID."""
1092 unique = super().unique_id
1093 return f
"{unique}-ambilight"
1101 bg_prop = f
"bg_{prop}"
int|None brightness(self)
tuple[int, int, int]|None rgb_color(self)
int|None color_temp(self)
set[ColorMode]|set[str]|None supported_color_modes(self)
tuple[float, float]|None hs_color(self)
ColorMode|str|None color_mode(self)
def __init__(self, *args, **kwargs)
def _get_property(self, str prop, default=None)
dictionary PROPERTIES_MAPPING
str _brightness_property(self)
str _brightness_property(self)
None _async_turn_on(self, duration)
list[str] _predefined_effects(self)
LightType light_type(self)
None async_set_default(self)
None _async_set_music_mode(self, music_mode)
def async_set_mode(self, str mode)
dict[str, dict[str, Any]] custom_effects(self)
int|None color_temp(self)
None _async_turn_off(self, duration)
YeelightDevice device(self)
None async_set_effect(self, effect)
None async_set_rgb(self, rgb, duration)
list[str] custom_effects_names(self)
None async_turn_on(self, **Any kwargs)
list[str] effect_list(self)
def _async_schedule_state_check(self, expected_power_state)
str _power_property(self)
None async_added_to_hass(self)
None async_set_music_mode(self, music_mode)
dict[str, Any] extra_state_attributes(self)
PowerMode _turn_on_power_mode(self)
tuple[int, int, int]|None rgb_color(self)
None async_turn_off(self, **Any kwargs)
def _get_property(self, str prop, default=None)
None __init__(self, YeelightDevice device, ConfigEntry entry, dict[str, dict[str, Any]]|None custom_effects=None)
def async_start_flow(self, transitions, count=0, action=ACTION_RECOVER)
def async_set_scene(self, scene_class, *args)
None async_set_brightness(self, brightness, duration)
None async_state_changed(self)
def _async_cancel_pending_state_check(self)
tuple[float, float]|None hs_color(self)
None async_set_hs(self, hs_color, duration)
None async_set_colortemp(self, colortemp, duration)
None async_set_flash(self, flash)
list[str] _predefined_effects(self)
str _power_property(self)
PowerMode _turn_on_power_mode(self)
LightEntityFeature supported_features(self)
str _brightness_property(self)
PowerMode _turn_on_power_mode(self)
list[str] _predefined_effects(self)
str _power_property(self)
str _power_property(self)
str _brightness_property(self)
None async_write_ha_state(self)
None async_on_remove(self, CALLBACK_TYPE func)
web.Response get(self, web.Request request, str config_key)
def _async_setup_services(HomeAssistant hass)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
def _transitions_config_parser(transitions)
dict[str, dict[str, Any]] _parse_custom_effects(effects_config)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)
CALLBACK_TYPE async_call_later(HomeAssistant hass, float|timedelta delay, HassJob[[datetime], Coroutine[Any, Any, None]|None]|Callable[[datetime], Coroutine[Any, Any, None]|None] action)