From 0a86254b8444ccd4804d699476bfa610fda4b150 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 30 Oct 2025 20:32:28 -0500 Subject: [PATCH] simplify --- esphome/components/climate/climate.cpp | 4 ---- esphome/components/climate/climate.h | 4 ---- esphome/components/thermostat/thermostat_climate.cpp | 4 ++-- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/esphome/components/climate/climate.cpp b/esphome/components/climate/climate.cpp index 07c75fada7..ebc9e466e0 100644 --- a/esphome/components/climate/climate.cpp +++ b/esphome/components/climate/climate.cpp @@ -640,8 +640,6 @@ bool Climate::set_custom_fan_mode_(const char *mode) { this->has_custom_fan_mode()); } -bool Climate::set_custom_fan_mode_(const std::string &mode) { return this->set_custom_fan_mode_(mode.c_str()); } - void Climate::clear_custom_fan_mode_() { this->custom_fan_mode_ = nullptr; } bool Climate::set_preset_(ClimatePreset preset) { return set_primary_mode(this->preset, this->custom_preset_, preset); } @@ -652,8 +650,6 @@ bool Climate::set_custom_preset_(const char *preset) { this->has_custom_preset()); } -bool Climate::set_custom_preset_(const std::string &preset) { return this->set_custom_preset_(preset.c_str()); } - void Climate::clear_custom_preset_() { this->custom_preset_ = nullptr; } const char *Climate::find_custom_fan_mode_(const char *custom_fan_mode) { diff --git a/esphome/components/climate/climate.h b/esphome/components/climate/climate.h index 8e2bd67995..c36625b2ae 100644 --- a/esphome/components/climate/climate.h +++ b/esphome/components/climate/climate.h @@ -272,8 +272,6 @@ class Climate : public EntityBase { /// Set custom fan mode. Reset primary fan mode. Return true if fan mode has been changed. bool set_custom_fan_mode_(const char *mode); - /// Set custom fan mode. Reset primary fan mode. Return true if fan mode has been changed. - bool set_custom_fan_mode_(const std::string &mode); /// Clear custom fan mode. void clear_custom_fan_mode_(); @@ -282,8 +280,6 @@ class Climate : public EntityBase { /// Set custom preset. Reset primary preset. Return true if preset has been changed. bool set_custom_preset_(const char *preset); - /// Set custom preset. Reset primary preset. Return true if preset has been changed. - bool set_custom_preset_(const std::string &preset); /// Clear custom preset. void clear_custom_preset_(); diff --git a/esphome/components/thermostat/thermostat_climate.cpp b/esphome/components/thermostat/thermostat_climate.cpp index 2c8e3e4d9a..5e52c4721e 100644 --- a/esphome/components/thermostat/thermostat_climate.cpp +++ b/esphome/components/thermostat/thermostat_climate.cpp @@ -224,7 +224,7 @@ void ThermostatClimate::control(const climate::ClimateCall &call) { this->change_custom_preset_(call.get_custom_preset().value()); } else { // Use the base class method which handles pointer lookup internally - this->set_custom_preset_(call.get_custom_preset().value()); + this->set_custom_preset_(call.get_custom_preset().value().c_str()); } } @@ -1189,7 +1189,7 @@ void ThermostatClimate::change_custom_preset_(const std::string &custom_preset) // Fire any preset changed trigger if defined Trigger<> *trig = this->preset_change_trigger_; // Use the base class method which handles pointer lookup and preset reset internally - this->set_custom_preset_(custom_preset); + this->set_custom_preset_(custom_preset.c_str()); if (trig != nullptr) { trig->trigger(); }