Merge branch 'dev_' into dev_no_master_thermostat

This commit is contained in:
MichaelDvP
2022-04-14 07:27:07 +02:00
55 changed files with 3607 additions and 2542 deletions

View File

@@ -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));
@@ -65,11 +65,11 @@ 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));
}
// device values...
// special case for a device_id with 0x2A where it's not actual a solar module
// 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);
@@ -84,8 +84,13 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c
FL_(wwMaxTemp),
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));
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,
&wwRedTemp_,
DeviceValueType::UINT,
@@ -128,6 +133,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_DEVICE_DATA, &collectorTemp_, DeviceValueType::SHORT, FL_(div10), FL_(collectorTemp), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &cylBottomTemp_, DeviceValueType::SHORT, FL_(div10), FL_(cylBottomTemp), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &solarPump_, DeviceValueType::BOOL, nullptr, FL_(solarPump), DeviceValueUOM::NONE);
@@ -137,6 +143,7 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &collectorShutdown_, DeviceValueType::BOOL, nullptr, FL_(collectorShutdown), DeviceValueUOM::NONE);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &cylHeated_, DeviceValueType::BOOL, nullptr, FL_(cylHeated), DeviceValueUOM::NONE);
// values per device flag
if (flags == EMSdevice::EMS_DEVICE_FLAG_SM10) {
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &solarPumpMod_, DeviceValueType::UINT, nullptr, FL_(solarPumpMod), DeviceValueUOM::PERCENT);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
@@ -191,6 +198,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_DEVICE_DATA, &cylMiddleTemp_, DeviceValueType::SHORT, FL_(div10), FL_(cylMiddleTemp), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &retHeatAssist_, DeviceValueType::SHORT, FL_(div10), FL_(retHeatAssist), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &m1Valve_, DeviceValueType::BOOL, nullptr, FL_(m1Valve), DeviceValueUOM::NONE);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &energyLastHour_, DeviceValueType::ULONG, FL_(div10), FL_(energyLastHour), DeviceValueUOM::WH);
}
@@ -608,7 +618,7 @@ void Solar::process_SM100wwStatus(std::shared_ptr<const Telegram> 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<const Telegram> 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);
@@ -788,6 +798,18 @@ void Solar::process_ISM1StatusMessage(std::shared_ptr<const Telegram> telegram)
has_bitupdate(telegram, cylHeated_, 9, 2); // cyl full
}
/*
* Junkers ISM12 Solar Module - type 0x0104 EMS+ for heat assist
* ?(0x103), data: 00 00 00 00 00 7A 01 15 00 00 05 37 F0
* ?(0x104), data: 01 A9 01 22 27 0F 27 0F 27 0F 27 0F 27 0F 27 0F
* ?(0x104), data: 01 01 00 00 00 00 00 27 0F 27 0F (offset 16)
*/
void Solar::process_ISM2StatusMessage(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, cylMiddleTemp_, 0); // Temperature Middle of Solar Boiler cyl
has_update(telegram, retHeatAssist_, 2); // return temperature from heating T4
has_bitupdate(telegram, m1Valve_, 17, 0); // return valve DUW1 (also 16,0)
}
/*
* Junkers ISM1 Solar Module - type 0x0101 EMS+ for setting values
*/
@@ -943,54 +965,54 @@ bool Solar::set_SM10MaxFlow(const char * value, const int8_t id) {
// switch heat transfer system on/off
bool Solar::set_heatTransferSystem(const char * value, const int8_t id) {
bool v = false;
if (!Helpers::value2bool(value, v)) {
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
write_command(0x358, 5, v ? 0x01 : 0x00, 0x358);
write_command(0x358, 5, b ? 0x01 : 0x00, 0x358);
return true;
}
// switch external cylinder on/off
bool Solar::set_externalCyl(const char * value, const int8_t id) {
bool v = false;
if (!Helpers::value2bool(value, v)) {
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
write_command(0x358, 9, v ? 0x01 : 0x00, 0x358);
write_command(0x358, 9, b ? 0x01 : 0x00, 0x358);
return true;
}
// switch thermal disinfection on/off
bool Solar::set_thermalDisinfect(const char * value, const int8_t id) {
bool v = false;
if (!Helpers::value2bool(value, v)) {
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
write_command(0x358, 10, v ? 0x01 : 0x00, 0x358);
write_command(0x358, 10, b ? 0x01 : 0x00, 0x358);
return true;
}
// switch heat metering on/off
bool Solar::set_heatMetering(const char * value, const int8_t id) {
bool v = false;
if (!Helpers::value2bool(value, v)) {
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
write_command(0x358, 14, v ? 0x01 : 0x00, 0x358);
write_command(0x358, 14, b ? 0x01 : 0x00, 0x358);
return true;
}
// switch solar system on/off
bool Solar::set_solarEnabled(const char * value, const int8_t id) {
bool v = false;
if (!Helpers::value2bool(value, v)) {
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
if (flags() == EMSdevice::EMS_DEVICE_FLAG_SM10) {
write_command(0x96, 0, v ? 0xFF : 0x00, 0x96);
write_command(0x96, 0, b ? 0xFF : 0x00, 0x96);
} else {
write_command(0x358, 19, v ? 0x01 : 0x00, 0x358);
write_command(0x358, 19, b ? 0x01 : 0x00, 0x358);
}
return true;
}
@@ -1018,71 +1040,71 @@ bool Solar::set_solarMode2(const char * value, const int8_t id) {
// switch pumpkick on/off
bool Solar::set_solarPumpKick(const char * value, const int8_t id) {
bool v = false;
if (!Helpers::value2bool(value, v)) {
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
write_command(0x35A, 9, v ? 0x01 : 0x00, 0x35A);
write_command(0x35A, 9, b ? 0x01 : 0x00, 0x35A);
return true;
}
// switch pump2kick on/off
bool Solar::set_solarPump2Kick(const char * value, const int8_t id) {
bool v = false;
if (!Helpers::value2bool(value, v)) {
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
write_command(0x35D, 0, v ? 0x01 : 0x00, 0x35D);
write_command(0x35D, 0, b ? 0x01 : 0x00, 0x35D);
return true;
}
// switch plain water mode on/off
bool Solar::set_plainWaterMode(const char * value, const int8_t id) {
bool v = false;
if (!Helpers::value2bool(value, v)) {
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
write_command(0x35A, 10, v ? 0x01 : 0x00, 0x35A);
write_command(0x35A, 10, b ? 0x01 : 0x00, 0x35A);
return true;
}
// switch double match flow on/off
bool Solar::set_doubleMatchFlow(const char * value, const int8_t id) {
bool v = false;
if (!Helpers::value2bool(value, v)) {
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
write_command(0x35A, 11, v ? 0x01 : 0x00, 0x35A);
write_command(0x35A, 11, b ? 0x01 : 0x00, 0x35A);
return true;
}
// set climate zone number
bool Solar::set_climateZone(const char * value, const int8_t id) {
int v = 0;
if (!Helpers::value2number(value, v)) {
int zone;
if (!Helpers::value2number(value, zone)) {
return false;
}
write_command(0x380, 0, v, 0x380);
write_command(0x380, 0, zone, 0x380);
return true;
}
// collector area in squaremeters
bool Solar::set_collector1Area(const char * value, const int8_t id) {
float v = 0;
if (!Helpers::value2float(value, v)) {
float area;
if (!Helpers::value2float(value, area)) {
return false;
}
write_command(0x380, 3, (uint16_t)(v * 10), 0x380);
write_command(0x380, 3, (uint16_t)(area * 10), 0x380);
return true;
}
// collector area in squaremeters
bool Solar::set_collector2Area(const char * value, const int8_t id) {
float v = 0;
if (!Helpers::value2float(value, v)) {
float area;
if (!Helpers::value2float(value, area)) {
return false;
}
write_command(0x380, 6, (uint16_t)(v * 10), 0x380);
write_command(0x380, 6, (uint16_t)(area * 10), 0x380);
return true;
}
@@ -1108,101 +1130,101 @@ bool Solar::set_collector2Type(const char * value, const int8_t id) {
// priority of cylinders if there are 2
bool Solar::set_cylPriority(const char * value, const int8_t id) {
uint8_t n;
if (!Helpers::value2enum(value, n, FL_(enum_cylprio))) {
uint8_t num;
if (!Helpers::value2enum(value, num, FL_(enum_cylprio))) {
return false;
}
write_command(0x35F, 3, n, 0x35F);
write_command(0x35F, 3, num, 0x35F);
return true;
}
bool Solar::set_heatAssist(const char * value, const int8_t id) {
float v = 0;
if (!Helpers::value2temperature(value, v)) {
float temperature;
if (!Helpers::value2temperature(value, temperature)) {
return false;
}
write_command(0x35C, 0, (uint8_t)(v * 10), 0x35C);
write_command(0x35C, 0, (uint8_t)(temperature * 10), 0x35C);
return true;
}
bool Solar::set_diffControl(const char * value, const int8_t id) {
float v = 0;
if (!Helpers::value2temperature(value, v)) {
float temperature;
if (!Helpers::value2temperature(value, temperature)) {
return false;
}
write_command(0x361, 4, (uint8_t)(v * 10), 0x361);
write_command(0x361, 4, (uint8_t)(temperature * 10), 0x361);
return true;
}
bool Solar::set_wwTemp(const char * value, const int8_t id) {
float v = 0;
if (!Helpers::value2temperature(value, v)) {
bool Solar::set_wwSelTemp(const char * value, const int8_t id) {
int temperature;
if (!Helpers::value2temperature(value, temperature)) {
return false;
}
write_command(0x7A6, 9, (uint8_t)v, 0x7A6);
write_command(0x7A6, 9, (uint8_t)temperature, 0x7A6);
return true;
}
bool Solar::set_wwMaxTemp(const char * value, const int8_t id) {
float v = 0;
if (!Helpers::value2temperature(value, v)) {
int temperature;
if (!Helpers::value2temperature(value, temperature)) {
return false;
}
write_command(0x7A6, 8, (uint8_t)v, 0x7A6);
write_command(0x7A6, 8, (uint8_t)temperature, 0x7A6);
return true;
}
bool Solar::set_wwRedTemp(const char * value, const int8_t id) {
float v = 0;
if (!Helpers::value2temperature(value, v)) {
int temperature;
if (!Helpers::value2temperature(value, temperature)) {
return false;
}
write_command(0x7A6, 10, (uint8_t)v, 0x7A6);
write_command(0x7A6, 10, (uint8_t)temperature, 0x7A6);
return true;
}
bool Solar::set_wwDailyTemp(const char * value, const int8_t id) {
float v = 0;
if (!Helpers::value2temperature(value, v)) {
int temperature;
if (!Helpers::value2temperature(value, temperature)) {
return false;
}
write_command(0x7A6, 6, (uint8_t)v, 0x7A6);
write_command(0x7A6, 6, (uint8_t)temperature, 0x7A6);
return true;
}
bool Solar::set_wwDisinfectionTemp(const char * value, const int8_t id) {
float v = 0;
if (!Helpers::value2temperature(value, v)) {
int temperature;
if (!Helpers::value2temperature(value, temperature)) {
return false;
}
write_command(0x7A6, 12, (uint8_t)v, 0x7A6);
write_command(0x7A6, 12, (uint8_t)temperature, 0x7A6);
return true;
}
bool Solar::set_wwCirc(const char * value, const int8_t id) {
bool v = false;
if (!Helpers::value2bool(value, v)) {
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
write_command(0x7A5, 0, v ? 0xFF : 0x00, 0x7A5);
write_command(0x7A5, 0, b ? 0xFF : 0x00, 0x7A5);
return true;
}
bool Solar::set_wwCircMode(const char * value, const int8_t id) {
uint8_t n;
if (!Helpers::value2enum(value, n, FL_(enum_wwCircMode))) {
uint8_t num;
if (!Helpers::value2enum(value, num, FL_(enum_wwCircMode))) {
return false;
}
write_command(0x7A5, 3, n, 0x7A5);
write_command(0x7A5, 3, num, 0x7A5);
return true;
}
bool Solar::set_wwKeepWarm(const char * value, const int8_t id) {
bool v = false;
if (!Helpers::value2bool(value, v)) {
bool b;
if (!Helpers::value2bool(value, b)) {
return false;
}
write_command(0x7AE, 0, v ? 0xFF : 0x00, 0x7AE);
write_command(0x7AE, 0, b ? 0xFF : 0x00, 0x7AE);
return true;
}