Drop unnecessary COLOR_MODES lookup — codegen handles EStr correctly

This commit is contained in:
J. Nick Koston
2026-03-23 21:27:53 -10:00
parent 91b0b0dd70
commit 0bbc022311
+1 -6
View File
@@ -52,7 +52,6 @@ from .effects import (
validate_effects,
)
from .types import ( # noqa
COLOR_MODES,
AddressableLight,
AddressableLightState,
ColorMode,
@@ -265,12 +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).
# Map config string to C++ enum; defaults to UNKNOWN if not specified
color_mode_expr = COLOR_MODES.get(
initial_state_config.get(CONF_COLOR_MODE), 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),