From 3bbd4ef66f3a6aad04e023d32803647779e8caec Mon Sep 17 00:00:00 2001 From: proddy Date: Wed, 16 Dec 2020 18:30:31 +0100 Subject: [PATCH] merge in https://github.com/proddy/EMS-ESP/commit/0e26e6712657e3311a8f7bd68850e011ecfd8b09 --- CHANGELOG_LATEST.md | 2 +- src/devices/boiler.cpp | 46 +++++++++++++++++++++++++++++++++++--- src/devices/boiler.h | 2 ++ src/devices/thermostat.cpp | 10 ++++----- src/emsesp.cpp | 18 ++++++++++++--- 5 files changed, 66 insertions(+), 12 deletions(-) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 2b554e696..ce0b38d97 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -10,7 +10,7 @@ - Add solar configuration telegrams (#616) [thanks @hpanther] - `log trace` shows decoded telegrams, `watch unknown` for only unknown telegrams - WM10 switch telegrams -- boiler information (#633) +- boiler information (#633), pumpmod min/max commands - maintenance message and command - thermostat program, reducemode, controlmode diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 2b94449dc..153ff3c1b 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -82,6 +82,8 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const register_mqtt_cmd(F("pumpdelay"), [&](const char * value, const int8_t id) { return set_pump_delay(value, id); }); // register_mqtt_cmd(F("reset"), [&](const char * value, const int8_t id) { return set_reset(value, id); }); register_mqtt_cmd(F("maintenance"), [&](const char * value, const int8_t id) { return set_maintenance(value, id); }); + register_mqtt_cmd(F("pumpmodmax"), [&](const char * value, const int8_t id) { return set_max_pump(value, id); }); + register_mqtt_cmd(F("pumpmodmin"), [&](const char * value, const int8_t id) { return set_min_pump(value, id); }); System::show_mem("after mqtt cmd reg"); // TODO remove debug @@ -743,6 +745,8 @@ void Boiler::process_UBAParametersPlus(std::shared_ptr telegram) has_update(telegram->read_value(boilHystOff_, 8)); has_update(telegram->read_value(boilHystOn_, 9)); has_update(telegram->read_value(burnMinPeriod_, 10)); + // changed_ |= telegram->read_value(pumpModMax_, 13); // guess + // changed_ |= telegram->read_value(pumpModMin_, 14); // guess } // 0xEA @@ -973,7 +977,7 @@ bool Boiler::set_heating_temp(const char * value, const int8_t id) { return false; } - LOG_INFO(F("Setting boiler heating temperature to "), v); + LOG_INFO(F("Setting boiler heating temperature to %d C"), v); if (get_toggle_fetch(EMS_TYPE_UBAParametersPlus)) { write_command(EMS_TYPE_UBAParametersPlus, 1, v, EMS_TYPE_UBAParametersPlus); } else { @@ -991,7 +995,7 @@ bool Boiler::set_min_power(const char * value, const int8_t id) { return false; } - LOG_INFO(F("Setting boiler min power to "), v); + LOG_INFO(F("Setting boiler min power to %d %%"), v); if (get_toggle_fetch(EMS_TYPE_UBAParametersPlus)) { write_command(EMS_TYPE_UBAParametersPlus, 7, v, EMS_TYPE_UBAParametersPlus); } else { @@ -1009,7 +1013,7 @@ bool Boiler::set_max_power(const char * value, const int8_t id) { return false; } - LOG_INFO(F("Setting boiler max power to %d C"), v); + LOG_INFO(F("Setting boiler max power to %d %%"), v); if (get_toggle_fetch(EMS_TYPE_UBAParametersPlus)) { write_command(EMS_TYPE_UBAParametersPlus, 6, v, EMS_TYPE_UBAParametersPlus); } else { @@ -1019,6 +1023,42 @@ bool Boiler::set_max_power(const char * value, const int8_t id) { return true; } +// set min pump modulation +bool Boiler::set_min_pump(const char * value, const int8_t id) { + int v = 0; + if (!Helpers::value2number(value, v)) { + LOG_WARNING(F("Set pump min: Invalid value")); + return false; + } + + LOG_INFO(F("Setting pump min to %d %%"), v); + if (get_toggle_fetch(EMS_TYPE_UBAParametersPlus)) { + write_command(EMS_TYPE_UBAParametersPlus, 14, v, EMS_TYPE_UBAParametersPlus); + } else { + write_command(EMS_TYPE_UBAParameters, 10, v, EMS_TYPE_UBAParameters); + } + + return true; +} + +// set max pump modulation +bool Boiler::set_max_pump(const char * value, const int8_t id) { + int v = 0; + if (!Helpers::value2number(value, v)) { + LOG_WARNING(F("Set pump max: Invalid value")); + return false; + } + + LOG_INFO(F("Setting pump max to %d %%"), v); + if (get_toggle_fetch(EMS_TYPE_UBAParametersPlus)) { + write_command(EMS_TYPE_UBAParametersPlus, 13, v, EMS_TYPE_UBAParametersPlus); + } else { + write_command(EMS_TYPE_UBAParameters, 9, v, EMS_TYPE_UBAParameters); + } + + return true; +} + // set boiler on hysteresis bool Boiler::set_hyst_on(const char * value, const int8_t id) { int v = 0; diff --git a/src/devices/boiler.h b/src/devices/boiler.h index 45d40788c..9b816e040 100644 --- a/src/devices/boiler.h +++ b/src/devices/boiler.h @@ -189,6 +189,8 @@ class Boiler : public EMSdevice { bool set_heating_temp(const char * value, const int8_t id); bool set_min_power(const char * value, const int8_t id); bool set_max_power(const char * value, const int8_t id); + bool set_min_pump(const char * value, const int8_t id); + bool set_max_pump(const char * value, const int8_t id); bool set_hyst_on(const char * value, const int8_t id); bool set_hyst_off(const char * value, const int8_t id); bool set_burn_period(const char * value, const int8_t id); diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 203ab784c..9989d6960 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -1043,7 +1043,7 @@ bool Thermostat::set_calinttemp(const char * value, const int8_t id) { return false; } - LOG_INFO(F("Calibrating internal temperature to %d.%d"), ct / 10, ct < 0 ? -ct % 10 : ct % 10); + LOG_INFO(F("Calibrating internal temperature to %d.%d C"), ct / 10, ct < 0 ? -ct % 10 : ct % 10); write_command(EMS_TYPE_IBASettings, 2, ct, EMS_TYPE_IBASettings); return true; @@ -1120,8 +1120,8 @@ bool Thermostat::set_language(const char * value, const int8_t id) { // Set the control-mode for hc 0-off, 1-RC20, 2-RC3x bool Thermostat::set_control(const char * value, const int8_t id) { - int ctrl = 0; - if (!Helpers::value2number(value, ctrl)) { + uint8_t ctrl = 0; + if (!Helpers::value2enum(value, ctrl, {F("off"), F("rc20"), F("rc3x")})) { LOG_WARNING(F("Set control: Invalid value")); return false; } @@ -1167,7 +1167,7 @@ bool Thermostat::set_wwtemp(const char * value, const int8_t id) { LOG_WARNING(F("Set warm water high temperature: Invalid value")); return false; } - LOG_INFO(F("Setting warm water high temperature to %d"), t); + LOG_INFO(F("Setting warm water high temperature to %d C"), t); write_command(0x031B, 0, t, 0x031B); return true; } @@ -1179,7 +1179,7 @@ bool Thermostat::set_wwtemplow(const char * value, const int8_t id) { LOG_WARNING(F("Set warm water low temperature: Invalid value")); return false; } - LOG_INFO(F("Setting warm water low temperature to %d"), t); + LOG_INFO(F("Setting warm water low temperature to %d C"), t); write_command(0x031B, 1, t, 0x031B); return true; } diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 1e2be73ca..ff9d7e2ab 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -112,17 +112,29 @@ void EMSESP::scan_devices() { */ uint8_t EMSESP::check_master_device(const uint8_t device_id, const uint16_t type_id, const bool read) { if (actual_master_thermostat_ == 0x18) { - uint16_t mon_id[4] = {0x02A5, 0x02A6, 0x02A7, 0x02A8}; - uint16_t set_id[4] = {0x02B9, 0x02BA, 0x02BB, 0x02BC}; + uint16_t mon_ids[4] = {0x02A5, 0x02A6, 0x02A7, 0x02A8}; + uint16_t set_ids[4] = {0x02B9, 0x02BA, 0x02BB, 0x02BC}; + uint16_t summer_ids[4] = {0x02AF, 0x02B0, 0x02B1, 0x02B2}; + uint16_t curve_ids[4] = {0x029B, 0x029C, 0x029D, 0x029E}; + uint16_t master_ids[] = {0x02F5, 0x031B, 0x031D, 0x031E, 0x023A, 0x0267, 0x0240}; + // look for heating circuits for (uint8_t i = 0; i < 4; i++) { - if (type_id == mon_id[i] || type_id == set_id[i]) { + if (type_id == mon_ids[i] || type_id == set_ids[i] || type_id == summer_ids[i] || type_id == curve_ids[i]) { if (read) { + // receiving telegrams and map all to master thermostat at 0x18 (src manipulated) return 0x18; } else { + // sending telegrams to the individual thermostats (dst manipulated) return 0x18 + i; } } } + // look for ids that are only handled by master + for (uint8_t i = 0; i < sizeof(master_ids); i++) { + if (type_id == master_ids[i]) { + return 0x18; + } + } } return device_id;