Skip to content

Commit

Permalink
Merge branch 'dev_' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDvP committed Sep 20, 2021
2 parents 915749d + 2516d2d commit 6a828e9
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 43 deletions.
24 changes: 21 additions & 3 deletions src/devices/boiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
register_device_value(
TAG_BOILER_DATA_WW, &wwActivated_, DeviceValueType::BOOL, nullptr, FL_(wwActivated), DeviceValueUOM::BOOLEAN, MAKE_CF_CB(set_warmwater_activated));
register_device_value(TAG_BOILER_DATA_WW, &wwOneTime_, DeviceValueType::BOOL, nullptr, FL_(wwOneTime), DeviceValueUOM::BOOLEAN, MAKE_CF_CB(set_warmwater_onetime));
register_device_value(TAG_BOILER_DATA_WW, &wwDisinfecting_, DeviceValueType::BOOL, nullptr, FL_(wwDisinfecting), DeviceValueUOM::BOOLEAN);
register_device_value(TAG_BOILER_DATA_WW, &wwDisinfect_, DeviceValueType::BOOL, nullptr, FL_(wwDisinfect), DeviceValueUOM::BOOLEAN, MAKE_CF_CB(set_warmwater_disinfect));
register_device_value(TAG_BOILER_DATA_WW, &wwCharging_, DeviceValueType::BOOL, nullptr, FL_(wwCharging), DeviceValueUOM::BOOLEAN);
register_device_value(TAG_BOILER_DATA_WW, &wwRecharging_, DeviceValueType::BOOL, nullptr, FL_(wwRecharging), DeviceValueUOM::BOOLEAN);
register_device_value(TAG_BOILER_DATA_WW, &wwTempOK_, DeviceValueType::BOOL, nullptr, FL_(wwTempOK), DeviceValueUOM::BOOLEAN);
Expand Down Expand Up @@ -471,7 +471,7 @@ void Boiler::process_UBAMonitorWW(std::shared_ptr<const Telegram> telegram) {
has_update(telegram->read_value(wWStarts_, 13, 3)); // force to 3 bytes

has_update(telegram->read_bitvalue(wwOneTime_, 5, 1));
has_update(telegram->read_bitvalue(wwDisinfecting_, 5, 2));
has_update(telegram->read_bitvalue(wwDisinfect_, 5, 2));
has_update(telegram->read_bitvalue(wwCharging_, 5, 3));
has_update(telegram->read_bitvalue(wwRecharging_, 5, 4));
has_update(telegram->read_bitvalue(wwTempOK_, 5, 5));
Expand Down Expand Up @@ -611,7 +611,7 @@ void Boiler::process_UBAMonitorWWPlus(std::shared_ptr<const Telegram> telegram)
has_update(telegram->read_value(wWStarts_, 17, 3)); // force to 3 bytes

has_update(telegram->read_bitvalue(wwOneTime_, 12, 2));
has_update(telegram->read_bitvalue(wwDisinfecting_, 12, 3));
has_update(telegram->read_bitvalue(wwDisinfect_, 12, 3));
has_update(telegram->read_bitvalue(wwCharging_, 12, 4));
has_update(telegram->read_bitvalue(wwRecharging_, 13, 4));
has_update(telegram->read_bitvalue(wwTempOK_, 13, 5));
Expand Down Expand Up @@ -1310,6 +1310,24 @@ bool Boiler::set_warmwater_circulation(const char * value, const int8_t id) {
return true;
}

// starting warm water disinfect, set to off seems not working
bool Boiler::set_warmwater_disinfect(const char * value, const int8_t id) {
bool v = false;
if (!Helpers::value2bool(value, v)) {
LOG_WARNING(F("Set warm water disinfect: Invalid value"));
return false;
}

LOG_INFO(F("Setting warm water disinfect %s"), v ? "on" : "off");
if (is_fetch(EMS_TYPE_UBAParameterWWPlus)) {
write_command(EMS_TYPE_UBAFlags, 0, (v ? 0x44 : 0x04), 0xE9); // not sure if this is in flags
} else {
write_command(EMS_TYPE_UBAFlags, 0, (v ? 0x44 : 0x04), 0x34);
}

return true;
}

// configuration of warm water circulation pump
bool Boiler::set_warmwater_circulation_pump(const char * value, const int8_t id) {
bool v = false;
Expand Down
3 changes: 2 additions & 1 deletion src/devices/boiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Boiler : public EMSdevice {
uint16_t wwStorageTemp2_; // warm water storage temp 2
uint8_t wwActivated_; // Warm Water activated
uint8_t wwOneTime_; // Warm Water one time function on/off
uint8_t wwDisinfecting_; // Warm Water disinfection on/off
uint8_t wwDisinfect_; // Warm Water disinfection on/off
uint8_t wwCharging_; // Warm Water charging on/off
uint8_t wwRecharging_; // Warm Water recharge on/off
uint8_t wwTempOK_; // Warm Water temperature ok on/off
Expand Down Expand Up @@ -229,6 +229,7 @@ class Boiler : public EMSdevice {
bool set_warmwater_activated(const char * value, const int8_t id);
bool set_tapwarmwater_activated(const char * value, const int8_t id);
bool set_warmwater_onetime(const char * value, const int8_t id);
bool set_warmwater_disinfect(const char * value, const int8_t id);
bool set_warmwater_circulation(const char * value, const int8_t id);
bool set_warmwater_circulation_pump(const char * value, const int8_t id);
bool set_warmwater_circulation_mode(const char * value, const int8_t id);
Expand Down
39 changes: 34 additions & 5 deletions src/devices/mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -231,16 +233,16 @@ void Mixer::process_HpPoolStatus(std::shared_ptr<const Telegram> 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<const Telegram> 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<const Telegram> telegram) {
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions src/devices/mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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__;
Expand Down
11 changes: 6 additions & 5 deletions src/devices/thermostat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1383,11 +1383,12 @@ bool Thermostat::set_wwcharge(const char * value, const int8_t id) {

// Set ww charge duration in steps of 15 min, ems+
bool Thermostat::set_wwchargeduration(const char * value, const int8_t id) {
uint8_t t = 0xFF;
if (!Helpers::value2enum(value, t, FL_(enum_wwChargeDuration))) {
int t = 0xFF;
if (!Helpers::value2number(value, t)) {
LOG_WARNING(F("Set warm water charge duration: Invalid value"));
return false;
}
t = (t + 8) / 15;
LOG_INFO(F("Setting warm water charge duration to %d min"), t * 15);
write_command(0x2F5, 10, t, 0x02F5);
return true;
Expand Down Expand Up @@ -2420,10 +2421,10 @@ void Thermostat::register_device_values() {
TAG_THERMOSTAT_DATA, &wwCircMode_, DeviceValueType::ENUM, FL_(enum_wwCircMode), FL_(wwCircMode), DeviceValueUOM::LIST, MAKE_CF_CB(set_wwcircmode));
register_device_value(TAG_THERMOSTAT_DATA,
&wwChargeDuration_,
DeviceValueType::ENUM,
FL_(enum_wwChargeDuration),
DeviceValueType::UINT,
FL_(mul15),
FL_(wwChargeDuration),
DeviceValueUOM::LIST,
DeviceValueUOM::MINUTES,
MAKE_CF_CB(set_wwchargeduration));
register_device_value(TAG_THERMOSTAT_DATA, &wwCharge_, DeviceValueType::BOOL, nullptr, FL_(wwCharge), DeviceValueUOM::BOOLEAN, MAKE_CF_CB(set_wwcharge));
register_device_value(TAG_THERMOSTAT_DATA, &wwExtra1_, DeviceValueType::UINT, nullptr, FL_(wwExtra1), DeviceValueUOM::DEGREES);
Expand Down
Loading

0 comments on commit 6a828e9

Please sign in to comment.