diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index e0b045ce6..a5a2f8731 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -15,8 +15,10 @@ - MQTT reconnecting after WiFi reconnect [#99](https://github.com/emsesp/EMS-ESP32/issues/99) - Manually Controlling Solar Circuit [#107](https://github.com/emsesp/EMS-ESP32/issues/107) - Fix thermostat commands not defaulting to the master thermostat [#110](https://github.com/emsesp/EMS-ESP32/issues/110) +- enlarge parse-buffer for long names like `cylinderpumpmodulation` ## Changed - Syslog BOM only for utf-8 messages [#91](https://github.com/emsesp/EMS-ESP32/issues/91) - Check for KM200 by device-id 0x48, remove tx-delay[#90](https://github.com/emsesp/EMS-ESP32/issues/90) +- rename `fastheatupfactor` to `fastheatup` and add percent [#122] diff --git a/src/command.cpp b/src/command.cpp index eee042132..03f2a1ecb 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -31,8 +31,8 @@ std::vector Command::cmdfunctions_; // returns 0 if the command errored, 1 (TRUE) if ok, 2 if not found, 3 if error or 4 if not allowed uint8_t Command::call(const uint8_t device_type, const char * cmd, const char * value, bool authenticated, const int8_t id) { int8_t id_new = id; - char cmd_new[20] = {'\0'}; - strlcpy(cmd_new, cmd, 20); + char cmd_new[30] = {'\0'}; + strlcpy(cmd_new, cmd, sizeof(cmd_new)); // find the command auto cf = find_command(device_type, cmd_new, id_new); @@ -64,8 +64,8 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char * // returns 0 if the command errored, 1 (TRUE) if ok, 2 if not found, 3 if error or 4 if not allowed uint8_t Command::call(const uint8_t device_type, const char * cmd, const char * value, bool authenticated, const int8_t id, JsonObject & json) { int8_t id_new = id; - char cmd_new[20] = {'\0'}; - strlcpy(cmd_new, cmd, 20); + char cmd_new[30] = {'\0'}; + strlcpy(cmd_new, cmd, sizeof(cmd_new)); auto cf = find_command(device_type, cmd_new, id_new); @@ -159,7 +159,7 @@ Command::CmdFunction * Command::find_command(const uint8_t device_type, char * c // empty command after processing prefix is info if (cmd[0] == '\0') { - strlcpy(cmd, "info", 20); + strcpy(cmd, "info"); } return find_command(device_type, cmd); @@ -209,7 +209,7 @@ Command::CmdFunction * Command::find_command(const uint8_t device_type, const ch } // convert cmd to lowercase and compare - char lowerCmd[20]; + char lowerCmd[30]; strlcpy(lowerCmd, cmd, sizeof(lowerCmd)); for (char * p = lowerCmd; *p; p++) { *p = tolower(*p); diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 3f39e4c9a..aa408023c 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -909,7 +909,7 @@ void Thermostat::process_RC300Summer(std::shared_ptr telegram) { } has_update(telegram->read_value(hc->minflowtemp, 8)); - has_update(telegram->read_value(hc->fastHeatupFactor, 10)); + has_update(telegram->read_value(hc->fastHeatup, 10)); } // types 0x471 ff @@ -1849,19 +1849,19 @@ bool Thermostat::set_summermode(const char * value, const int8_t id) { } // Set fastheatupfactor, ems+ -bool Thermostat::set_fastheatupfactor(const char * value, const int8_t id) { +bool Thermostat::set_fastheatup(const char * value, const int8_t id) { uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; std::shared_ptr hc = heating_circuit(hc_num); if (hc == nullptr) { - LOG_WARNING(F("Setfast heatup factor: Heating Circuit %d not found or activated for device ID 0x%02X"), hc_num, device_id()); + LOG_WARNING(F("Set fast heatup: Heating Circuit %d not found or activated for device ID 0x%02X"), hc_num, device_id()); return false; } int set = 0; if (!Helpers::value2number(value, set)) { - LOG_WARNING(F("Set fast heatup factor: Invalid value")); + LOG_WARNING(F("Set fast heatup: Invalid value")); return false; } - LOG_INFO(F("Setting fast heatup factor to %d"), set); + LOG_INFO(F("Setting fast heatup to %d%%"), set); write_command(summer_typeids[hc->hc_num() - 1], 10, set, summer_typeids[hc->hc_num() - 1]); return true; } @@ -2625,7 +2625,7 @@ void Thermostat::register_device_values_hc(std::shared_ptrprogram, DeviceValueType::UINT, nullptr, FL_(program), DeviceValueUOM::NONE, MAKE_CF_CB(set_program)); register_device_value(tag, &hc->tempautotemp, DeviceValueType::UINT, FL_(div2), FL_(tempautotemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_tempautotemp)); register_device_value( - tag, &hc->fastHeatupFactor, DeviceValueType::UINT, nullptr, FL_(fastheatupfactor), DeviceValueUOM::NONE, MAKE_CF_CB(set_fastheatupfactor)); + tag, &hc->fastHeatup, DeviceValueType::UINT, nullptr, FL_(fastheatup), DeviceValueUOM::PERCENT, MAKE_CF_CB(set_fastheatup)); break; case EMS_DEVICE_FLAG_CRF: register_device_value(tag, &hc->mode, DeviceValueType::ENUM, FL_(enum_mode5), FL_(mode), DeviceValueUOM::LIST); diff --git a/src/devices/thermostat.h b/src/devices/thermostat.h index 530ea7d8b..2e1bb8120 100644 --- a/src/devices/thermostat.h +++ b/src/devices/thermostat.h @@ -66,7 +66,7 @@ class Thermostat : public EMSdevice { uint8_t party; int8_t noreducetemp; // signed -20°C to +10°C uint8_t wwprio; - uint8_t fastHeatupFactor; + uint8_t fastHeatup; uint8_t hc_num() const { return hc_num_; @@ -346,7 +346,7 @@ class Thermostat : public EMSdevice { bool set_program(const char * value, const int8_t id); bool set_controlmode(const char * value, const int8_t id); bool set_wwprio(const char * value, const int8_t id); - bool set_fastheatupfactor(const char * value, const int8_t id); + bool set_fastheatup(const char * value, const int8_t id); // set functions - these don't use the id/hc, the parameters are ignored bool set_wwmode(const char * value, const int8_t id); diff --git a/src/locale_EN.h b/src/locale_EN.h index 425e6563e..23e365e99 100644 --- a/src/locale_EN.h +++ b/src/locale_EN.h @@ -556,7 +556,7 @@ MAKE_PSTR_LIST(setpoint_roomTemp, F("seltemp"), F("selected room temperature")) MAKE_PSTR_LIST(curr_roomTemp, F("currtemp"), F("current room temperature")) MAKE_PSTR_LIST(mode, F("mode"), F("mode")) MAKE_PSTR_LIST(modetype, F("modetype"), F("mode type")) -MAKE_PSTR_LIST(fastheatupfactor, F("fastheatupfactor"), F("fast heatup factor")) +MAKE_PSTR_LIST(fastheatup, F("fastheatup"), F("fast heatup")) MAKE_PSTR_LIST(daytemp, F("daytemp"), F("day temperature")) MAKE_PSTR_LIST(heattemp, F("heattemp"), F("heat temperature")) MAKE_PSTR_LIST(nighttemp, F("nighttemp"), F("night temperature"))