Naive auto mode action support

This commit is contained in:
Phil Genera 2020-06-06 09:40:54 -04:00
parent 7e91b6bdae
commit 7a9ad85414

View File

@ -108,11 +108,13 @@ void MitsubishiHeatPump::control(const climate::ClimateCall &call) {
case climate::CLIMATE_MODE_COOL: case climate::CLIMATE_MODE_COOL:
hp->setModeSetting("COOL"); hp->setModeSetting("COOL");
hp->setPowerSetting("ON"); hp->setPowerSetting("ON");
this->action = climate::CLIMATE_ACTION_IDLE;
updated = true; updated = true;
break; break;
case climate::CLIMATE_MODE_HEAT: case climate::CLIMATE_MODE_HEAT:
hp->setModeSetting("HEAT"); hp->setModeSetting("HEAT");
hp->setPowerSetting("ON"); hp->setPowerSetting("ON");
this->action = climate::CLIMATE_ACTION_IDLE;
updated = true; updated = true;
break; break;
case climate::CLIMATE_MODE_DRY: case climate::CLIMATE_MODE_DRY:
@ -124,6 +126,7 @@ void MitsubishiHeatPump::control(const climate::ClimateCall &call) {
case climate::CLIMATE_MODE_AUTO: case climate::CLIMATE_MODE_AUTO:
hp->setModeSetting("AUTO"); hp->setModeSetting("AUTO");
hp->setPowerSetting("ON"); hp->setPowerSetting("ON");
this->action = climate::CLIMATE_ACTION_IDLE;
updated = true; updated = true;
break; break;
case climate::CLIMATE_MODE_FAN_ONLY: case climate::CLIMATE_MODE_FAN_ONLY:
@ -241,16 +244,19 @@ void MitsubishiHeatPump::hpSettingsChanged() {
if (strcmp(currentSettings.power, "ON") == 0) { if (strcmp(currentSettings.power, "ON") == 0) {
if (strcmp(currentSettings.mode, "HEAT") == 0) { if (strcmp(currentSettings.mode, "HEAT") == 0) {
this->mode = climate::CLIMATE_MODE_HEAT; this->mode = climate::CLIMATE_MODE_HEAT;
this->action = climate::CLIMATE_ACTION_IDLE;
} else if (strcmp(currentSettings.mode, "DRY") == 0) { } else if (strcmp(currentSettings.mode, "DRY") == 0) {
this->mode = climate::CLIMATE_MODE_DRY; this->mode = climate::CLIMATE_MODE_DRY;
this->action = climate::CLIMATE_ACTION_DRYING; this->action = climate::CLIMATE_ACTION_DRYING;
} else if (strcmp(currentSettings.mode, "COOL") == 0) { } else if (strcmp(currentSettings.mode, "COOL") == 0) {
this->mode = climate::CLIMATE_MODE_COOL; this->mode = climate::CLIMATE_MODE_COOL;
this->action = climate::CLIMATE_ACTION_IDLE;
} else if (strcmp(currentSettings.mode, "FAN") == 0) { } else if (strcmp(currentSettings.mode, "FAN") == 0) {
this->mode = climate::CLIMATE_MODE_FAN_ONLY; this->mode = climate::CLIMATE_MODE_FAN_ONLY;
this->action = climate::CLIMATE_ACTION_FAN; this->action = climate::CLIMATE_ACTION_FAN;
} else if (strcmp(currentSettings.mode, "AUTO") == 0) { } else if (strcmp(currentSettings.mode, "AUTO") == 0) {
this->mode = climate::CLIMATE_MODE_AUTO; this->mode = climate::CLIMATE_MODE_AUTO;
this->action = climate::CLIMATE_ACTION_IDLE;
} else { } else {
ESP_LOGW( ESP_LOGW(
TAG, TAG,
@ -334,6 +340,16 @@ void MitsubishiHeatPump::hpStatusChanged(heatpumpStatus currentStatus) {
this->action = climate::CLIMATE_ACTION_IDLE; this->action = climate::CLIMATE_ACTION_IDLE;
} }
break; break;
case climate::CLIMATE_MODE_AUTO:
this->action = climate::CLIMATE_ACTION_IDLE;
if (currentStatus.operating) {
if (this->current_temperature > this->target_temperature) {
this->action = climate::CLIMATE_ACTION_COOLING;
} else if (this->current_temperature < this->target_temperature) {
this->action = climate::CLIMATE_ACTION_HEATING;
}
}
break;
case climate::CLIMATE_MODE_DRY: case climate::CLIMATE_MODE_DRY:
if (currentStatus.operating) { if (currentStatus.operating) {
this->action = climate::CLIMATE_ACTION_DRYING; this->action = climate::CLIMATE_ACTION_DRYING;