Skip to main content
The light platform allows integrations to control lighting devices with support for brightness, color, effects, and more.

Base Class

All light entities inherit from LightEntity, which extends ToggleEntity. The class is defined in homeassistant.components.light.

Color Modes

Lights must declare which color modes they support. This is the most important configuration:
Available color modes:
  • ONOFF - Simple on/off
  • BRIGHTNESS - Brightness control only
  • COLOR_TEMP - Color temperature (white spectrum)
  • HS - Hue/Saturation
  • RGB - RGB color
  • RGBW - RGB + White channel
  • RGBWW - RGB + Warm White + Cool White
  • WHITE - White channel brightness
  • XY - CIE 1931 color space

Required Properties

supported_color_modes

Set of color modes the light supports.

color_mode

The current active color mode.

Required Methods

turn_on

Turn the light on with optional parameters.

turn_off

Turn the light off.

Optional Properties

brightness

Current brightness (0-255). Required for brightness-capable lights.

rgb_color

Current RGB color as tuple (r, g, b) where each value is 0-255.

hs_color

Current hue/saturation as tuple (hue, saturation) where hue is 0-360 and saturation is 0-100.

color_temp_kelvin

Current color temperature in Kelvin.

min_color_temp_kelvin / max_color_temp_kelvin

Temperature range for color temperature lights.

effect_list

List of available effects.

effect

Current effect.

supported_features

Additional features beyond color modes.
Available features:
  • EFFECT - Supports effects
  • FLASH - Supports flashing
  • TRANSITION - Supports transition time

Example Implementations

Simple Dimmable Light

RGB Color Light

Color Temperature Light

Light with Effects

Turn On Parameters

The turn_on method can receive these parameters:
  • ATTR_BRIGHTNESS - Brightness (0-255)
  • ATTR_BRIGHTNESS_PCT - Brightness percentage (0-100)
  • ATTR_BRIGHTNESS_STEP - Relative brightness step (-255 to 255)
  • ATTR_BRIGHTNESS_STEP_PCT - Relative brightness step percentage (-100 to 100)
  • ATTR_RGB_COLOR - RGB color tuple (r, g, b)
  • ATTR_RGBW_COLOR - RGBW color tuple (r, g, b, w)
  • ATTR_RGBWW_COLOR - RGBWW color tuple (r, g, b, cw, ww)
  • ATTR_HS_COLOR - Hue/Saturation tuple (hue, saturation)
  • ATTR_XY_COLOR - XY color tuple (x, y)
  • ATTR_COLOR_TEMP_KELVIN - Color temperature in Kelvin
  • ATTR_WHITE - White level (0-255)
  • ATTR_EFFECT - Effect name
  • ATTR_FLASH - Flash (“short” or “long”)
  • ATTR_TRANSITION - Transition time in seconds

Important Notes

  • Always set supported_color_modes - it’s required
  • Set color_mode to the current active mode when the light is on
  • Home Assistant automatically converts between color representations
  • Only implement the properties for your supported color modes
  • Use async_write_ha_state() to update Home Assistant after state changes
  • The light platform handles color conversions automatically

Color Mode Combinations

Valid combinations of color modes:
  • Single mode: {ColorMode.RGB}
  • Multiple modes: {ColorMode.RGB, ColorMode.COLOR_TEMP}
  • The ONOFF and BRIGHTNESS modes are automatically filtered if other modes exist

See Also