Fix breaking changes caused by ESPHome 2025.11 (fixes #14)

This commit is contained in:
ElVit
2025-11-24 18:42:51 +01:00
parent cb49d5ea3f
commit 04b6f5c044
3 changed files with 16 additions and 17 deletions
@@ -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;
@@ -4,6 +4,7 @@
#include "../panasonic_heatpump.h"
#include "../decode.h"
#include "../commands.h"
#include <set>
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<climate::ClimateMode> supported_modes_ { climate::CLIMATE_MODE_OFF, climate::CLIMATE_MODE_HEAT };
};
} // namespace panasonic_heatpump
} // namespace esphome
@@ -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;
};