From 348125e625a74ae620286463fb8f9561e2b0159a Mon Sep 17 00:00:00 2001 From: Dominik Date: Tue, 20 Jul 2021 09:59:57 +0200 Subject: [PATCH] Change deprecated ESPHome climate functions --- esppac.cpp | 54 +++++++++++++++++++++++++++++++++++------------------- esppac.h | 2 +- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/esppac.cpp b/esppac.cpp index 7af863a..2d11128 100644 --- a/esppac.cpp +++ b/esppac.cpp @@ -10,30 +10,46 @@ climate::ClimateTraits PanasonicAC::traits() auto traits = climate::ClimateTraits(); traits.set_supports_action(true); + traits.set_supports_current_temperature(true); - traits.set_supports_heat_cool_mode(true); - traits.set_supports_cool_mode(true); - traits.set_supports_heat_mode(true); - traits.set_supports_dry_mode(true); - traits.set_supports_fan_only_mode(true); traits.set_supports_two_point_target_temperature(false); - traits.set_supports_away(false); traits.set_visual_min_temperature(ESPPAC_MIN_TEMPERATURE); traits.set_visual_max_temperature(ESPPAC_MAX_TEMPERATURE); traits.set_visual_temperature_step(ESPPAC_TEMPERATURE_STEP); - traits.set_supports_fan_mode_on(false); - traits.set_supports_fan_mode_off(false); - traits.set_supports_fan_mode_auto(true); - traits.set_supports_fan_mode_focus(true); - traits.set_supports_fan_mode_diffuse(true); - traits.set_supports_fan_mode_low(true); - traits.set_supports_fan_mode_medium(true); - traits.set_supports_fan_mode_middle(true); - traits.set_supports_fan_mode_high(true); - traits.set_supports_swing_mode_off(true); - traits.set_supports_swing_mode_both(true); - traits.set_supports_swing_mode_vertical(true); - traits.set_supports_swing_mode_horizontal(true); + + traits.set_supported_modes( + { + climate::CLIMATE_MODE_OFF, + climate::CLIMATE_MODE_HEAT_COOL, + climate::CLIMATE_MODE_COOL, + climate::CLIMATE_MODE_HEAT, + climate::CLIMATE_MODE_FAN_ONLY, + climate::CLIMATE_MODE_DRY + }); + + traits.set_supported_fan_modes( + { + climate::CLIMATE_FAN_AUTO, + climate::CLIMATE_FAN_LOW, + climate::CLIMATE_FAN_MEDIUM, + climate::CLIMATE_FAN_HIGH, + climate::CLIMATE_FAN_MIDDLE, + climate::CLIMATE_FAN_FOCUS + }); + + traits.set_supported_swing_modes( + { + climate::CLIMATE_SWING_OFF, + climate::CLIMATE_SWING_BOTH, + climate::CLIMATE_SWING_VERTICAL, + climate::CLIMATE_SWING_HORIZONTAL + }); + + traits.set_supported_presets( + { + climate::CLIMATE_PRESET_BOOST, // Powerful + climate::CLIMATE_PRESET_ECO // Quiet + }); return traits; } diff --git a/esppac.h b/esppac.h index 33eee58..44e4964 100644 --- a/esppac.h +++ b/esppac.h @@ -2,7 +2,7 @@ using namespace esphome; -static const char* ESPPAC_VERSION = "1.1.0"; +static const char* ESPPAC_VERSION = "1.2.0"; static const char* TAG = "esppac"; static const byte ESPPAC_HEADER = 0x5A; // The header of the protocol, every packet starts with this