From ed6ebe10f99549a05459978b8f932ed2f187a994 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 25 Feb 2026 15:33:36 -0700 Subject: [PATCH] Use ESPHOME_strncasecmp_P for "none" check to keep string in flash --- esphome/components/light/light_state.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/esphome/components/light/light_state.h b/esphome/components/light/light_state.h index beeae436da1..b2c7ab3a94e 100644 --- a/esphome/components/light/light_state.h +++ b/esphome/components/light/light_state.h @@ -12,6 +12,7 @@ #include "light_transformer.h" #include "esphome/core/helpers.h" +#include "esphome/core/progmem.h" #include #include @@ -202,10 +203,10 @@ class LightState : public EntityBase, public Component { /// Get effect index by name (const char* overload, avoids std::string construction). uint32_t get_effect_index(const char *name, size_t len) const { - StringRef ref(name, len); - if (str_equals_case_insensitive(ref, StringRef("none", 4))) { + if (len == 4 && ESPHOME_strncasecmp_P(name, ESPHOME_PSTR("none"), 4) == 0) { return 0; } + StringRef ref(name, len); for (size_t i = 0; i < this->effects_.size(); i++) { if (str_equals_case_insensitive(ref, this->effects_[i]->get_name())) { return i + 1;