Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.esphome.light Namespace Reference

Classes

class  EsphomeLight
 

Functions

str _color_mode_to_ha (int mode)
 
tuple[int,...] _filter_color_modes (list[int] supported, LightColorCapability features)
 
int _least_complex_color_mode (tuple[int,...] color_modes)
 
int _mired_to_kelvin (float mired_temperature)
 

Variables

dictionary _COLOR_MODE_MAPPING
 
 async_setup_entry
 
dictionary FLASH_LENGTHS = {FLASH_SHORT: 2, FLASH_LONG: 10}
 

Detailed Description

Support for ESPHome lights.

Function Documentation

◆ _color_mode_to_ha()

str homeassistant.components.esphome.light._color_mode_to_ha ( int  mode)
private
Convert an esphome color mode to a HA color mode constant.

Choses the color mode that best matches the feature-set.

Definition at line 106 of file light.py.

◆ _filter_color_modes()

tuple[int, ...] homeassistant.components.esphome.light._filter_color_modes ( list[int]  supported,
LightColorCapability   features 
)
private
Filter the given supported color modes.

Excluding all values that don't have the requested features.

Definition at line 130 of file light.py.

◆ _least_complex_color_mode()

int homeassistant.components.esphome.light._least_complex_color_mode ( tuple[int, ...]  color_modes)
private
Return the color mode with the least complexity.

Definition at line 144 of file light.py.

◆ _mired_to_kelvin()

int homeassistant.components.esphome.light._mired_to_kelvin ( float  mired_temperature)
private
Convert absolute mired shift to degrees kelvin.

This function rounds the converted value instead of flooring the value as
is done in homeassistant.util.color.color_temperature_mired_to_kelvin().

If the value of mired_temperature is less than or equal to zero, return
the original value to avoid a divide by zero.

Definition at line 91 of file light.py.

Variable Documentation

◆ _COLOR_MODE_MAPPING

dictionary homeassistant.components.esphome.light._COLOR_MODE_MAPPING
private

Definition at line 44 of file light.py.

◆ async_setup_entry

homeassistant.components.esphome.light.async_setup_entry
Initial value:
1 = partial(
2  platform_async_setup_entry,
3  info_type=LightInfo,
4  entity_type=EsphomeLight,
5  state_type=LightState,
6 )

Definition at line 424 of file light.py.

◆ FLASH_LENGTHS

dictionary homeassistant.components.esphome.light.FLASH_LENGTHS = {FLASH_SHORT: 2, FLASH_LONG: 10}

Definition at line 41 of file light.py.