From e92a3ad0253ea6178633be83ef9c1091b970946d Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Mon, 20 Sep 2021 08:51:16 +0200 Subject: [PATCH] add MM10 valvetime --- src/devices/mixer.cpp | 39 ++++++++++++++++++++++++++++++++++----- src/devices/mixer.h | 4 ++++ src/locale_EN.h | 1 + 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/devices/mixer.cpp b/src/devices/mixer.cpp index 76ab005f3..0a7d5ca9b 100644 --- a/src/devices/mixer.cpp +++ b/src/devices/mixer.cpp @@ -78,6 +78,8 @@ Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const s register_device_value(tag, &status_, DeviceValueType::INT, nullptr, FL_(mixerStatus), DeviceValueUOM::PERCENT); register_device_value(tag, &flowSetTemp_, DeviceValueType::UINT, nullptr, FL_(flowSetTemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_flowSetTemp)); register_device_value(tag, &pumpStatus_, DeviceValueType::BOOL, nullptr, FL_(pumpStatus), DeviceValueUOM::BOOLEAN, MAKE_CF_CB(set_pump)); + register_device_value(tag, &activated_, DeviceValueType::BOOL, nullptr, FL_(activated), DeviceValueUOM::BOOLEAN, MAKE_CF_CB(set_activated)); + register_device_value(tag, &setValveTime_, DeviceValueType::UINT, FL_(mul10), FL_(mixerSetTime), DeviceValueUOM::SECONDS, MAKE_CF_CB(set_setValveTime), 1, 12); } // HT3 @@ -231,16 +233,16 @@ void Mixer::process_HpPoolStatus(std::shared_ptr telegram) { poolShuntStatus_ = poolShunt_ == 100 ? 3 : (poolShunt_ == 0 ? 4 : poolShuntStatus__); } -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" - // Mixer on a MM10 - 0xAA // e.g. Thermostat -> Mixer Module, type 0xAA, telegram: 10 21 AA 00 FF 0C 0A 11 0A 32 xx void Mixer::process_MMConfigMessage(std::shared_ptr telegram) { - // pos 0: active FF = on - // pos 1: valve runtime 0C = 120 sec in units of 10 sec + has_update(telegram->read_value(activated_, 0)); // on = 0xFF + has_update(telegram->read_value(setValveTime_, 1)); // valve runtime in 10 sec, max 120 s } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" + // Mixer on a MM10 - 0xAC // e.g. Thermostat -> Mixer Module, type 0xAC, telegram: 10 21 AC 00 1E 64 01 AB void Mixer::process_MMSetMessage(std::shared_ptr telegram) { @@ -300,4 +302,31 @@ bool Mixer::set_pump(const char * value, const int8_t id) { return false; } +bool Mixer::set_activated(const char * value, const int8_t id) { + bool b; + if (!Helpers::value2bool(value, b)) { + return false; + } + if (flags() == EMSdevice::EMS_DEVICE_FLAG_MM10) { + LOG_INFO(F("Setting mixer %s"), value); + write_command(0xAA, 0, b ? 0xFF : 0, 0xAA); + return true; + } + return false; +} + +bool Mixer::set_setValveTime(const char * value, const int8_t id) { + int v; + if (!Helpers::value2number(value, v)) { + return false; + } + if (flags() == EMSdevice::EMS_DEVICE_FLAG_MM10) { + v = (v + 5) / 10; + LOG_INFO(F("Setting mixer valve time to %ds"), v * 10); + write_command(0xAA, 1, v, 0xAA); + return true; + } + return false; +} + } // namespace emsesp diff --git a/src/devices/mixer.h b/src/devices/mixer.h index 556b00146..ff9a200bd 100644 --- a/src/devices/mixer.h +++ b/src/devices/mixer.h @@ -44,6 +44,8 @@ class Mixer : public EMSdevice { bool set_flowSetTemp(const char * value, const int8_t id); bool set_pump(const char * value, const int8_t id); + bool set_activated(const char * value, const int8_t id); + bool set_setValveTime(const char * value, const int8_t id); enum class Type { NONE, @@ -59,6 +61,8 @@ class Mixer : public EMSdevice { uint8_t pumpStatus_; int8_t status_; uint8_t flowSetTemp_; + uint8_t activated_; + uint8_t setValveTime_; int16_t poolTemp_; int8_t poolShuntStatus__; diff --git a/src/locale_EN.h b/src/locale_EN.h index a32081665..48fb642b1 100644 --- a/src/locale_EN.h +++ b/src/locale_EN.h @@ -597,6 +597,7 @@ MAKE_PSTR_LIST(flowTempHc, F("flowtemphc"), F("flow temperature in assigned hc ( MAKE_PSTR_LIST(pumpStatus, F("pumpstatus"), F("pump status in assigned hc (PC1)")) MAKE_PSTR_LIST(mixerStatus, F("valvestatus"), F("mixing valve actuator in assigned hc (VC1)")) MAKE_PSTR_LIST(flowTempVf, F("flowtempvf"), F("flow temperature in header (T0/Vf)")) +MAKE_PSTR_LIST(mixerSetTime, F("valvesettime"), F("time to set valve")) MAKE_PSTR_LIST(wwPumpStatus, F("pumpstatus"), F("pump status in assigned wwc (PC1)")) MAKE_PSTR_LIST(wwTempStatus, F("wwtempstatus"), F("temperature switch in assigned wwc (MC1)")) MAKE_PSTR_LIST(wwTemp, F("wwtemp"), F("current temperature"))