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.
This commit is contained in:
Otamay 2021-02-25 15:26:19 -06:00 committed by GitHub
parent 3d0310d0e0
commit 92b36720b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -139,24 +139,24 @@ bool LgIrClimate::on_receive(remote_base::RemoteReceiveData data) {
} else { } else {
this->mode = climate::CLIMATE_MODE_COOL; this->mode = climate::CLIMATE_MODE_COOL;
} }
}
// Temperature // Temperature
if (this->mode == climate::CLIMATE_MODE_COOL) if (this->mode == climate::CLIMATE_MODE_COOL)
this->target_temperature = ((remote_state & TEMP_MASK) >> TEMP_SHIFT) + 15; this->target_temperature = ((remote_state & TEMP_MASK) >> TEMP_SHIFT) + 15;
// Fan Speed // Fan Speed
if (this->mode == climate::CLIMATE_MODE_AUTO) { 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)
this->fan_mode = climate::CLIMATE_FAN_AUTO; this->fan_mode = climate::CLIMATE_FAN_AUTO;
else if ((remote_state & FAN_MASK) == FAN_MIN) } else if (this->mode == climate::CLIMATE_MODE_COOL || this->mode == climate::CLIMATE_MODE_DRY) {
this->fan_mode = climate::CLIMATE_FAN_LOW; if ((remote_state & FAN_MASK) == FAN_AUTO)
else if ((remote_state & FAN_MASK) == FAN_MED) this->fan_mode = climate::CLIMATE_FAN_AUTO;
this->fan_mode = climate::CLIMATE_FAN_MEDIUM; else if ((remote_state & FAN_MASK) == FAN_MIN)
else if ((remote_state & FAN_MASK) == FAN_MAX) this->fan_mode = climate::CLIMATE_FAN_LOW;
this->fan_mode = climate::CLIMATE_FAN_HIGH; 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(); this->publish_state();