From 7cabae7ef5938d281c1a777b7c51c4a163ed5f8d Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Thu, 22 Apr 2021 13:51:12 +0200 Subject: [PATCH] add thermostat remotetemp --- src/devices/thermostat.cpp | 11 ++++------- src/devices/thermostat.h | 3 ++- src/locale_EN.h | 1 + 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index c8ef17651..718a467ed 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -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_ptrparty, 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)); diff --git a/src/devices/thermostat.h b/src/devices/thermostat.h index 6e4f1778c..b3edfb62f 100644 --- a/src/devices/thermostat.h +++ b/src/devices/thermostat.h @@ -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; diff --git a/src/locale_EN.h b/src/locale_EN.h index 0cd61ebb5..fdbdf607f 100644 --- a/src/locale_EN.h +++ b/src/locale_EN.h @@ -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"))