Skip to content

Commit

Permalink
Change deprecated ESPHome climate functions
Browse files Browse the repository at this point in the history
  • Loading branch information
DomiStyle committed Jul 20, 2021
1 parent 5a0cf3d commit 348125e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 20 deletions.
54 changes: 35 additions & 19 deletions esppac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion esppac.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 348125e

Please sign in to comment.