From 8884a0d163f39be6d49e317d364015750a9efe41 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 12 Mar 2026 07:52:07 -1000 Subject: [PATCH] [light] Fix ambiguous set_effect overload for const char* When calling set_effect("None") from a lambda, the compiler cannot choose between set_effect(optional) and set_effect(const std::string&) since both require one implicit conversion from const char*. Add explicit const char* overload to resolve the ambiguity. Fixes https://github.com/esphome/esphome/issues/14728 --- esphome/components/light/light_call.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/esphome/components/light/light_call.h b/esphome/components/light/light_call.h index 0926ab6108e..0eb1785239c 100644 --- a/esphome/components/light/light_call.h +++ b/esphome/components/light/light_call.h @@ -130,6 +130,8 @@ class LightCall { LightCall &set_effect(optional effect); /// Set the effect of the light by its name. LightCall &set_effect(const std::string &effect) { return this->set_effect(effect.data(), effect.size()); } + /// Set the effect of the light by its name (const char * overload to resolve ambiguity). + LightCall &set_effect(const char *effect) { return this->set_effect(effect, strlen(effect)); } /// Set the effect of the light by its name and length (zero-copy from API). LightCall &set_effect(const char *effect, size_t len); /// Set the effect of the light by its internal index number (only for internal use).