From d6841ba33a754f2cb9be6dd08deb15ac6f813839 Mon Sep 17 00:00:00 2001 From: Keith Burzinski Date: Fri, 23 Jan 2026 18:53:20 -0600 Subject: [PATCH] [light] Fix cwww state restore (#13493) --- esphome/components/light/light_call.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/esphome/components/light/light_call.cpp b/esphome/components/light/light_call.cpp index 234d641f0d..6d42dd1513 100644 --- a/esphome/components/light/light_call.cpp +++ b/esphome/components/light/light_call.cpp @@ -391,7 +391,10 @@ void LightCall::transform_parameters_() { min_mireds > 0.0f && max_mireds > 0.0f) { ESP_LOGD(TAG, "'%s': setting cold/warm white channels using white/color temperature values", this->parent_->get_name().c_str()); - if (this->has_color_temperature()) { + // Only compute cold_white/warm_white from color_temperature if they're not already explicitly set. + // This is important for state restoration, where both color_temperature and cold_white/warm_white + // are restored from flash - we want to preserve the saved cold_white/warm_white values. + if (this->has_color_temperature() && !this->has_cold_white() && !this->has_warm_white()) { const float color_temp = clamp(this->color_temperature_, min_mireds, max_mireds); const float range = max_mireds - min_mireds; const float ww_fraction = (color_temp - min_mireds) / range;