add thermostat remotetemp

This commit is contained in:
MichaelDvP
2021-04-22 13:51:12 +02:00
parent 7baf5c1d9a
commit 7cabae7ef5
3 changed files with 7 additions and 8 deletions

View File

@@ -427,11 +427,6 @@ void Thermostat::register_mqtt_ha_config_hc(uint8_t hc_num) {
std::string topic2(Mqtt::MQTT_TOPIC_MAX_SIZE, '\0');
snprintf_P(&topic2[0], topic2.capacity() + 1, PSTR("thermostat_hc%d"), hc_num);
register_mqtt_topic(topic2, [=](const char * m) { return thermostat_ha_cmd(m, hc_num); });
char hc_name[10]; // hc{1-4}
strlcpy(hc_name, "hc", 10);
char s[3];
strlcat(hc_name, Helpers::itoa(s, hc_num), 10);
}
// for HA specifically when receiving over MQTT in the thermostat topic
@@ -1142,10 +1137,11 @@ bool Thermostat::set_remotetemp(const char * value, const int8_t id) {
}
if (f > 100 || f < 0) {
Roomctrl::set_remotetemp(hc->hc_num() - 1, EMS_VALUE_SHORT_NOTSET);
hc->remotetemp = EMS_VALUE_SHORT_NOTSET;
} else {
Roomctrl::set_remotetemp(hc->hc_num() - 1, (int16_t)(f * 10));
hc->remotetemp = (int16_t)(f * 10);
}
Roomctrl::set_remotetemp(hc->hc_num() - 1, hc->remotetemp);
return true;
}
@@ -2244,6 +2240,7 @@ void Thermostat::register_device_values_hc(std::shared_ptr<emsesp::Thermostat::H
register_device_value(tag, &hc->party, DeviceValueType::UINT, nullptr, FL_(party), DeviceValueUOM::HOURS, MAKE_CF_CB(set_party));
register_device_value(tag, &hc->tempautotemp, DeviceValueType::UINT, FL_(div2), FL_(tempautotemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_tempautotemp));
register_device_value(tag, &hc->noreducetemp, DeviceValueType::INT, nullptr, FL_(noreducetemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_noreducetemp));
register_device_value(tag, &hc->remotetemp, DeviceValueType::SHORT, FL_(div10), FL_(remotetemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_remotetemp));
break;
case EMS_DEVICE_FLAG_JUNKERS:
register_device_value(tag, &hc->mode, DeviceValueType::ENUM, FL_(enum_mode4), FL_(mode), DeviceValueUOM::NONE, MAKE_CF_CB(set_mode));

View File

@@ -36,7 +36,8 @@ class Thermostat : public EMSdevice {
int16_t setpoint_roomTemp;
int16_t curr_roomTemp;
uint8_t tempautotemp;
int16_t remotetemp; // for readback
uint8_t tempautotemp;
uint8_t mode;
uint8_t modetype;
uint8_t summermode;

View File

@@ -429,6 +429,7 @@ MAKE_PSTR_LIST(holidaymode, F("holidaymode"), F("holiday mode"))
MAKE_PSTR_LIST(flowtempoffset, F("flowtempoffset"), F("flow temperature offset"))
MAKE_PSTR_LIST(reducemode, F("reducemode"), F("reduce mode"))
MAKE_PSTR_LIST(noreducetemp, F("noreducetemp"), F("no reduce below temperature"))
MAKE_PSTR_LIST(remotetemp, F("remotetemp"), F("room temperature from remote"))
// heatpump
MAKE_PSTR_LIST(airHumidity, F("airhumidity"), F("relative air humidity"))