fastheatup as percent-value, enlarge parse-buffer #122

This commit is contained in:
MichaelDvP
2021-09-21 08:04:11 +02:00
parent 769301c804
commit fcc2c0b3de
5 changed files with 17 additions and 15 deletions

View File

@@ -15,8 +15,10 @@
- MQTT reconnecting after WiFi reconnect [#99](https://github.com/emsesp/EMS-ESP32/issues/99) - 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) - 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) - 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 ## Changed
- Syslog BOM only for utf-8 messages [#91](https://github.com/emsesp/EMS-ESP32/issues/91) - 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) - 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]

View File

@@ -31,8 +31,8 @@ std::vector<Command::CmdFunction> Command::cmdfunctions_;
// returns 0 if the command errored, 1 (TRUE) if ok, 2 if not found, 3 if error or 4 if not allowed // 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) { 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; int8_t id_new = id;
char cmd_new[20] = {'\0'}; char cmd_new[30] = {'\0'};
strlcpy(cmd_new, cmd, 20); strlcpy(cmd_new, cmd, sizeof(cmd_new));
// find the command // find the command
auto cf = find_command(device_type, cmd_new, id_new); 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 // 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) { 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; int8_t id_new = id;
char cmd_new[20] = {'\0'}; char cmd_new[30] = {'\0'};
strlcpy(cmd_new, cmd, 20); strlcpy(cmd_new, cmd, sizeof(cmd_new));
auto cf = find_command(device_type, cmd_new, id_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 // empty command after processing prefix is info
if (cmd[0] == '\0') { if (cmd[0] == '\0') {
strlcpy(cmd, "info", 20); strcpy(cmd, "info");
} }
return find_command(device_type, cmd); 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 // convert cmd to lowercase and compare
char lowerCmd[20]; char lowerCmd[30];
strlcpy(lowerCmd, cmd, sizeof(lowerCmd)); strlcpy(lowerCmd, cmd, sizeof(lowerCmd));
for (char * p = lowerCmd; *p; p++) { for (char * p = lowerCmd; *p; p++) {
*p = tolower(*p); *p = tolower(*p);

View File

@@ -909,7 +909,7 @@ void Thermostat::process_RC300Summer(std::shared_ptr<const Telegram> telegram) {
} }
has_update(telegram->read_value(hc->minflowtemp, 8)); 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 // types 0x471 ff
@@ -1849,19 +1849,19 @@ bool Thermostat::set_summermode(const char * value, const int8_t id) {
} }
// Set fastheatupfactor, ems+ // 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; uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id;
std::shared_ptr<Thermostat::HeatingCircuit> hc = heating_circuit(hc_num); std::shared_ptr<Thermostat::HeatingCircuit> hc = heating_circuit(hc_num);
if (hc == nullptr) { 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; return false;
} }
int set = 0; int set = 0;
if (!Helpers::value2number(value, set)) { if (!Helpers::value2number(value, set)) {
LOG_WARNING(F("Set fast heatup factor: Invalid value")); LOG_WARNING(F("Set fast heatup: Invalid value"));
return false; 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]); write_command(summer_typeids[hc->hc_num() - 1], 10, set, summer_typeids[hc->hc_num() - 1]);
return true; return true;
} }
@@ -2625,7 +2625,7 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
register_device_value(tag, &hc->program, DeviceValueType::UINT, nullptr, FL_(program), DeviceValueUOM::NONE, MAKE_CF_CB(set_program)); register_device_value(tag, &hc->program, 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->tempautotemp, DeviceValueType::UINT, FL_(div2), FL_(tempautotemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_tempautotemp));
register_device_value( 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; break;
case EMS_DEVICE_FLAG_CRF: case EMS_DEVICE_FLAG_CRF:
register_device_value(tag, &hc->mode, DeviceValueType::ENUM, FL_(enum_mode5), FL_(mode), DeviceValueUOM::LIST); register_device_value(tag, &hc->mode, DeviceValueType::ENUM, FL_(enum_mode5), FL_(mode), DeviceValueUOM::LIST);

View File

@@ -66,7 +66,7 @@ class Thermostat : public EMSdevice {
uint8_t party; uint8_t party;
int8_t noreducetemp; // signed -20°C to +10°C int8_t noreducetemp; // signed -20°C to +10°C
uint8_t wwprio; uint8_t wwprio;
uint8_t fastHeatupFactor; uint8_t fastHeatup;
uint8_t hc_num() const { uint8_t hc_num() const {
return hc_num_; return hc_num_;
@@ -346,7 +346,7 @@ class Thermostat : public EMSdevice {
bool set_program(const char * value, const int8_t id); bool set_program(const char * value, const int8_t id);
bool set_controlmode(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_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 // set functions - these don't use the id/hc, the parameters are ignored
bool set_wwmode(const char * value, const int8_t id); bool set_wwmode(const char * value, const int8_t id);

View File

@@ -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(curr_roomTemp, F("currtemp"), F("current room temperature"))
MAKE_PSTR_LIST(mode, F("mode"), F("mode")) MAKE_PSTR_LIST(mode, F("mode"), F("mode"))
MAKE_PSTR_LIST(modetype, F("modetype"), F("mode type")) 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(daytemp, F("daytemp"), F("day temperature"))
MAKE_PSTR_LIST(heattemp, F("heattemp"), F("heat temperature")) MAKE_PSTR_LIST(heattemp, F("heattemp"), F("heat temperature"))
MAKE_PSTR_LIST(nighttemp, F("nighttemp"), F("night temperature")) MAKE_PSTR_LIST(nighttemp, F("nighttemp"), F("night temperature"))