diff --git a/esphome/components/light/light_call.cpp b/esphome/components/light/light_call.cpp index 2d8df62c5a..6d42dd1513 100644 --- a/esphome/components/light/light_call.cpp +++ b/esphome/components/light/light_call.cpp @@ -4,7 +4,6 @@ #include "light_state.h" #include "esphome/core/log.h" #include "esphome/core/optional.h" -#include "esphome/core/progmem.h" namespace esphome::light { @@ -510,7 +509,7 @@ color_mode_bitmask_t LightCall::get_suitable_color_modes_mask_() { } LightCall &LightCall::set_effect(const char *effect, size_t len) { - if (len == 4 && ESPHOME_strncasecmp_P(effect, ESPHOME_PSTR("none"), 4) == 0) { + if (len == 4 && strncasecmp(effect, "none", 4) == 0) { this->set_effect(0); return *this; } diff --git a/esphome/components/light/light_state.h b/esphome/components/light/light_state.h index 13fdd337df..83b9226d03 100644 --- a/esphome/components/light/light_state.h +++ b/esphome/components/light/light_state.h @@ -12,7 +12,6 @@ #include "light_transformer.h" #include "esphome/core/helpers.h" -#include "esphome/core/progmem.h" #include #include @@ -189,20 +188,17 @@ class LightState : public EntityBase, public Component { uint32_t get_current_effect_index() const { return this->active_effect_index_; } /// Get effect index by name. Returns 0 if effect not found. - uint32_t get_effect_index(const char *effect_name) const { - if (ESPHOME_strcasecmp_P(effect_name, ESPHOME_PSTR("none")) == 0) { + uint32_t get_effect_index(const std::string &effect_name) const { + if (str_equals_case_insensitive(effect_name, "none")) { return 0; } for (size_t i = 0; i < this->effects_.size(); i++) { - if (strcasecmp(effect_name, this->effects_[i]->get_name().c_str()) == 0) { + if (str_equals_case_insensitive(effect_name, this->effects_[i]->get_name())) { return i + 1; // Effects are 1-indexed in active_effect_index_ } } return 0; // Effect not found } - uint32_t get_effect_index(const std::string &effect_name) const { - return this->get_effect_index(effect_name.c_str()); - } /// Get effect by index. Returns nullptr if index is invalid. LightEffect *get_effect_by_index(uint32_t index) const {