From e9e6b9ddf9515a7325e9ccae21ade6d4b82fb2e6 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 21 Oct 2025 22:32:36 -1000 Subject: [PATCH] minimize changes --- esphome/components/climate/climate_traits.h | 16 ++++++++-------- esphome/components/gree/gree.cpp | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/esphome/components/climate/climate_traits.h b/esphome/components/climate/climate_traits.h index 8004ba4002..21adf5b99c 100644 --- a/esphome/components/climate/climate_traits.h +++ b/esphome/components/climate/climate_traits.h @@ -141,17 +141,17 @@ class ClimateTraits { void set_supported_modes(std::initializer_list modes) { this->supported_modes_ = ClimateModeMask(modes); } - void add_supported_mode(ClimateMode mode) { this->supported_modes_.add(mode); } - bool supports_mode(ClimateMode mode) const { return this->supported_modes_.contains(mode); } + void add_supported_mode(ClimateMode mode) { this->supported_modes_.insert(mode); } + bool supports_mode(ClimateMode mode) const { return this->supported_modes_.count(mode) > 0; } const ClimateModeMask &get_supported_modes() const { return this->supported_modes_; } void set_supported_fan_modes(ClimateFanModeMask modes) { this->supported_fan_modes_ = modes; } void set_supported_fan_modes(std::initializer_list modes) { this->supported_fan_modes_ = ClimateFanModeMask(modes); } - void add_supported_fan_mode(ClimateFanMode mode) { this->supported_fan_modes_.add(mode); } + void add_supported_fan_mode(ClimateFanMode mode) { this->supported_fan_modes_.insert(mode); } void add_supported_custom_fan_mode(const std::string &mode) { this->supported_custom_fan_modes_.push_back(mode); } - bool supports_fan_mode(ClimateFanMode fan_mode) const { return this->supported_fan_modes_.contains(fan_mode); } + bool supports_fan_mode(ClimateFanMode fan_mode) const { return this->supported_fan_modes_.count(fan_mode) > 0; } bool get_supports_fan_modes() const { return !this->supported_fan_modes_.empty() || !this->supported_custom_fan_modes_.empty(); } @@ -175,9 +175,9 @@ class ClimateTraits { void set_supported_presets(std::initializer_list presets) { this->supported_presets_ = ClimatePresetMask(presets); } - void add_supported_preset(ClimatePreset preset) { this->supported_presets_.add(preset); } + void add_supported_preset(ClimatePreset preset) { this->supported_presets_.insert(preset); } void add_supported_custom_preset(const std::string &preset) { this->supported_custom_presets_.push_back(preset); } - bool supports_preset(ClimatePreset preset) const { return this->supported_presets_.contains(preset); } + bool supports_preset(ClimatePreset preset) const { return this->supported_presets_.count(preset) > 0; } bool get_supports_presets() const { return !this->supported_presets_.empty(); } const ClimatePresetMask &get_supported_presets() const { return this->supported_presets_; } @@ -199,9 +199,9 @@ class ClimateTraits { void set_supported_swing_modes(std::initializer_list modes) { this->supported_swing_modes_ = ClimateSwingModeMask(modes); } - void add_supported_swing_mode(ClimateSwingMode mode) { this->supported_swing_modes_.add(mode); } + void add_supported_swing_mode(ClimateSwingMode mode) { this->supported_swing_modes_.insert(mode); } bool supports_swing_mode(ClimateSwingMode swing_mode) const { - return this->supported_swing_modes_.contains(swing_mode); + return this->supported_swing_modes_.count(swing_mode) > 0; } bool get_supports_swing_modes() const { return !this->supported_swing_modes_.empty(); } const ClimateSwingModeMask &get_supported_swing_modes() const { return this->supported_swing_modes_; } diff --git a/esphome/components/gree/gree.cpp b/esphome/components/gree/gree.cpp index 90c5042d69..e0cacb4f1e 100644 --- a/esphome/components/gree/gree.cpp +++ b/esphome/components/gree/gree.cpp @@ -8,9 +8,9 @@ static const char *const TAG = "gree.climate"; void GreeClimate::set_model(Model model) { if (model == GREE_YX1FF) { - this->fan_modes_.add(climate::CLIMATE_FAN_QUIET); // YX1FF 4 speed - this->presets_.add(climate::CLIMATE_PRESET_NONE); // YX1FF sleep mode - this->presets_.add(climate::CLIMATE_PRESET_SLEEP); // YX1FF sleep mode + this->fan_modes_.insert(climate::CLIMATE_FAN_QUIET); // YX1FF 4 speed + this->presets_.insert(climate::CLIMATE_PRESET_NONE); // YX1FF sleep mode + this->presets_.insert(climate::CLIMATE_PRESET_SLEEP); // YX1FF sleep mode } this->model_ = model;