From a5c9849aad986e65d6fa3fe598de1f589b56861d Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Thu, 11 Mar 2021 11:59:43 +0100 Subject: [PATCH] add wwflowtempoffset, add cascaded boilers without values --- src/devices/boiler.cpp | 63 +++++++++++++++++++++++++++++++++++--- src/devices/boiler.h | 3 ++ src/devices/thermostat.cpp | 4 ++- src/emsdevice.h | 4 ++- src/emsesp.cpp | 5 +-- 5 files changed, 70 insertions(+), 9 deletions(-) diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 5e8f7d576..1f9be4039 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -28,6 +28,24 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { LOG_DEBUG(F("Adding new Boiler with device ID 0x%02X"), device_id); + // cascaded heatingsources, add some values with new tags later + if (device_id != EMSdevice::EMS_DEVICE_ID_BOILER) { + // uint8_t hs = device_id - EMSdevice::EMS_DEVICE_ID_BOILER_1; // heating source number + // Runtime of each heatingsource in 6DC, ff + // register_telegram_type(0x6DC + hs, F("CascadeMessage"), false, [&](std::shared_ptr t) { process_CascadeMessage(t); }); + // selBurnpower in D2 and E4 + // register_telegram_type(0xD2, F("CascadePowerMessage"), false, [&](std::shared_ptr t) { process_CascadePowerMessage(t); }); + // idividual Flowtemps and powervalues for each heatingsource in E4 + // register_telegram_type(0xE4, F("UBAMonitorFastPlus"), false, [&](std::shared_ptr t) { process_UBAMonitorFastPlus(t); }); + + // register_device_value(TAG_HS1 + hs, &selFlowTemp_, DeviceValueType::UINT, nullptr, F("selFlowTemp"), F("selected flow temperature"), DeviceValueUOM::DEGREES); + // register_device_value(TAG_HS1 + hs, &selBurnPow_, DeviceValueType::UINT, nullptr, F("selBurnPow"), F("burner selected max power"), DeviceValueUOM::PERCENT); + // register_device_value(TAG_HS1 + hs, &curFlowTemp_, DeviceValueType::USHORT, FL_(div10), F("curFlowTemp"), F("current flow temperature"), DeviceValueUOM::DEGREES); + // register_device_value(TAG_HS1 + hs, &curBurnPow_, DeviceValueType::UINT, nullptr, F("curBurnPow"), F("burner current power"), DeviceValueUOM::PERCENT); + return; + } + // register values for master boiler/cascade module + reserve_telgram_functions(25); // reserve some space for the telegram registries, to avoid memory fragmentation // the telegram handlers... @@ -67,6 +85,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const register_mqtt_cmd(F("comfort"), [&](const char * value, const int8_t id) { return set_warmwater_mode(value, id); }); register_mqtt_cmd(F("wwactivated"), [&](const char * value, const int8_t id) { return set_warmwater_activated(value, id); }); register_mqtt_cmd(F("wwtapactivated"), [&](const char * value, const int8_t id) { return set_tapwarmwater_activated(value, id); }); + register_mqtt_cmd(F("wwflowtempoffset"), [&](const char * value, const int8_t id) { return set_wWFlowTempOffset(value, id); }); register_mqtt_cmd(F("wwonetime"), [&](const char * value, const int8_t id) { return set_warmwater_onetime(value, id); }); register_mqtt_cmd(F("wwcircpump"), [&](const char * value, const int8_t id) { return set_warmwater_circulation_pump(value, id); }); register_mqtt_cmd(F("wwcirculation"), [&](const char * value, const int8_t id) { return set_warmwater_circulation(value, id); }); @@ -140,6 +159,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const register_device_value(TAG_BOILER_DATA_WW, &wWSetTemp_, DeviceValueType::UINT, nullptr, F("wWSetTemp"), F("set temperature"), DeviceValueUOM::DEGREES); register_device_value(TAG_BOILER_DATA_WW, &wWType_, DeviceValueType::ENUM, FL_(enum_flow), F("wWType"), F("type")); register_device_value(TAG_BOILER_DATA_WW, &wWComfort_, DeviceValueType::ENUM, FL_(enum_comfort), F("wWComfort"), F("comfort")); + register_device_value(TAG_BOILER_DATA_WW, &wWFlowTempOffset_, DeviceValueType::UINT, nullptr, F("wWFlowTempOffset"), F("flow offset temperature")); register_device_value(TAG_BOILER_DATA_WW, &wWCircPump_, DeviceValueType::BOOL, nullptr, F("wWCircPump"), F("circulation pump available")); register_device_value(TAG_BOILER_DATA_WW, &wWChargeType_, DeviceValueType::BOOL, FL_(enum_charge), F("wWChargeType"), F("charging type")); register_device_value(TAG_BOILER_DATA_WW, &wWDisinfectionTemp_, DeviceValueType::UINT, nullptr, F("wWDisinfectionTemp"), F("disinfection temperature"), DeviceValueUOM::DEGREES); @@ -267,6 +287,7 @@ void Boiler::process_UBAParameterWW(std::shared_ptr telegram) { 10)); // 0 = charge pump, 0xff = 3-way valve has_update(telegram->read_value(wWSelTemp_, 2)); has_update(telegram->read_value(wWDisinfectionTemp_, 8)); + has_update(telegram->read_value(wWFlowTempOffset_, 5)); telegram->read_value(wWComfort_, 9); if (wWComfort_ == 0x00) { @@ -331,7 +352,8 @@ void Boiler::process_UBATotalUptime(std::shared_ptr telegram) { /* * UBAParameters - type 0x16 - */ + * data: FF 5A 64 00 0A FA 0F 02 06 64 64 02 08 F8 0F 0F 0F 0F 1E 05 04 09 09 00 28 00 3C +*/ void Boiler::process_UBAParameters(std::shared_ptr telegram) { has_update(telegram->read_value(heatingActivated_, 0)); has_update(telegram->read_value(heatingTemp_, 1)); @@ -460,7 +482,11 @@ void Boiler::process_UBAMonitorSlowPlus(std::shared_ptr telegram /* * UBAParametersPlus - type 0xe6 + * parameters originaly taken from + * https://github.com/Th3M3/buderus_ems-wiki/blob/master/Einstellungen%20des%20Regelger%C3%A4ts%20MC110.md * 88 0B E6 00 01 46 00 00 46 0A 00 01 06 FA 0A 01 02 64 01 00 00 1E 00 3C 01 00 00 00 01 00 9A + * from: issue #732 + * data: 01 50 1E 5A 46 12 64 00 06 FA 3C 03 05 64 00 00 00 28 00 41 03 00 00 00 00 00 00 00 00 00 */ void Boiler::process_UBAParametersPlus(std::shared_ptr telegram) { has_update(telegram->read_value(heatingActivated_, 0)); @@ -470,8 +496,10 @@ 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 + // has_update(telegram->read_value(pumpType_, 11)); // guess, RC300 manual: powercontroled, pressurcontrolled 1-4? + // has_update(telegram->read_value(pumpDelay_, 12)); // guess + // has_update(telegram->read_value(pumpModMax_, 13)); // guess + // has_update(telegram->read_value(pumpModMin_, 14)); // guess } // 0xEA @@ -575,6 +603,17 @@ void Boiler::process_UBASetPoints(std::shared_ptr telegram) { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" + +// 0x6DC, ff for cascaded heatsources (hs) +// not implemented yet, see #739 +void Boiler::process_CascadeMessage(std::shared_ptr telegram) { + uint8_t hs = telegram->dest - EMSdevice::EMS_DEVICE_ID_BOILER_1; + // uint8_t hsActivated; + // uint32_t hsRuntime; + // has_update(telegram->read_value(hsActivated, 0)); + // has_update(telegram->read_value(hsRuntime, 3)); +} + // 0x35 - not yet implemented void Boiler::process_UBAFlags(std::shared_ptr telegram) { } @@ -667,6 +706,20 @@ bool Boiler::set_warmwater_temp(const char * value, const int8_t id) { return true; } +// Set the warm water flow temperature offset 0x33 +bool Boiler::set_wWFlowTempOffset(const char * value, const int8_t id) { + int v = 0; + if (!Helpers::value2number(value, v)) { + LOG_WARNING(F("Set boiler warm water flow temperature offset: Invalid value")); + return false; + } + + LOG_INFO(F("Setting boiler warm water flow temperature offset to %d C"), v); + write_command(EMS_TYPE_UBAParameterWW, 5, v, EMS_TYPE_UBAParameterWW); + + return true; +} + // flow temp bool Boiler::set_flow_temp(const char * value, const int8_t id) { int v = 0; @@ -684,7 +737,7 @@ bool Boiler::set_flow_temp(const char * value, const int8_t id) { return true; } -// set min boiler output +// set heating activated bool Boiler::set_heating_activated(const char * value, const int8_t id) { bool v = false; if (!Helpers::value2bool(value, v)) { @@ -738,7 +791,7 @@ bool Boiler::set_min_power(const char * value, const int8_t id) { return true; } -// set max temp +// set max boiler output bool Boiler::set_max_power(const char * value, const int8_t id) { int v = 0; if (!Helpers::value2number(value, v)) { diff --git a/src/devices/boiler.h b/src/devices/boiler.h index f9f748477..be061cce3 100644 --- a/src/devices/boiler.h +++ b/src/devices/boiler.h @@ -72,6 +72,7 @@ class Boiler : public EMSdevice { uint8_t wWActive_; // uint8_t wWHeat_; // 3-way valve on WW uint8_t wWSetPumpPower_; // ww pump speed/power? + uint8_t wWFlowTempOffset_; // Boiler offset for ww heating uint32_t wWStarts_; // Warm Water # starts uint32_t wWStarts2_; // Warm water starts (control) uint32_t wWWorkM_; // Warm Water # minutes @@ -165,6 +166,7 @@ class Boiler : public EMSdevice { void process_UBADHWStatus(std::shared_ptr telegram); void process_UBAInformation(std::shared_ptr telegram); void process_UBAEnergySupplied(std::shared_ptr telegram); + void process_CascadeMessage(std::shared_ptr telegram); // commands - none of these use the additional id parameter bool set_warmwater_mode(const char * value, const int8_t id); @@ -175,6 +177,7 @@ class Boiler : public EMSdevice { bool set_warmwater_circulation_pump(const char * value, const int8_t id); bool set_warmwater_circulation_mode(const char * value, const int8_t id); bool set_warmwater_temp(const char * value, const int8_t id); + bool set_wWFlowTempOffset(const char * value, const int8_t id); bool set_flow_temp(const char * value, const int8_t id); bool set_heating_activated(const char * value, const int8_t id); bool set_heating_temp(const char * value, const int8_t id); diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index ec1e0a31f..682e8a12f 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -831,6 +831,7 @@ void Thermostat::process_RC300WWtemp(std::shared_ptr telegram) { } // type 02F5 +// RC300WWmode(0x2F5), data: 01 FF 04 00 00 00 08 05 00 08 04 00 00 00 00 00 00 00 00 00 01 void Thermostat::process_RC300WWmode(std::shared_ptr telegram) { // circulation pump see: https://github.com/Th3M3/buderus_ems-wiki/blob/master/Einstellungen%20der%20Bedieneinheit%20RC310.md has_update(telegram->read_value(wwCircPump_, 1)); // FF=off, 0=on ? @@ -840,6 +841,7 @@ void Thermostat::process_RC300WWmode(std::shared_ptr telegram) { } // types 0x31D and 0x31E +// RC300WWmode2(0x31D), data: 00 00 09 07 void Thermostat::process_RC300WWmode2(std::shared_ptr telegram) { // 0x31D for WW system 1, 0x31E for WW system 2 // pos 1 = holiday mode @@ -2080,7 +2082,7 @@ void Thermostat::register_device_values() { DeviceValueUOM::DEGREES); // min ext temp for heating curve, in deg. register_device_value(TAG_THERMOSTAT_DATA, &tempsensor1_, DeviceValueType::USHORT, FL_(div10), F("inttemp1"), F("temperature sensor 1"), DeviceValueUOM::DEGREES); register_device_value(TAG_THERMOSTAT_DATA, &tempsensor2_, DeviceValueType::USHORT, FL_(div10), F("inttemp2"), F("temperature sensor 2"), DeviceValueUOM::DEGREES); - register_device_value(TAG_THERMOSTAT_DATA, &dampedoutdoortemp_, DeviceValueType::INT, nullptr, F("dampedtemp"), F("damped outdoor temperature"), DeviceValueUOM::DEGREES); + register_device_value(TAG_THERMOSTAT_DATA, &dampedoutdoortemp_, DeviceValueType::INT, nullptr, F("dampedoutdoortemp"), F("damped outdoor temperature"), DeviceValueUOM::DEGREES); register_device_value(TAG_THERMOSTAT_DATA, &ibaBuildingType_, DeviceValueType::ENUM, FL_(enum_ibaBuildingType2), F("building"), F("building")); register_device_value(TAG_THERMOSTAT_DATA, &wwMode_, DeviceValueType::ENUM, FL_(enum_wwMode2), F("wwmode"), F("warm water mode")); register_device_value(TAG_THERMOSTAT_DATA, &wwCircMode_, DeviceValueType::ENUM, FL_(enum_wwCircMode2), F("wwcircmode"), F("warm water circulation mode")); diff --git a/src/emsdevice.h b/src/emsdevice.h index 73eee205c..0e2f8abc3 100644 --- a/src/emsdevice.h +++ b/src/emsdevice.h @@ -282,7 +282,9 @@ class EMSdevice { }; // static device IDs - static constexpr uint8_t EMS_DEVICE_ID_BOILER = 0x08; // fixed device_id for Master Boiler/UBA + static constexpr uint8_t EMS_DEVICE_ID_BOILER = 0x08; // fixed device_id for Master Boiler/UBA + static constexpr uint8_t EMS_DEVICE_ID_BOILER_1 = 0x70; // fixed device_id for 1st. Cascade Boiler/UBA + static constexpr uint8_t EMS_DEVICE_ID_BOILER_F = 0x7F; // fixed device_id for last Cascade Boiler/UBA // generic type IDs static constexpr uint16_t EMS_TYPE_VERSION = 0x02; // type ID for Version information. Generic across all EMS devices. diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 024c23f77..b3fd75890 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -878,7 +878,8 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, std:: // sometimes boilers share the same product id as controllers // so only add boilers if the device_id is 0x08, which is fixed for EMS if (device.device_type == DeviceType::BOILER) { - if (device_id == EMSdevice::EMS_DEVICE_ID_BOILER) { + if (device_id == EMSdevice::EMS_DEVICE_ID_BOILER || + (device_id >= EMSdevice::EMS_DEVICE_ID_BOILER_1 && device_id <= EMSdevice::EMS_DEVICE_ID_BOILER_F)) { device_p = &device; break; } @@ -932,7 +933,7 @@ bool EMSESP::command_info(uint8_t device_type, JsonObject & json, const int8_t i for (const auto & emsdevice : emsdevices) { if (emsdevice && (emsdevice->device_type() == device_type) && ((device_type != DeviceType::THERMOSTAT) || (emsdevice->device_id() == EMSESP::actual_master_thermostat()))) { - has_value |= emsdevice->generate_values_json(json, tag, (id == -1), true); // console & nested + has_value |= emsdevice->generate_values_json(json, tag, true, (id == -1)); // nested, console as default } }