Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.yeelight.light.YeelightBaseLight Class Reference
Inheritance diagram for homeassistant.components.yeelight.light.YeelightBaseLight:
[legend]
Collaboration diagram for homeassistant.components.yeelight.light.YeelightBaseLight:
[legend]

Public Member Functions

None __init__ (self, YeelightDevice device, ConfigEntry entry, dict[str, dict[str, Any]]|None custom_effects=None)
 
None async_added_to_hass (self)
 
None async_set_brightness (self, brightness, duration)
 
None async_set_colortemp (self, colortemp, duration)
 
None async_set_default (self)
 
None async_set_effect (self, effect)
 
None async_set_flash (self, flash)
 
None async_set_hs (self, hs_color, duration)
 
def async_set_mode (self, str mode)
 
None async_set_music_mode (self, music_mode)
 
None async_set_rgb (self, rgb, duration)
 
def async_set_scene (self, scene_class, *args)
 
def async_start_flow (self, transitions, count=0, action=ACTION_RECOVER)
 
None async_state_changed (self)
 
None async_turn_off (self, **Any kwargs)
 
None async_turn_on (self, **Any kwargs)
 
None async_update (self)
 
int brightness (self)
 
int|None color_temp (self)
 
dict[str, dict[str, Any]] custom_effects (self)
 
