mirror of
https://github.com/esphome/esphome.git
synced 2025-10-31 23:21:54 +00:00
simplify
This commit is contained in:
@@ -640,8 +640,6 @@ bool Climate::set_custom_fan_mode_(const char *mode) {
|
|||||||
this->has_custom_fan_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; }
|
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); }
|
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());
|
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; }
|
void Climate::clear_custom_preset_() { this->custom_preset_ = nullptr; }
|
||||||
|
|
||||||
const char *Climate::find_custom_fan_mode_(const char *custom_fan_mode) {
|
const char *Climate::find_custom_fan_mode_(const char *custom_fan_mode) {
|
||||||
|
|||||||
@@ -272,8 +272,6 @@ class Climate : public EntityBase {
|
|||||||
|
|
||||||
/// Set custom fan mode. Reset primary fan mode. Return true if fan mode has been changed.
|
/// Set custom fan mode. Reset primary fan mode. Return true if fan mode has been changed.
|
||||||
bool set_custom_fan_mode_(const char *mode);
|
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.
|
/// Clear custom fan mode.
|
||||||
void 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.
|
/// Set custom preset. Reset primary preset. Return true if preset has been changed.
|
||||||
bool set_custom_preset_(const char *preset);
|
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.
|
/// Clear custom preset.
|
||||||
void clear_custom_preset_();
|
void clear_custom_preset_();
|
||||||
|
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ void ThermostatClimate::control(const climate::ClimateCall &call) {
|
|||||||
this->change_custom_preset_(call.get_custom_preset().value());
|
this->change_custom_preset_(call.get_custom_preset().value());
|
||||||
} else {
|
} else {
|
||||||
// Use the base class method which handles pointer lookup internally
|
// 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
|
// Fire any preset changed trigger if defined
|
||||||
Trigger<> *trig = this->preset_change_trigger_;
|
Trigger<> *trig = this->preset_change_trigger_;
|
||||||
// Use the base class method which handles pointer lookup and preset reset internally
|
// 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) {
|
if (trig != nullptr) {
|
||||||
trig->trigger();
|
trig->trigger();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user