From 04b6f5c044b174a3ea8a2837a4d4f64d2c37a73c Mon Sep 17 00:00:00 2001 From: ElVit Date: Mon, 24 Nov 2025 18:42:51 +0100 Subject: [PATCH] Fix breaking changes caused by ESPHome 2025.11 (fixes #14) --- .../climate/panasonic_heatpump_climate.cpp | 17 ++++++++--------- .../climate/panasonic_heatpump_climate.h | 2 +- .../select/panasonic_heatpump_select.cpp | 14 +++++++------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/components/panasonic_heatpump/climate/panasonic_heatpump_climate.cpp b/components/panasonic_heatpump/climate/panasonic_heatpump_climate.cpp index 0a04bfb..8ef3958 100644 --- a/components/panasonic_heatpump/climate/panasonic_heatpump_climate.cpp +++ b/components/panasonic_heatpump/climate/panasonic_heatpump_climate.cpp @@ -18,17 +18,16 @@ namespace esphome auto traits = climate::ClimateTraits(); //traits.set_supports_action(true); - traits.set_supports_current_temperature(true); + traits.add_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_TEMPERATURE); + traits.set_supported_modes({climate::CLIMATE_MODE_OFF, climate::CLIMATE_MODE_HEAT}); if (this->cool_mode_ && (this->id_ == ClimateIds::CONF_CLIMATE_ZONE1 || this->id_ == ClimateIds::CONF_CLIMATE_ZONE2)) { - traits.set_supports_two_point_target_temperature(true); - this->supported_modes_.insert(climate::CLIMATE_MODE_COOL); - this->supported_modes_.insert(climate::CLIMATE_MODE_AUTO); + traits.add_feature_flags(climate::CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE); + traits.add_supported_mode(climate::CLIMATE_MODE_COOL); + traits.add_supported_mode(climate::CLIMATE_MODE_AUTO); } - - traits.set_supported_modes(this->supported_modes_); traits.set_visual_min_temperature(this->min_temperature_); traits.set_visual_max_temperature(this->max_temperature_); traits.set_visual_temperature_step(this->temperature_step_); @@ -132,11 +131,11 @@ namespace esphome default: return; }; - if (!this->get_traits().get_supports_two_point_target_temperature() && + if (!this->get_traits().has_feature_flags(climate::CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE) && this->mode == new_mode && this->target_temperature == new_target_temp_heat && this->current_temperature == new_current_temp) return; - if (this->get_traits().get_supports_two_point_target_temperature() && + if (this->get_traits().has_feature_flags(climate::CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE) && this->mode == new_mode && this->target_temperature_high == new_target_temp_heat && this->target_temperature_low == new_target_temp_cool && @@ -144,7 +143,7 @@ namespace esphome if (new_mode != 255) this->mode = (climate::ClimateMode)new_mode; //this->action = climate::CLIMATE_ACTION_IDLE; - if (this->get_traits().get_supports_two_point_target_temperature()) + if (this->get_traits().has_feature_flags(climate::CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE)) { this->target_temperature_high = new_target_temp_heat; this->target_temperature_low = new_target_temp_cool; diff --git a/components/panasonic_heatpump/climate/panasonic_heatpump_climate.h b/components/panasonic_heatpump/climate/panasonic_heatpump_climate.h index 4c11d90..10edc20 100644 --- a/components/panasonic_heatpump/climate/panasonic_heatpump_climate.h +++ b/components/panasonic_heatpump/climate/panasonic_heatpump_climate.h @@ -4,6 +4,7 @@ #include "../panasonic_heatpump.h" #include "../decode.h" #include "../commands.h" +#include namespace esphome @@ -40,7 +41,6 @@ namespace esphome float min_temperature_ { -5.0 }; float max_temperature_ { 5.0 }; float temperature_step_ { 0.5 }; - std::set supported_modes_ { climate::CLIMATE_MODE_OFF, climate::CLIMATE_MODE_HEAT }; }; } // namespace panasonic_heatpump } // namespace esphome diff --git a/components/panasonic_heatpump/select/panasonic_heatpump_select.cpp b/components/panasonic_heatpump/select/panasonic_heatpump_select.cpp index fa8a0c1..002a148 100644 --- a/components/panasonic_heatpump/select/panasonic_heatpump_select.cpp +++ b/components/panasonic_heatpump/select/panasonic_heatpump_select.cpp @@ -63,31 +63,31 @@ namespace esphome { case SelectIds::CONF_SET9: new_state = PanasonicDecode::getTextState(PanasonicDecode::OperationMode, PanasonicDecode::getOperationMode(data[6])); - if (this->has_state() && this->state == new_state) return; + if (this->has_state() && this->current_option() == new_state) return; break; case SelectIds::CONF_SET4: new_state = PanasonicDecode::getTextState(PanasonicDecode::PowerfulMode, PanasonicDecode::getBit6and7and8(data[7])); - if (this->has_state() && this->state == new_state) return; + if (this->has_state() && this->current_option() == new_state) return; break; case SelectIds::CONF_SET3: new_state = PanasonicDecode::getTextState(PanasonicDecode::QuietMode, PanasonicDecode::getBit3and4and5(data[7])); - if (this->has_state() && this->state == new_state) return; + if (this->has_state() && this->current_option() == new_state) return; break; case SelectIds::CONF_SET2: new_state = PanasonicDecode::getTextState(PanasonicDecode::HolidayState, PanasonicDecode::getBit3and4(data[5])); - if (this->has_state() && this->state == new_state) return; + if (this->has_state() && this->current_option() == new_state) return; break; case SelectIds::CONF_SET17: new_state = PanasonicDecode::getTextState(PanasonicDecode::ZoneState, PanasonicDecode::getBit1and2(data[6])); - if (this->has_state() && this->state == new_state) return; + if (this->has_state() && this->current_option() == new_state) return; break; case SelectIds::CONF_SET26: new_state = PanasonicDecode::getTextState(PanasonicDecode::ExtPadHeaterType, PanasonicDecode::getBit3and4(data[25])); - if (this->has_state() && this->state == new_state) return; + if (this->has_state() && this->current_option() == new_state) return; break; case SelectIds::CONF_SET35: new_state = PanasonicDecode::getTextState(PanasonicDecode::BivalentMode, PanasonicDecode::getBit5and6(data[26])); - if (this->has_state() && this->state == new_state) return; + if (this->has_state() && this->current_option() == new_state) return; break; default: return; };