list[strcustom_effects_names (self)
 
YeelightDevice device (self)
 
str|None effect (self)
 
list[streffect_list (self)
 
dict[str, Any] extra_state_attributes (self)
 
tuple[float, float]|None hs_color (self)
 
bool is_on (self)
 
LightType light_type (self)
 
tuple[int, int, int]|None rgb_color (self)
 
- Public Member Functions inherited from homeassistant.components.yeelight.entity.YeelightEntity
None __init__ (self, YeelightDevice device, ConfigEntry entry)
 
bool available (self)
 
str unique_id (self)
 
- Public Member Functions inherited from homeassistant.helpers.entity.Entity
None __init_subclass__ (cls, **Any kwargs)
 
str __repr__ (self)
 
None add_to_platform_abort (self)
 
None add_to_platform_finish (self)
 
None add_to_platform_start (self, HomeAssistant hass, EntityPlatform platform, asyncio.Semaphore|None parallel_updates)
 
bool assumed_state (self)
 
None async_device_update (self, bool warning=True)
 
None async_internal_added_to_hass (self)
 
None async_internal_will_remove_from_hass (self)
 
None async_on_remove (self, CALLBACK_TYPE func)
 
None async_registry_entry_updated (self)
 
None async_remove (self, *bool force_remove=False)
 
None async_removed_from_registry (self)
 
None async_schedule_update_ha_state (self, bool force_refresh=False)
 
None async_set_context (self, Context context)
 
None async_update_ha_state (self, bool force_refresh=False)
 
None async_will_remove_from_hass (self)
 
None async_write_ha_state (self)
 
str|None attribution (self)
 
str|None device_class (self)
 
DeviceInfo|None device_info (self)
 
bool enabled (self)
 
EntityCategory|None entity_category (self)
 
str|None entity_picture (self)
 
bool entity_registry_enabled_default (self)
 
bool entity_registry_visible_default (self)
 
bool force_update (self)
 
HassJobType get_hassjob_type (self, str function_name)
 
er.EntityOptionsType|None get_initial_entity_options (self)
 
bool has_entity_name (self)
 
str|None icon (self)
 
str|UndefinedType|None name (self)
 
None schedule_update_ha_state (self, bool force_refresh=False)
 
bool should_poll (self)
 
str|None suggested_object_id (self)
 
str|None translation_key (self)
 
Mapping[str, strtranslation_placeholders (self)
 
str|None unit_of_measurement (self)
 
bool use_device_name (self)
 
- Public Member Functions inherited from homeassistant.helpers.entity.CachedProperties
None __init__ (cls, str name, tuple[type,...] bases, dict[Any, Any] namespace, **Any kwargs)
 
Any __new__ (mcs, str name, tuple[type,...] bases, dict[Any, Any] namespace, set[str]|None cached_properties=None, **Any kwargs)
 
- Public Member Functions inherited from homeassistant.components.light.LightEntity
dict[str, Any] capability_attributes (self)
 
ColorMode|str|None color_mode (self)
 
int|None color_temp_kelvin (self)
 
int max_color_temp_kelvin (self)
 
int max_mireds (self)
 
int min_color_temp_kelvin (self)
 
int min_mireds (self)
 
tuple[int, int, int, int]|None rgbw_color (self)
 
tuple[int, int, int, int, int]|None rgbww_color (self)
 
dict[str, Any]|None state_attributes (self)
 
set[ColorMode]|set[str]|None supported_color_modes (self)
 
LightEntityFeature supported_features (self)
 
LightEntityFeature supported_features_compat (self)
 
tuple[float, float]|None xy_color (self)
 
- Public Member Functions inherited from homeassistant.helpers.entity.ToggleEntity
None async_toggle (self, **Any kwargs)
 
Literal["on", "off"]|None state (self)
 
None toggle (self, **Any kwargs)
 
None turn_off (self, **Any kwargs)
 
None turn_on (self, **Any kwargs)
 

Public Attributes

 color_mode
 
 color_temp
 
 config
 
 hs_color
 
 rgb_color
 
- Public Attributes inherited from homeassistant.helpers.entity.Entity
 device_entry
 
 entity_id
 
 hass
 
 parallel_updates
 
 platform
 
 registry_entry
 

Private Member Functions

def _async_cancel_pending_state_check (self)
 
def _async_schedule_state_check (self, expected_power_state)
 
None _async_set_music_mode (self, music_mode)
 
None _async_turn_off (self, duration)
 
None _async_turn_on (self, duration)
 
str _brightness_property (self)
 
AsyncBulb _bulb (self)
 
def _get_property (self, str prop, default=None)
 
str _power_property (self)
 
list[str_predefined_effects (self)
 
dict _properties (self)
 
PowerMode _turn_on_power_mode (self)
 

Private Attributes

 _attr_max_mireds
 
 _attr_min_mireds
 
 _color_temp
 
 _custom_effects
 
 _effect
 
 _light_type
 
 _unexpected_state_check
 

Static Private Attributes

 _attr_color_mode = ColorMode.BRIGHTNESS
 
bool _attr_should_poll = False
 
dictionary _attr_supported_color_modes = {ColorMode.BRIGHTNESS}
 
tuple _attr_supported_features
 

Additional Inherited Members

- Static Public Attributes inherited from homeassistant.helpers.entity.Entity
 bool
 
 EntityPlatform
 
 HomeAssistant
 
 None
 
 StateInfo
 
 StateType
 
 str
 
- Static Public Attributes inherited from homeassistant.components.light.LightEntity
 int
 
 LightEntityFeature
 
 None
 
- Static Public Attributes inherited from homeassistant.helpers.entity.ToggleEntity
 None
 

Detailed Description

Abstract Yeelight light.

Definition at line 416 of file light.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.components.yeelight.light.YeelightBaseLight.__init__ (   self,
YeelightDevice  device,
ConfigEntry  entry,
dict[str, dict[str, Any]] | None   custom_effects = None 
)
Initialize the Yeelight light.

Definition at line 428 of file light.py.

Member Function Documentation

◆ _async_cancel_pending_state_check()

def homeassistant.components.yeelight.light.YeelightBaseLight._async_cancel_pending_state_check (   self)
private
Cancel a pending state check.

Definition at line 812 of file light.py.

◆ _async_schedule_state_check()

def homeassistant.components.yeelight.light.YeelightBaseLight._async_schedule_state_check (   self,
  expected_power_state 
)
private
Schedule a poll if the change failed to get pushed back to us.

Some devices (mainly nightlights) will not send back the on state
so we need to force a refresh.

Definition at line 819 of file light.py.

◆ _async_set_music_mode()

None homeassistant.components.yeelight.light.YeelightBaseLight._async_set_music_mode (   self,
  music_mode 
)
private
Set the music mode on or off wrapped with _async_cmd.

Definition at line 602 of file light.py.

◆ _async_turn_off()

None homeassistant.components.yeelight.light.YeelightBaseLight._async_turn_off (   self,
  duration 
)
private
Turn off with a given transition duration wrapped with _async_cmd.

Definition at line 837 of file light.py.

◆ _async_turn_on()

None homeassistant.components.yeelight.light.YeelightBaseLight._async_turn_on (   self,
  duration 
)
private
Turn on the bulb for with a transition duration wrapped with _async_cmd.

Definition at line 771 of file light.py.

◆ _brightness_property()

str homeassistant.components.yeelight.light.YeelightBaseLight._brightness_property (   self)
private

◆ _bulb()

AsyncBulb homeassistant.components.yeelight.light.YeelightBaseLight._bulb (   self)
private

Definition at line 546 of file light.py.

◆ _get_property()

def homeassistant.components.yeelight.light.YeelightBaseLight._get_property (   self,
str  prop,
  default = None 
)
private

Reimplemented in homeassistant.components.yeelight.light.YeelightAmbientLight.

Definition at line 553 of file light.py.

◆ _power_property()

◆ _predefined_effects()

list[str] homeassistant.components.yeelight.light.YeelightBaseLight._predefined_effects (   self)
private

◆ _properties()

dict homeassistant.components.yeelight.light.YeelightBaseLight._properties (   self)
private

Definition at line 550 of file light.py.

◆ _turn_on_power_mode()

PowerMode homeassistant.components.yeelight.light.YeelightBaseLight._turn_on_power_mode (   self)
private

Reimplemented in homeassistant.components.yeelight.light.YeelightNightLightMode.

Definition at line 565 of file light.py.

◆ async_added_to_hass()

None homeassistant.components.yeelight.light.YeelightBaseLight.async_added_to_hass (   self)
Handle entity which will be added.

Reimplemented from homeassistant.helpers.entity.Entity.

Definition at line 462 of file light.py.

◆ async_set_brightness()

None homeassistant.components.yeelight.light.YeelightBaseLight.async_set_brightness (   self,
  brightness,
  duration 
)
Set bulb brightness.

Definition at line 611 of file light.py.

◆ async_set_colortemp()

None homeassistant.components.yeelight.light.YeelightBaseLight.async_set_colortemp (   self,
  colortemp,
  duration 
)
Set bulb's color temperature.

Definition at line 681 of file light.py.

◆ async_set_default()

None homeassistant.components.yeelight.light.YeelightBaseLight.async_set_default (   self)
Set current options as default.

Definition at line 707 of file light.py.

◆ async_set_effect()

None homeassistant.components.yeelight.light.YeelightBaseLight.async_set_effect (   self,
  effect 
)
Activate effect.

Definition at line 743 of file light.py.

◆ async_set_flash()

None homeassistant.components.yeelight.light.YeelightBaseLight.async_set_flash (   self,
  flash 
)
Activate flash.

Definition at line 712 of file light.py.

◆ async_set_hs()

None homeassistant.components.yeelight.light.YeelightBaseLight.async_set_hs (   self,
  hs_color,
  duration 
)
Set bulb's color.

Definition at line 631 of file light.py.

◆ async_set_mode()

def homeassistant.components.yeelight.light.YeelightBaseLight.async_set_mode (   self,
str  mode 
)
Set a power mode.

Definition at line 854 of file light.py.

◆ async_set_music_mode()

None homeassistant.components.yeelight.light.YeelightBaseLight.async_set_music_mode (   self,
  music_mode 
)
Set the music mode on or off.

Definition at line 594 of file light.py.

◆ async_set_rgb()

None homeassistant.components.yeelight.light.YeelightBaseLight.async_set_rgb (   self,
  rgb,
  duration 
)
Set bulb's color.

Definition at line 656 of file light.py.

◆ async_set_scene()

def homeassistant.components.yeelight.light.YeelightBaseLight.async_set_scene (   self,
  scene_class,
args 
)
Set the light directly to the specified state.

If the light is off, it will first be turned on.

Definition at line 866 of file light.py.

◆ async_start_flow()

def homeassistant.components.yeelight.light.YeelightBaseLight.async_start_flow (   self,
  transitions,
  count = 0,
  action = ACTION_RECOVER 
)
Start flow.

Definition at line 860 of file light.py.

◆ async_state_changed()

None homeassistant.components.yeelight.light.YeelightBaseLight.async_state_changed (   self)
Call when the device changes state.

Definition at line 456 of file light.py.

◆ async_turn_off()

None homeassistant.components.yeelight.light.YeelightBaseLight.async_turn_off (   self,
**Any  kwargs 
)
Turn off.

Reimplemented from homeassistant.helpers.entity.ToggleEntity.

Definition at line 841 of file light.py.

◆ async_turn_on()

None homeassistant.components.yeelight.light.YeelightBaseLight.async_turn_on (   self,
**Any  kwargs 
)
Turn the bulb on.

Reimplemented from homeassistant.helpers.entity.ToggleEntity.

Definition at line 779 of file light.py.

◆ async_update()

None homeassistant.components.yeelight.light.YeelightBaseLight.async_update (   self)
Update light properties.

Reimplemented from homeassistant.components.yeelight.entity.YeelightEntity.

Definition at line 590 of file light.py.

◆ brightness()

int homeassistant.components.yeelight.light.YeelightBaseLight.brightness (   self)
Return the brightness of this light between 1..255.

Reimplemented from homeassistant.components.light.LightEntity.

Definition at line 491 of file light.py.

◆ color_temp()

int | None homeassistant.components.yeelight.light.YeelightBaseLight.color_temp (   self)
Return the color temperature.

Reimplemented from homeassistant.components.light.LightEntity.

Reimplemented in homeassistant.components.yeelight.light.YeelightWithoutNightlightSwitchMixIn.

Definition at line 479 of file light.py.

◆ custom_effects()

dict[str, dict[str, Any]] homeassistant.components.yeelight.light.YeelightBaseLight.custom_effects (   self)
Return dict with custom effects.

Definition at line 503 of file light.py.

◆ custom_effects_names()

list[str] homeassistant.components.yeelight.light.YeelightBaseLight.custom_effects_names (   self)
Return list with custom effects names.

Definition at line 508 of file light.py.

◆ device()

YeelightDevice homeassistant.components.yeelight.light.YeelightBaseLight.device (   self)
Return yeelight device.

Definition at line 586 of file light.py.

◆ effect()

str | None homeassistant.components.yeelight.light.YeelightBaseLight.effect (   self)
Return the current effect.

Reimplemented from homeassistant.components.light.LightEntity.

Definition at line 541 of file light.py.

◆ effect_list()

list[str] homeassistant.components.yeelight.light.YeelightBaseLight.effect_list (   self)
Return the list of supported effects.

Reimplemented from homeassistant.components.light.LightEntity.

Definition at line 474 of file light.py.

◆ extra_state_attributes()

dict[str, Any] homeassistant.components.yeelight.light.YeelightBaseLight.extra_state_attributes (   self)
Return the device specific state attributes.

Reimplemented from homeassistant.helpers.entity.Entity.

Definition at line 573 of file light.py.

◆ hs_color()

tuple[float, float] | None homeassistant.components.yeelight.light.YeelightBaseLight.hs_color (   self)
Return the color property.

Reimplemented from homeassistant.components.light.LightEntity.

Definition at line 518 of file light.py.

◆ is_on()

bool homeassistant.components.yeelight.light.YeelightBaseLight.is_on (   self)

◆ light_type()

LightType homeassistant.components.yeelight.light.YeelightBaseLight.light_type (   self)
Return light type.

Definition at line 513 of file light.py.

◆ rgb_color()

tuple[int, int, int] | None homeassistant.components.yeelight.light.YeelightBaseLight.rgb_color (   self)
Return the color property.

Reimplemented from homeassistant.components.light.LightEntity.

Definition at line 528 of file light.py.

Member Data Documentation

◆ _attr_color_mode

homeassistant.components.yeelight.light.YeelightBaseLight._attr_color_mode = ColorMode.BRIGHTNESS
staticprivate

Definition at line 419 of file light.py.

◆ _attr_max_mireds

homeassistant.components.yeelight.light.YeelightBaseLight._attr_max_mireds
private

Definition at line 444 of file light.py.

◆ _attr_min_mireds

homeassistant.components.yeelight.light.YeelightBaseLight._attr_min_mireds
private

Definition at line 443 of file light.py.

◆ _attr_should_poll

bool homeassistant.components.yeelight.light.YeelightBaseLight._attr_should_poll = False
staticprivate

Definition at line 426 of file light.py.

◆ _attr_supported_color_modes

dictionary homeassistant.components.yeelight.light.YeelightBaseLight._attr_supported_color_modes = {ColorMode.BRIGHTNESS}
staticprivate

Definition at line 420 of file light.py.

◆ _attr_supported_features

tuple homeassistant.components.yeelight.light.YeelightBaseLight._attr_supported_features
staticprivate
Initial value:
= (
LightEntityFeature.TRANSITION
| LightEntityFeature.FLASH
| LightEntityFeature.EFFECT
)

Definition at line 421 of file light.py.

◆ _color_temp

homeassistant.components.yeelight.light.YeelightBaseLight._color_temp
private

Definition at line 482 of file light.py.

◆ _custom_effects

homeassistant.components.yeelight.light.YeelightBaseLight._custom_effects
private

Definition at line 449 of file light.py.

◆ _effect

homeassistant.components.yeelight.light.YeelightBaseLight._effect
private

Definition at line 440 of file light.py.

◆ _light_type

homeassistant.components.yeelight.light.YeelightBaseLight._light_type
private

Definition at line 446 of file light.py.

◆ _unexpected_state_check

homeassistant.components.yeelight.light.YeelightBaseLight._unexpected_state_check
private

Definition at line 453 of file light.py.

◆ color_mode

homeassistant.components.yeelight.light.YeelightBaseLight.color_mode

Definition at line 641 of file light.py.

◆ color_temp

homeassistant.components.yeelight.light.YeelightBaseLight.color_temp

Definition at line 694 of file light.py.

◆ config

homeassistant.components.yeelight.light.YeelightBaseLight.config

Definition at line 437 of file light.py.

◆ hs_color

homeassistant.components.yeelight.light.YeelightBaseLight.hs_color

Definition at line 642 of file light.py.

◆ rgb_color

homeassistant.components.yeelight.light.YeelightBaseLight.rgb_color

Definition at line 667 of file light.py.


The documentation for this class was generated from the following file: