From 6069af3e90b543f022b3bbb5b1fbca0a58ce4bc3 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Sun, 3 Apr 2022 09:43:53 +0200 Subject: [PATCH] ISM2 missing values, ISM2dhw in solar class --- src/device_library.h | 6 ++--- src/devices/generic.cpp | 16 ------------ src/devices/generic.h | 4 --- src/devices/solar.cpp | 54 ++++++++++++++++++++++++++++++++++------- src/devices/solar.h | 8 +++--- 5 files changed, 52 insertions(+), 36 deletions(-) diff --git a/src/device_library.h b/src/device_library.h index f375910e3..2681c409e 100644 --- a/src/device_library.h +++ b/src/device_library.h @@ -109,8 +109,9 @@ {191, DeviceType::THERMOSTAT, F("FR120"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model {192, DeviceType::THERMOSTAT, F("FW120"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, -// Solar Modules - 0x30, 0x2A (for ww) +// Solar Modules - 0x30 (for solar), 0x2A, 0x41 (for ww) { 73, DeviceType::SOLAR, F("SM10"), DeviceFlags::EMS_DEVICE_FLAG_SM10}, +{100, DeviceType::SOLAR, F("ISM DHW"), DeviceFlags::EMS_DEVICE_FLAG_ISM}, {101, DeviceType::SOLAR, F("ISM1"), DeviceFlags::EMS_DEVICE_FLAG_ISM}, {103, DeviceType::SOLAR, F("ISM2"), DeviceFlags::EMS_DEVICE_FLAG_ISM}, {162, DeviceType::SOLAR, F("SM50"), DeviceFlags::EMS_DEVICE_FLAG_SM100}, @@ -144,9 +145,6 @@ // Gateways - 0x48 {189, DeviceType::GATEWAY, F("KM200/MB LAN 2"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -// generic 0x41 DHW module -{100, DeviceType::GENERIC, F("DHW module"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, - // Generic - 0x40 or other with no product-id and no version {0, DeviceType::GENERIC, F("unknown"), DeviceFlags::EMS_DEVICE_FLAG_NONE} diff --git a/src/devices/generic.cpp b/src/devices/generic.cpp index 2cb1dfc8d..7f7f7c984 100644 --- a/src/devices/generic.cpp +++ b/src/devices/generic.cpp @@ -31,12 +31,6 @@ Generic::Generic(uint8_t device_type, uint8_t device_id, uint8_t product_id, con register_telegram_type(0x435, F("RFSensorMessage"), false, MAKE_PF_CB(process_RFSensorMessage)); register_device_value(DeviceValueTAG::TAG_NONE, &rfTemp_, DeviceValueType::SHORT, FL_(div10), FL_(RFTemp), DeviceValueUOM::DEGREES); } - if (device_id == 0x41) { // DHW module - register_telegram_type(0x34, F("MonitorWW"), false, MAKE_PF_CB(process_MonitorWW)); - register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwSetTemp_, DeviceValueType::UINT, nullptr, FL_(wwSetTemp), DeviceValueUOM::DEGREES); - register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwCurTemp_, DeviceValueType::USHORT, FL_(div10), FL_(wwCurTemp), DeviceValueUOM::DEGREES); - register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwCurTemp2_, DeviceValueType::USHORT, FL_(div10), FL_(wwCurTemp2), DeviceValueUOM::DEGREES); - } } @@ -44,15 +38,5 @@ Generic::Generic(uint8_t device_type, uint8_t device_id, uint8_t product_id, con void Generic::process_RFSensorMessage(std::shared_ptr telegram) { has_update(telegram, rfTemp_, 0); // is * 10 } -/* - * MonitorWW - type 0x34 - dhw monitor. 10 bytes long - * received every 10 seconds - * Unknown(0x41) -> All(0x00), UBAMonitorWW(0x34), data: 37 02 25 02 25 00 00 00 00 -*/ -void Generic::process_MonitorWW(std::shared_ptr telegram) { - has_update(telegram, wwSetTemp_, 0); - has_update(telegram, wwCurTemp_, 1); - has_update(telegram, wwCurTemp2_, 3); -} } // namespace emsesp diff --git a/src/devices/generic.h b/src/devices/generic.h index e4beb5a44..f48632693 100644 --- a/src/devices/generic.h +++ b/src/devices/generic.h @@ -31,12 +31,8 @@ class Generic : public EMSdevice { static uuid::log::Logger logger_; int16_t rfTemp_; - uint8_t wwSetTemp_; // DHW set temperature - uint16_t wwCurTemp_; // DHW current temperature - uint16_t wwCurTemp2_; // DHW current temperature storage void process_RFSensorMessage(std::shared_ptr telegram); - void process_MonitorWW(std::shared_ptr telegram); }; } // namespace emsesp diff --git a/src/devices/solar.cpp b/src/devices/solar.cpp index c7a97ad96..739290ff9 100644 --- a/src/devices/solar.cpp +++ b/src/devices/solar.cpp @@ -34,7 +34,7 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c } if (flags == EMSdevice::EMS_DEVICE_FLAG_SM100) { - if (device_id == 0x2A) { + if (device_id == 0x2A) { // SM100 DHW register_telegram_type(0x07D6, F("SM100wwTemperature"), false, MAKE_PF_CB(process_SM100wwTemperature)); register_telegram_type(0x07AA, F("SM100wwStatus"), false, MAKE_PF_CB(process_SM100wwStatus)); register_telegram_type(0x07AB, F("SM100wwCommand"), false, MAKE_PF_CB(process_SM100wwCommand)); @@ -63,14 +63,31 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c } if (flags == EMSdevice::EMS_DEVICE_FLAG_ISM) { - register_telegram_type(0x0103, F("ISM1StatusMessage"), true, MAKE_PF_CB(process_ISM1StatusMessage)); - register_telegram_type(0x0101, F("ISM1Set"), true, MAKE_PF_CB(process_ISM1Set)); - register_telegram_type(0x0104, F("ISM2StatusMessage"), false, MAKE_PF_CB(process_ISM2StatusMessage)); + if (device_id == 0x41) { // ISM DHW module + register_telegram_type(0x34, F("UBAMonitorWW"), false, MAKE_PF_CB(process_MonitorWW)); + } else { + register_telegram_type(0x0103, F("ISM1StatusMessage"), true, MAKE_PF_CB(process_ISM1StatusMessage)); + register_telegram_type(0x0101, F("ISM1Set"), true, MAKE_PF_CB(process_ISM1Set)); + register_telegram_type(0x0104, F("ISM2StatusMessage"), false, MAKE_PF_CB(process_ISM2StatusMessage)); + } } // device values... - // special case for a device_id with 0x2A where it's not actual a solar module + // special case ISM DHW module + if (device_id == 0x41) { // ISM DHW module + register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, + &wwSelTemp_, + DeviceValueType::UINT, + nullptr, + FL_(wwSelTemp), + DeviceValueUOM::DEGREES, + MAKE_CF_CB(set_wwSelTemp)); + register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwTemp_1_, DeviceValueType::USHORT, FL_(div10), FL_(wwCurTemp), DeviceValueUOM::DEGREES); + register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwTemp_3_, DeviceValueType::USHORT, FL_(div10), FL_(wwCurTemp2), DeviceValueUOM::DEGREES); + return; + } + // special case for a SM100 DHW device_id with 0x2A where it's not actual a solar module if (device_id == 0x2A) { register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwTemp_1_, DeviceValueType::USHORT, FL_(div10), FL_(wwTemp1), DeviceValueUOM::DEGREES); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwTemp_3_, DeviceValueType::USHORT, FL_(div10), FL_(wwTemp3), DeviceValueUOM::DEGREES); @@ -86,7 +103,7 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c DeviceValueUOM::DEGREES, MAKE_CF_CB(set_wwMaxTemp)); register_device_value( - DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwTemp_, DeviceValueType::UINT, nullptr, FL_(wwTemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_wwTemp)); + DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwSelTemp_, DeviceValueType::UINT, nullptr, FL_(wwSelTemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_wwSelTemp)); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwRedTemp_, DeviceValueType::UINT, @@ -129,6 +146,7 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c return; } + // common solar values for all modules (except dhw) register_device_value(DeviceValueTAG::TAG_NONE, &collectorTemp_, DeviceValueType::SHORT, FL_(div10), FL_(collectorTemp), DeviceValueUOM::DEGREES); register_device_value(DeviceValueTAG::TAG_NONE, &cylBottomTemp_, DeviceValueType::SHORT, FL_(div10), FL_(cylBottomTemp), DeviceValueUOM::DEGREES); register_device_value(DeviceValueTAG::TAG_NONE, &solarPump_, DeviceValueType::BOOL, nullptr, FL_(solarPump), DeviceValueUOM::NONE); @@ -138,6 +156,7 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c register_device_value(DeviceValueTAG::TAG_NONE, &collectorShutdown_, DeviceValueType::BOOL, nullptr, FL_(collectorShutdown), DeviceValueUOM::NONE); register_device_value(DeviceValueTAG::TAG_NONE, &cylHeated_, DeviceValueType::BOOL, nullptr, FL_(cylHeated), DeviceValueUOM::NONE); + // values per device flag if (flags == EMSdevice::EMS_DEVICE_FLAG_SM10) { register_device_value(DeviceValueTAG::TAG_NONE, &solarPumpMod_, DeviceValueType::UINT, nullptr, FL_(solarPumpMod), DeviceValueUOM::PERCENT); register_device_value( @@ -186,6 +205,9 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c */ } if (flags == EMSdevice::EMS_DEVICE_FLAG_ISM) { + register_device_value(DeviceValueTAG::TAG_NONE, &cylMiddleTemp_, DeviceValueType::SHORT, FL_(div10), FL_(cylMiddleTemp), DeviceValueUOM::DEGREES); + register_device_value(DeviceValueTAG::TAG_NONE, &retHeatAssist_, DeviceValueType::SHORT, FL_(div10), FL_(retHeatAssist), DeviceValueUOM::DEGREES); + register_device_value(DeviceValueTAG::TAG_NONE, &m1Valve_, DeviceValueType::BOOL, nullptr, FL_(m1Valve), DeviceValueUOM::NONE); register_device_value(DeviceValueTAG::TAG_NONE, &energyLastHour_, DeviceValueType::ULONG, FL_(div10), FL_(energyLastHour), DeviceValueUOM::WH); } @@ -583,7 +605,7 @@ void Solar::process_SM100wwStatus(std::shared_ptr telegram) { // data: FF 05 0F 5F 00 01 3C 3C 3C 3C 28 12 46 01 3C 1E 03 07 3C 00 0F 00 05 void Solar::process_SM100wwParam(std::shared_ptr telegram) { has_update(telegram, wwMaxTemp_, 8); - has_update(telegram, wwTemp_, 9); + has_update(telegram, wwSelTemp_, 9); has_update(telegram, wwRedTemp_, 10); has_update(telegram, wwDailyTemp_, 6); has_update(telegram, wwDisinfectionTemp_, 12); @@ -782,6 +804,16 @@ void Solar::process_ISM1Set(std::shared_ptr telegram) { has_update(telegram, cylMaxTemp_, 6); } +/* + * Junkers ISM1 Solar DHW Module - type 0x34 ww + */ +void Solar::process_MonitorWW(std::shared_ptr telegram) { + has_update(telegram, wwSelTemp_, 0); + has_update(telegram, wwTemp_1_, 1); + has_update(telegram, wwTemp_3_, 3); +} + + /* * Settings */ @@ -1121,12 +1153,16 @@ bool Solar::set_diffControl(const char * value, const int8_t id) { return true; } -bool Solar::set_wwTemp(const char * value, const int8_t id) { +bool Solar::set_wwSelTemp(const char * value, const int8_t id) { float v = 0; if (!Helpers::value2temperature(value, v)) { return false; } - write_command(0x7A6, 9, (uint8_t)v, 0x7A6); + if (flags() == EMSdevice::EMS_DEVICE_FLAG_ISM) { + write_command(0x35, 3, (uint8_t)v, 0x34); + } else { // SM100 + write_command(0x7A6, 9, (uint8_t)v, 0x7A6); + } return true; } diff --git a/src/devices/solar.h b/src/devices/solar.h index 6d664d81f..a0bfda887 100644 --- a/src/devices/solar.h +++ b/src/devices/solar.h @@ -125,7 +125,7 @@ class Solar : public EMSdevice { // SM100wwParam - 0x07A6 uint8_t wwMaxTemp_; - uint8_t wwTemp_; + uint8_t wwSelTemp_; uint8_t wwRedTemp_; uint8_t wwDailyTemp_; uint8_t wwDisinfectionTemp_; @@ -188,8 +188,9 @@ class Solar : public EMSdevice { void process_ISM1StatusMessage(std::shared_ptr telegram); void process_ISM1Set(std::shared_ptr telegram); void process_ISM2StatusMessage(std::shared_ptr telegram); + void process_MonitorWW(std::shared_ptr telegram); - + // settings bool set_CollectorMaxTemp(const char * value, const int8_t id); bool set_CollectorMinTemp(const char * value, const int8_t id); bool set_cylMaxTemp(const char * value, const int8_t id); @@ -225,7 +226,7 @@ class Solar : public EMSdevice { bool set_heatAssist(const char * value, const int8_t id); bool set_diffControl(const char * value, const int8_t id); - bool set_wwTemp(const char * value, const int8_t id); + bool set_wwSelTemp(const char * value, const int8_t id); bool set_wwMaxTemp(const char * value, const int8_t id); bool set_wwRedTemp(const char * value, const int8_t id); bool set_wwCirc(const char * value, const int8_t id); @@ -233,6 +234,7 @@ class Solar : public EMSdevice { bool set_wwKeepWarm(const char * value, const int8_t id); bool set_wwDisinfectionTemp(const char * value, const int8_t id); bool set_wwDailyTemp(const char * value, const int8_t id); + }; } // namespace emsesp