Rewrite to something a bit more compact
This commit is contained in:
parent
198dc5c052
commit
3b66056d75
21
espmhp.cpp
21
espmhp.cpp
@ -206,6 +206,7 @@ void MitsubishiHeatPump::control(const climate::ClimateCall &call) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ESP_LOGD(TAG, "control - Was HeatPump updated? %s", YESNO(updated));
|
ESP_LOGD(TAG, "control - Was HeatPump updated? %s", YESNO(updated));
|
||||||
|
|
||||||
// send the update back to esphome:
|
// send the update back to esphome:
|
||||||
this->publish_state();
|
this->publish_state();
|
||||||
// and the heat pump:
|
// and the heat pump:
|
||||||
@ -305,14 +306,18 @@ void MitsubishiHeatPump::hpSettingsChanged() {
|
|||||||
* Compute running state from mode & temperatures
|
* Compute running state from mode & temperatures
|
||||||
*/
|
*/
|
||||||
this->action = climate::CLIMATE_ACTION_OFF;
|
this->action = climate::CLIMATE_ACTION_OFF;
|
||||||
if (this->mode == climate::CLIMATE_MODE_HEAT) {
|
switch (this->mode) {
|
||||||
if (this->current_temperature < this->target_temperature) {
|
case climate::CLIMATE_MODE_HEAT:
|
||||||
this->action = climate::CLIMATE_ACTION_HEATING;
|
if (this->current_temperature < this->target_temperature) {
|
||||||
}
|
this->action = climate::CLIMATE_ACTION_HEATING;
|
||||||
} else if(this->mode == climate::CLIMATE_MODE_COOL) {
|
}
|
||||||
if (this->current_temperature > this->target_temperature) {
|
break;
|
||||||
this->action = climate::CLIMATE_ACTION_COOLING;
|
case climate::CLIMATE_MODE_COOL:
|
||||||
}
|
case climate::CLIMATE_MODE_DRY:
|
||||||
|
if (this->current_temperature > this->target_temperature) {
|
||||||
|
this->action = climate::CLIMATE_ACTION_COOLING;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user