From 87b2a05d39e3551f9d367dbccbbdadc7ef35866c Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Tue, 27 Apr 2021 14:48:36 +0200 Subject: [PATCH] add CRF200 thermostat flag and no_write --- src/device_library.h | 2 +- src/devices/thermostat.cpp | 37 +++++++++++++++++++++++++++++++++++++ src/devices/thermostat.h | 2 ++ src/emsdevice.h | 1 + src/locale_EN.h | 2 ++ 5 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/device_library.h b/src/device_library.h index 8acff9f5c..b3cf33d41 100644 --- a/src/device_library.h +++ b/src/device_library.h @@ -80,7 +80,7 @@ {157, DeviceType::THERMOSTAT, F("RC200/CW100"), DeviceFlags::EMS_DEVICE_FLAG_RC100}, // 0x18 {158, DeviceType::THERMOSTAT, F("RC300/RC310/Moduline 3000/1010H/CW400/Sense II"), DeviceFlags::EMS_DEVICE_FLAG_RC300}, // 0x10 {165, DeviceType::THERMOSTAT, F("RC100/Moduline 1000/1010"), DeviceFlags::EMS_DEVICE_FLAG_RC100}, // 0x18, 0x38 -{216, DeviceType::THERMOSTAT, F("CRF200S"), DeviceFlags::EMS_DEVICE_FLAG_RC100}, // 0x18 +{216, DeviceType::THERMOSTAT, F("CRF200S"), DeviceFlags::EMS_DEVICE_FLAG_CRF | DeviceFlags::EMS_DEVICE_FLAG_NO_WRITE}, // 0x18 // Thermostat - Sieger - 0x10 / 0x17 { 66, DeviceType::THERMOSTAT, F("ES72/RC20"), DeviceFlags::EMS_DEVICE_FLAG_RC20_N}, // 0x17 or remote diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 44ed9246e..ea5d84725 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -110,6 +110,13 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i set_typeids = {}; register_telegram_type(monitor_typeids[0], F("EasyMonitor"), true, MAKE_PF_CB(process_EasyMonitor)); + } else if (model == EMSdevice::EMS_DEVICE_FLAG_CRF) { + monitor_typeids = {0x02A5, 0x02A6, 0x02A7, 0x02A8}; + set_typeids = {}; + for (uint8_t i = 0; i < monitor_typeids.size(); i++) { + register_telegram_type(monitor_typeids[i], F("CRFMonitor"), true, MAKE_PF_CB(process_CRFMonitor)); + } + // RC300/RC100 } else if ((model == EMSdevice::EMS_DEVICE_FLAG_RC300) || (model == EMSdevice::EMS_DEVICE_FLAG_RC100)) { monitor_typeids = {0x02A5, 0x02A6, 0x02A7, 0x02A8}; @@ -468,6 +475,12 @@ uint8_t Thermostat::HeatingCircuit::get_mode() const { } else if (mode == 2) { return HeatingCircuit::Mode::AUTO; } + } else if (model == EMSdevice::EMS_DEVICE_FLAG_CRF) { + if (mode == 0) { + return HeatingCircuit::Mode::AUTO; + } else if (mode == 1) { + return HeatingCircuit::Mode::OFF; + } } else if ((model == EMSdevice::EMS_DEVICE_FLAG_RC300) || (model == EMSdevice::EMS_DEVICE_FLAG_RC100)) { if (mode == 0) { return HeatingCircuit::Mode::MANUAL; @@ -514,6 +527,12 @@ uint8_t Thermostat::HeatingCircuit::get_mode_type() const { } else if (modetype == 1) { return HeatingCircuit::Mode::DAY; } + } else if (model == EMS_DEVICE_FLAG_CRF) { + if (modetype == 0) { + return HeatingCircuit::Mode::OFF; + } else if (modetype == 1) { + return HeatingCircuit::Mode::ON; + } } else if (model == EMS_DEVICE_FLAG_RC300) { if (modetype == 0) { return HeatingCircuit::Mode::ECO; @@ -750,6 +769,19 @@ void Thermostat::process_JunkersMonitor(std::shared_ptr telegram has_update(telegram->read_value(hc->mode, 1)); // 1 = manual, 2 = auto } +// type 0x02A5 - data from Worchester CRF200 +void Thermostat::process_CRFMonitor(std::shared_ptr telegram) { + std::shared_ptr hc = heating_circuit(telegram); + if (hc == nullptr) { + return; + } + has_update(telegram->read_value(hc->curr_roomTemp, 0)); // is * 10 + has_update(telegram->read_bitvalue(hc->modetype, 2, 0)); + has_update(telegram->read_bitvalue(hc->mode, 2, 4)); // bit 4, mode (auto=0 or off=1) + has_update(telegram->read_value(hc->setpoint_roomTemp, 6, 1)); // is * 2, force as single byte + has_update(telegram->read_value(hc->targetflowtemp, 4)); +} + // type 0x02A5 - data from the Nefit RC1010/3000 thermostat (0x18) and RC300/310s on 0x10 void Thermostat::process_RC300Monitor(std::shared_ptr telegram) { std::shared_ptr hc = heating_circuit(telegram); @@ -2201,6 +2233,11 @@ void Thermostat::register_device_values_hc(std::shared_ptrprogram, 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)); break; + case EMS_DEVICE_FLAG_CRF: + register_device_value(tag, &hc->mode, DeviceValueType::ENUM, FL_(enum_mode5), FL_(mode), DeviceValueUOM::NONE); + register_device_value(tag, &hc->modetype, DeviceValueType::ENUM, FL_(enum_modetype5), FL_(modetype), DeviceValueUOM::NONE); + register_device_value(tag, &hc->targetflowtemp, DeviceValueType::UINT, nullptr, FL_(targetflowtemp), DeviceValueUOM::DEGREES); + break; case EMS_DEVICE_FLAG_RC20: register_device_value(tag, &hc->mode, DeviceValueType::ENUM, FL_(enum_mode2), FL_(mode), DeviceValueUOM::NONE, MAKE_CF_CB(set_mode)); break; diff --git a/src/devices/thermostat.h b/src/devices/thermostat.h index c8ef0bd0b..bb91561a2 100644 --- a/src/devices/thermostat.h +++ b/src/devices/thermostat.h @@ -101,6 +101,7 @@ class Thermostat : public EMSdevice { ROOMINFLUENCE, TEMPAUTO, NOREDUCE, + ON, UNKNOWN }; @@ -276,6 +277,7 @@ class Thermostat : public EMSdevice { void process_RC20Set_2(std::shared_ptr telegram); void process_RC10Monitor(std::shared_ptr telegram); void process_RC10Set(std::shared_ptr telegram); + void process_CRFMonitor(std::shared_ptr telegram); void process_RC300Monitor(std::shared_ptr telegram); void process_RC300Set(std::shared_ptr telegram); void process_RC300Summer(std::shared_ptr telegram); diff --git a/src/emsdevice.h b/src/emsdevice.h index 06d54d7fd..8c48fe90a 100644 --- a/src/emsdevice.h +++ b/src/emsdevice.h @@ -330,6 +330,7 @@ class EMSdevice { static constexpr uint8_t EMS_DEVICE_FLAG_RC300 = 8; static constexpr uint8_t EMS_DEVICE_FLAG_RC100 = 9; static constexpr uint8_t EMS_DEVICE_FLAG_JUNKERS = 10; + static constexpr uint8_t EMS_DEVICE_FLAG_CRF = 11; // CRF200 only monitor void reserve_device_values(uint8_t elements) { devicevalues_.reserve(elements); diff --git a/src/locale_EN.h b/src/locale_EN.h index 7b6a36eda..8f256a8ba 100644 --- a/src/locale_EN.h +++ b/src/locale_EN.h @@ -299,11 +299,13 @@ MAKE_PSTR_LIST(enum_mode, F_(manual), F_(auto)) MAKE_PSTR_LIST(enum_mode2, F_(off), F_(manual), F_(auto)) MAKE_PSTR_LIST(enum_mode3, F_(night), F_(day), F_(auto)) MAKE_PSTR_LIST(enum_mode4, F_(blank), F_(manual), F_(auto), F_(holiday)) +MAKE_PSTR_LIST(enum_mode5, F_(auto), F_(off)) MAKE_PSTR_LIST(enum_modetype, F_(eco), F_(comfort)) MAKE_PSTR_LIST(enum_modetype2, F_(day)) MAKE_PSTR_LIST(enum_modetype3, F_(night), F_(day)) MAKE_PSTR_LIST(enum_modetype4, F_(blank), F_(nofrost), F_(eco), F_(heat)) +MAKE_PSTR_LIST(enum_modetype5, F_(off), F_(on)) MAKE_PSTR_LIST(enum_reducemode, F_(nofrost), F_(reduce), F_(room), F_(outdoor))