mirror of
https://github.com/esphome/esphome.git
synced 2026-09-20 11:38:48 +00:00
Merge remote-tracking branch 'upstream/light-initial-state-callback' into integration
This commit is contained in:
@@ -52,7 +52,6 @@ from .effects import (
|
||||
validate_effects,
|
||||
)
|
||||
from .types import ( # noqa
|
||||
COLOR_MODES,
|
||||
AddressableLight,
|
||||
AddressableLightState,
|
||||
ColorMode,
|
||||
@@ -265,10 +264,8 @@ async def setup_light_core_(light_var, config, output_var):
|
||||
if (initial_state_config := config.get(CONF_INITIAL_STATE)) is not None:
|
||||
# Emit a stateless lambda that constructs the initial state — values live
|
||||
# in flash as code, not stored in the LightState object (~40 bytes saved).
|
||||
color_mode_str = initial_state_config.get(CONF_COLOR_MODE)
|
||||
color_mode_expr = COLOR_MODES.get(color_mode_str, ColorMode.UNKNOWN)
|
||||
initial_state = LightStateRTCState(
|
||||
color_mode_expr,
|
||||
initial_state_config.get(CONF_COLOR_MODE, ColorMode.UNKNOWN),
|
||||
initial_state_config.get(CONF_STATE, False),
|
||||
initial_state_config.get(CONF_BRIGHTNESS, 1.0),
|
||||
initial_state_config.get(CONF_COLOR_BRIGHTNESS, 1.0),
|
||||
|
||||
Reference in New Issue
Block a user