From 92b36720b69d76df290aa3d8f4a25829ae9e50d3 Mon Sep 17 00:00:00 2001 From: Otamay Date: Thu, 25 Feb 2021 15:26:19 -0600 Subject: [PATCH] Climate IR LG -keep previous temp and fan if swing (#1556) Swing IR command does not carry CLIMATE_FAN or TEMP within itself, so previous states sould be kept. Tested with actual LG IR remote controller. --- .../climate_ir_lg/climate_ir_lg.cpp | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/esphome/components/climate_ir_lg/climate_ir_lg.cpp b/esphome/components/climate_ir_lg/climate_ir_lg.cpp index da4aaba9da..c80f82ae39 100644 --- a/esphome/components/climate_ir_lg/climate_ir_lg.cpp +++ b/esphome/components/climate_ir_lg/climate_ir_lg.cpp @@ -139,24 +139,24 @@ bool LgIrClimate::on_receive(remote_base::RemoteReceiveData data) { } else { this->mode = climate::CLIMATE_MODE_COOL; } - } - // Temperature - if (this->mode == climate::CLIMATE_MODE_COOL) - this->target_temperature = ((remote_state & TEMP_MASK) >> TEMP_SHIFT) + 15; + // Temperature + if (this->mode == climate::CLIMATE_MODE_COOL) + this->target_temperature = ((remote_state & TEMP_MASK) >> TEMP_SHIFT) + 15; - // Fan Speed - if (this->mode == climate::CLIMATE_MODE_AUTO) { - this->fan_mode = climate::CLIMATE_FAN_AUTO; - } else if (this->mode == climate::CLIMATE_MODE_COOL || this->mode == climate::CLIMATE_MODE_DRY) { - if ((remote_state & FAN_MASK) == FAN_AUTO) + // Fan Speed + if (this->mode == climate::CLIMATE_MODE_AUTO) { this->fan_mode = climate::CLIMATE_FAN_AUTO; - else if ((remote_state & FAN_MASK) == FAN_MIN) - this->fan_mode = climate::CLIMATE_FAN_LOW; - else if ((remote_state & FAN_MASK) == FAN_MED) - this->fan_mode = climate::CLIMATE_FAN_MEDIUM; - else if ((remote_state & FAN_MASK) == FAN_MAX) - this->fan_mode = climate::CLIMATE_FAN_HIGH; + } else if (this->mode == climate::CLIMATE_MODE_COOL || this->mode == climate::CLIMATE_MODE_DRY) { + if ((remote_state & FAN_MASK) == FAN_AUTO) + this->fan_mode = climate::CLIMATE_FAN_AUTO; + else if ((remote_state & FAN_MASK) == FAN_MIN) + this->fan_mode = climate::CLIMATE_FAN_LOW; + else if ((remote_state & FAN_MASK) == FAN_MED) + this->fan_mode = climate::CLIMATE_FAN_MEDIUM; + else if ((remote_state & FAN_MASK) == FAN_MAX) + this->fan_mode = climate::CLIMATE_FAN_HIGH; + } } this->publish_state();