From 4009a1a25c18f1d211465e320fb1c09c7ac3ce80 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Mon, 11 Apr 2022 10:20:40 +0200 Subject: [PATCH] b12, cleanup, formatting, small fixes --- CHANGELOG_LATEST.md | 3 ++- src/devices/boiler.cpp | 26 +++++++++++++++++++------- src/devices/boiler.h | 14 +++++++------- src/devices/mixer.cpp | 9 +++++++-- src/devices/thermostat.cpp | 28 ++++++++++++++++++++-------- src/devices/thermostat.h | 30 +++++++++++++++--------------- src/emsdevice.cpp | 2 +- src/mqtt.cpp | 4 ++++ src/version.h | 2 +- 9 files changed, 76 insertions(+), 42 deletions(-) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 88faa8b08..bd71d324d 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -33,7 +33,8 @@ - Extend customization to select if an entity is to be shown in the WebUI or forced as read-only [#317](https://github.com/emsesp/EMS-ESP32/issues/317) - Added Moduline 400 installation parameters [PR #449 by @kwertie01](https://github.com/emsesp/EMS-ESP32/pull/449) - Read time from IVT-controller [#439](https://github.com/emsesp/EMS-ESP32/issues/439) -- Hybrid Heatpump product-id 168 [#459](https://github.com/emsesp/EMS-ESP32/issues/459) +- Hybrid Heatpump product-id 168 [#459](https://github.com/emsesp/EMS-ESP32/issues/459), thermostat settings +- Junkers ISM2 and IPM in warm water mode [#437](https://github.com/emsesp/EMS-ESP32/issues/437) ### Fixed diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 8d2a8d226..ccfa5a507 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -215,46 +215,58 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const MAKE_CF_CB(set_hybridStrategy)); register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &switchOverTemp_, - DeviceValueType::UINT, + DeviceValueType::INT, nullptr, FL_(switchOverTemp), DeviceValueUOM::DEGREES, - MAKE_CF_CB(set_switchOverTemp)); + MAKE_CF_CB(set_switchOverTemp), + -20, + 20); register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &energyCostRatio_, DeviceValueType::UINT, FL_(div10), FL_(energyCostRatio), DeviceValueUOM::NONE, - MAKE_CF_CB(set_energyCostRatio)); + MAKE_CF_CB(set_energyCostRatio), + 0, + 19.9); register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &fossileFactor_, DeviceValueType::UINT, FL_(div10), FL_(fossileFactor), DeviceValueUOM::NONE, - MAKE_CF_CB(set_fossileFactor)); + MAKE_CF_CB(set_fossileFactor), + 0, + 5); register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &electricFactor_, DeviceValueType::UINT, FL_(div10), FL_(electricFactor), DeviceValueUOM::NONE, - MAKE_CF_CB(set_electricFactor)); + MAKE_CF_CB(set_electricFactor), + 0, + 5); register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &delayBoiler_, DeviceValueType::UINT, nullptr, FL_(delayBoiler), DeviceValueUOM::MINUTES, - MAKE_CF_CB(set_delayBoiler)); + MAKE_CF_CB(set_delayBoiler), + 5, + 120); register_device_value(DeviceValueTAG::TAG_BOILER_DATA, &tempDiffBoiler_, DeviceValueType::UINT, nullptr, FL_(tempDiffBoiler), DeviceValueUOM::DEGREES_R, - MAKE_CF_CB(set_tempDiffBoiler)); + MAKE_CF_CB(set_tempDiffBoiler), + 1, + 99); } */ // heatpump info diff --git a/src/devices/boiler.h b/src/devices/boiler.h index 7247f273b..d1365f1f7 100644 --- a/src/devices/boiler.h +++ b/src/devices/boiler.h @@ -128,7 +128,7 @@ class Boiler : public EMSdevice { uint32_t burn2WorkMin_; // burner stage 2 operating time uint32_t heatWorkMin_; // Total heat operating time uint32_t UBAuptime_; // Total UBA working hours - char lastCode_[75]; // last error code + char lastCode_[50]; // last error code char serviceCode_[4]; // 3 character status/service code uint16_t serviceCodeNumber_; // error/service code @@ -195,13 +195,13 @@ class Boiler : public EMSdevice { /* // HybridHP - uint8_t hybridStrategy_; // cost = 2, temperature = 3, mix = 4 - uint8_t switchOverTemp_; // degrees - uint8_t energyCostRatio_; // is *10 - uint8_t fossileFactor_; // is * 10 - uint8_t electricFactor_; // is * 10 + uint8_t hybridStrategy_; // cost = 2, temperature = 3, mix = 4 + int8_t switchOverTemp_; // degrees + uint8_t energyCostRatio_; // is *10 + uint8_t fossileFactor_; // is * 10 + uint8_t electricFactor_; // is * 10 uint8_t delayBoiler_; // minutes - uint8_t tempDiffBoiler_; // relative temperature degrees + uint8_t tempDiffBoiler_; // relative temperature degrees */ void process_UBAParameterWW(std::shared_ptr telegram); diff --git a/src/devices/mixer.cpp b/src/devices/mixer.cpp index 8a8f0e614..3db9cdfb7 100644 --- a/src/devices/mixer.cpp +++ b/src/devices/mixer.cpp @@ -110,6 +110,7 @@ Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c register_device_value(tag, &wwCurTemp_1_, DeviceValueType::USHORT, FL_(div10), FL_(wwCurTemp), DeviceValueUOM::DEGREES); register_device_value(tag, &wwCurTemp_2_, DeviceValueType::USHORT, FL_(div10), FL_(wwCurTemp2), DeviceValueUOM::DEGREES); register_device_value(tag, &HydrTemp_, DeviceValueType::USHORT, FL_(div10), FL_(hydrTemp), DeviceValueUOM::DEGREES); + register_device_value(tag, &pumpStatus_, DeviceValueType::BOOL, nullptr, FL_(pumpStatus), DeviceValueUOM::NONE, MAKE_CF_CB(set_pump)); } else { register_telegram_type(0x010C, F("IPMStatusMessage"), false, MAKE_PF_CB(process_IPMStatusMessage)); register_telegram_type(0x011E, F("IPMTempMessage"), false, MAKE_PF_CB(process_IPMTempMessage)); @@ -216,13 +217,17 @@ void Mixer::process_MMPLUSConfigMessage_WWC(std::shared_ptr tele has_update(telegram, wwMaxTemp_, 10); } -// 0x34 +// 0x34 only8 bytes long +// Mixer(0x41) -> All(0x00), UBAMonitorWW(0x34), data: 37 02 1E 02 1E 00 00 00 00 void Mixer::process_MonitorWW(std::shared_ptr telegram) { has_update(telegram, wwSelTemp_, 0); has_update(telegram, wwCurTemp_1_, 1); has_update(telegram, wwCurTemp_2_, 3); + has_bitupdate(telegram, pumpStatus_, 5, 0); // not sure thisisthe right value } -// 0x1E + +// 0x1E, only16 bit temperature +// Mixer(0x41) -> Boiler(0x08), HydrTemp(0x1E), data: 01 D8 void Mixer::process_HydrTemp(std::shared_ptr telegram) { has_update(telegram, HydrTemp_, 0); } diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 99ea0129c..61d7a776c 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -306,7 +306,7 @@ std::shared_ptr Thermostat::heating_circuit(std::sha // not found, search device-id types for remote thermostats if (telegram->dest >= 0x20 && telegram->dest <= 0x27) { - hc_num = telegram->dest - 0x20; + hc_num = telegram->dest - 0x20; } // still didn't recognize it, ignore it @@ -3524,46 +3524,58 @@ void Thermostat::register_device_values() { MAKE_CF_CB(set_hybridStrategy)); register_device_value(DeviceValueTAG::TAG_THERMOSTAT_DATA, &switchOverTemp_, - DeviceValueType::UINT, + DeviceValueType::INT, nullptr, FL_(switchOverTemp), DeviceValueUOM::DEGREES, - MAKE_CF_CB(set_switchOverTemp)); + MAKE_CF_CB(set_switchOverTemp), + -20, + 20); register_device_value(DeviceValueTAG::TAG_THERMOSTAT_DATA, &energyCostRatio_, DeviceValueType::UINT, FL_(div10), FL_(energyCostRatio), DeviceValueUOM::NONE, - MAKE_CF_CB(set_energyCostRatio)); + MAKE_CF_CB(set_energyCostRatio), + 0, + 19.9); register_device_value(DeviceValueTAG::TAG_THERMOSTAT_DATA, &fossileFactor_, DeviceValueType::UINT, FL_(div10), FL_(fossileFactor), DeviceValueUOM::NONE, - MAKE_CF_CB(set_fossileFactor)); + MAKE_CF_CB(set_fossileFactor), + 0, + 5); register_device_value(DeviceValueTAG::TAG_THERMOSTAT_DATA, &electricFactor_, DeviceValueType::UINT, FL_(div10), FL_(electricFactor), DeviceValueUOM::NONE, - MAKE_CF_CB(set_electricFactor)); + MAKE_CF_CB(set_electricFactor), + 0, + 5); register_device_value(DeviceValueTAG::TAG_THERMOSTAT_DATA, &delayBoiler_, DeviceValueType::UINT, nullptr, FL_(delayBoiler), DeviceValueUOM::MINUTES, - MAKE_CF_CB(set_delayBoiler)); + MAKE_CF_CB(set_delayBoiler), + 5, + 120); register_device_value(DeviceValueTAG::TAG_THERMOSTAT_DATA, &tempDiffBoiler_, DeviceValueType::UINT, nullptr, FL_(tempDiffBoiler), DeviceValueUOM::DEGREES_R, - MAKE_CF_CB(set_tempDiffBoiler)); + MAKE_CF_CB(set_tempDiffBoiler), + 1, + 99); break; case EMS_DEVICE_FLAG_EASY: // Easy TC100 have no date/time, see issue #100, not sure about CT200, so leave it. diff --git a/src/devices/thermostat.h b/src/devices/thermostat.h index 70ef91abd..c2faafb85 100644 --- a/src/devices/thermostat.h +++ b/src/devices/thermostat.h @@ -182,11 +182,11 @@ class Thermostat : public EMSdevice { uint8_t ibaDamping_; // damping 0-off, 0xff-on uint8_t backlight_; uint8_t heatingpid_; - int8_t brightness_; // Screen brightness 0F=dark F1=light - uint8_t preheating_; // Preheating in the clock program: (0x00 = off, 0xFF = on) - uint8_t autodst_; // Automatic change Daylight Saving time: (0x00 = off, 0xFF = on) - uint8_t offtemp_; // Set Temperature when mode is Off / 10 (e.g.: 0x0F = 7.5 degrees Celsius) - uint8_t mixingvalves_; // Number of Mixing Valves: (0x00=0, 0x01=1, 0x02=2) + int8_t brightness_; // Screen brightness 0F=dark F1=light + uint8_t preheating_; // Preheating in the clock program: (0x00 = off, 0xFF = on) + uint8_t autodst_; // Automatic change Daylight Saving time: (0x00 = off, 0xFF = on) + uint8_t offtemp_; // Set Temperature when mode is Off / 10 (e.g.: 0x0F = 7.5 degrees Celsius) + uint8_t mixingvalves_; // Number of Mixing Valves: (0x00=0, 0x01=1, 0x02=2) int8_t dampedoutdoortemp_; uint16_t tempsensor1_; @@ -217,13 +217,13 @@ class Thermostat : public EMSdevice { uint8_t wwDailyHeatTime_; // HybridHP - uint8_t hybridStrategy_; // cost = 2, temperature = 3, mix = 4 - uint8_t switchOverTemp_; // degrees - uint8_t energyCostRatio_; // is *10 - uint8_t fossileFactor_; // is * 10 - uint8_t electricFactor_; // is * 10 + uint8_t hybridStrategy_; // co2 = 1, cost = 2, temperature = 3, mix = 4 + int8_t switchOverTemp_; // degrees + uint8_t energyCostRatio_; // is *10 + uint8_t fossileFactor_; // is * 10 + uint8_t electricFactor_; // is * 10 uint8_t delayBoiler_; // minutes - uint8_t tempDiffBoiler_; // relative temperature degrees + uint8_t tempDiffBoiler_; // relative temperature degrees std::vector> heating_circuits_; // each thermostat can have multiple heating circuits @@ -309,10 +309,10 @@ class Thermostat : public EMSdevice { static constexpr uint8_t AUTO_HEATING_CIRCUIT = 0; // Installation settings - static constexpr uint8_t EMS_TYPE_IBASettings = 0xA5; // installation settings + static constexpr uint8_t EMS_TYPE_IBASettings = 0xA5; // installation settings static constexpr uint8_t EMS_TYPE_RC30Settings = 0xA7; // RC30 settings - static constexpr uint8_t EMS_TYPE_wwSettings = 0x37; // ww settings - static constexpr uint8_t EMS_TYPE_time = 0x06; // time + static constexpr uint8_t EMS_TYPE_wwSettings = 0x37; // ww settings + static constexpr uint8_t EMS_TYPE_time = 0x06; // time std::shared_ptr heating_circuit(std::shared_ptr telegram); std::shared_ptr heating_circuit(const uint8_t hc_num); @@ -451,7 +451,7 @@ class Thermostat : public EMSdevice { bool set_autodst(const char * value, const int8_t id); bool set_preheating(const char * value, const int8_t id); bool set_mixingvalves(const char * value, const int8_t id); - bool set_offtemp(const char * value, const int8_t id); + bool set_offtemp(const char * value, const int8_t id); bool set_hybridStrategy(const char * value, const int8_t id); bool set_switchOverTemp(const char * value, const int8_t id); diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index 625c9e497..4711ddcbf 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -561,7 +561,7 @@ void EMSdevice::publish_value(void * value_p) const { } int8_t divider = (dv.options_size == 1) ? Helpers::atoint(read_flash_string(dv.options[0]).c_str()) : 0; - char payload[30] = {'\0'}; + char payload[50] = {'\0'}; uint8_t fahrenheit = !EMSESP::system_.fahrenheit() ? 0 : (dv.uom == DeviceValueUOM::DEGREES) ? 2 : (dv.uom == DeviceValueUOM::DEGREES_R) ? 1 : 0; switch (dv.type) { diff --git a/src/mqtt.cpp b/src/mqtt.cpp index abc0af963..8096285f9 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -386,6 +386,10 @@ void Mqtt::on_publish(uint16_t packetId) const { // called when MQTT settings have changed via the Web forms void Mqtt::reset_mqtt() { + if (!mqtt_enabled_) { + mqtt_messages_.clear(); + } + if (!mqttClient_) { return; } diff --git a/src/version.h b/src/version.h index b64112942..16885163f 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.4.0b11" +#define EMSESP_APP_VERSION "3.4.0b12"