Merge branch 'emsesp:dev' into dev

This commit is contained in:
pswid
2022-12-20 19:11:07 +01:00
committed by GitHub
13 changed files with 380 additions and 252 deletions

View File

@@ -184,7 +184,9 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
register_telegram_type(0x488, "HPValve", true, MAKE_PF_CB(process_HpValve));
register_telegram_type(0x484, "HPSilentMode", true, MAKE_PF_CB(process_HpSilentMode));
register_telegram_type(0x48B, "HPPumps", true, MAKE_PF_CB(process_HpPumps));
register_telegram_type(0x491, "HPAdditionalHeater", true, MAKE_PF_CB(process_HpAdditionalHeater));
register_telegram_type(0x499, "HPDhwSettings", true, MAKE_PF_CB(process_HpDhwSettings));
}
/*
@@ -625,6 +627,41 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
DeviceValueUOM::DEGREES,
MAKE_CF_CB(set_tempParMode));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &auxHeatMixValve_, DeviceValueType::INT, FL_(auxHeatMixValve), DeviceValueUOM::PERCENT);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&tempDiffHeat_,
DeviceValueType::UINT,
DeviceValueNumOp::DV_NUMOP_DIV10,
FL_(tempDiffHeat),
DeviceValueUOM::K,
MAKE_CF_CB(set_tempDiffHeat),
3,
10);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&tempDiffCool_,
DeviceValueType::UINT,
DeviceValueNumOp::DV_NUMOP_DIV10,
FL_(tempDiffCool),
DeviceValueUOM::K,
MAKE_CF_CB(set_tempDiffCool),
3,
10);
// heatpump DHW settings
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
&wwComfOffTemp_,
DeviceValueType::UINT,
FL_(wwComfOffTemp),
DeviceValueUOM::DEGREES,
MAKE_CF_CB(set_wwComfOffTemp),
15,
65);
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
&wwEcoOffTemp_,
DeviceValueType::UINT,
FL_(wwEcoOffTemp),
DeviceValueUOM::DEGREES,
MAKE_CF_CB(set_wwEcoOffTemp),
15,
65);
}
// dhw - DEVICE_DATA_ww topic
@@ -1267,6 +1304,7 @@ void Boiler::process_HpInConfig(std::shared_ptr<const Telegram> telegram) {
has_update(hpInput[3].option, option, 12);
}
// Boiler(0x08) -W-> Me(0x0B), HpHeaterConfig(0x0492), data: 03 00 00 04 00
void Boiler::process_HpHeaterConfig(std::shared_ptr<const Telegram> telegram) {
has_update(maxHeatComp_, 2);
has_update(maxHeatHeat_, 3);
@@ -1537,6 +1575,12 @@ void Boiler::process_HpValve(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, auxHeatMixValve_, 7);
}
// Boiler(0x08) -B-> All(0x00), ?(0x048B), data: 00 00 0A 1E 4E 00 1E 01 2C 00 01 64 55 05 12 50 50 50 00 00 1E 01 2C 00
// Boiler(0x08) -B-> All(0x00), ?(0x048B), data: 00 1E 00 96 00 1E (offset 24)
void Boiler::process_HpPumps(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, tempDiffHeat_, 4); // is * 10
has_update(telegram, tempDiffCool_, 3); // is * 10
}
// Boiler(0x08) -> All(0x00), ?(0x0491), data: 03 01 00 00 00 02 64 00 00 14 01 2C 00 0A 00 1E 00 1E 00 00 1E 0A 1E 05 05
void Boiler::process_HpAdditionalHeater(std::shared_ptr<const Telegram> telegram) {
@@ -1546,6 +1590,13 @@ void Boiler::process_HpAdditionalHeater(std::shared_ptr<const Telegram> telegram
has_update(telegram, auxHeaterDelay_, 16); // is / 10
}
// DHW 0x499
// Boiler(0x08) -B-> All(0x00), ?(0x0499), data: 31 33 3F 3B 01
void Boiler::process_HpDhwSettings(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, wwComfOffTemp_, 1);
has_update(telegram, wwEcoOffTemp_, 0);
}
// Settings AM200
// pos 12: off(00)/Keelbypass(01)/(hc1pump(02) only standalone)
@@ -2526,7 +2577,7 @@ bool Boiler::set_tempParMode(const char * value, const int8_t id) {
bool Boiler::set_additionalHeaterDelay(const char * value, const int8_t id) {
int v;
if (Helpers::value2number(value, v)) {
v /= 5;
v /= 10;
uint8_t data[2] = {(uint8_t)(v >> 8), (uint8_t)v};
write_command(0x491, 16, data, 2, 0x491);
return true;
@@ -2537,11 +2588,30 @@ bool Boiler::set_additionalHeaterDelay(const char * value, const int8_t id) {
bool Boiler::set_hpHyst(const char * value, const int8_t id) {
int v;
if (Helpers::value2number(value, v)) {
v /= 10;
v /= 5;
uint8_t data[2] = {(uint8_t)(v >> 8), (uint8_t)v};
write_command(0x484, id, data, 2, 0x484);
return true;
}
return false;
}
bool Boiler::set_tempDiff(const char * value, const int8_t id) {
float v;
if (Helpers::value2float(value, v)) {
write_command(0x48B, id, (uint8_t)(v * 10), 0x48B);
return true;
}
return false;
}
bool Boiler::set_wwOffTemp(const char * value, const int8_t id) {
int v;
if (Helpers::value2number(value, v)) {
write_command(0x499, id, v, 0x499);
return true;
}
return false;
}
} // namespace emsesp

View File

@@ -253,6 +253,11 @@ class Boiler : public EMSdevice {
uint16_t hpHystHeat_;
uint16_t hpHystCool_;
uint16_t hpHystPool_;
uint8_t tempDiffHeat_;
uint8_t tempDiffCool_;
uint8_t wwComfOffTemp_;
uint8_t wwEcoOffTemp_;
/*
// Hybrid heatpump with telegram 0xBB is readable and writeable in boiler and thermostat
@@ -308,6 +313,8 @@ class Boiler : public EMSdevice {
void process_HpSilentMode(std::shared_ptr<const Telegram> telegram);
void process_HpAdditionalHeater(std::shared_ptr<const Telegram> telegram);
void process_HpValve(std::shared_ptr<const Telegram> telegram);
void process_HpPumps(std::shared_ptr<const Telegram> telegram);
void process_HpDhwSettings(std::shared_ptr<const Telegram> telegram);
// commands - none of these use the additional id parameter
bool set_ww_mode(const char * value, const int8_t id);
@@ -409,6 +416,20 @@ class Boiler : public EMSdevice {
inline bool set_hpHystPool(const char * value, const int8_t id) {
return set_hpHyst(value, 33);
}
bool set_tempDiff(const char * value, const int8_t id);
inline bool set_tempDiffHeat(const char * value, const int8_t id) {
return set_tempDiff(value, 4);
}
inline bool set_tempDiffCool(const char * value, const int8_t id) {
return set_tempDiff(value, 3);
}
bool set_wwOffTemp(const char * value, const int8_t id);
inline bool set_wwComfOffTemp(const char * value, const int8_t id) {
return set_wwOffTemp(value, 1);
}
inline bool set_wwEcoOffTemp(const char * value, const int8_t id) {
return set_wwOffTemp(value, 0);
}
/*
bool set_hybridStrategy(const char * value, const int8_t id);

View File

@@ -105,9 +105,9 @@ DeviceValue::DeviceValue(uint8_t device_type,
// must be an int of 4 bytes, 32bit aligned
const char * DeviceValue::DeviceValueUOM_s[] = {
F_(uom_blank), F_(uom_degrees), F_(uom_degrees), F_(uom_percent), F_(uom_lmin), F_(uom_kwh), F_(uom_wh), FL_(hours)[0],
FL_(minutes)[0], F_(uom_ua), F_(uom_bar), F_(uom_kw), F_(uom_w), F_(uom_kb), FL_(seconds)[0], F_(uom_dbm),
F_(uom_fahrenheit), F_(uom_mv), F_(uom_sqm), F_(uom_m3), F_(uom_l), F_(uom_kmin), F_(uom_blank) // connectivity
F_(uom_blank), F_(uom_degrees), F_(uom_degrees), F_(uom_percent), F_(uom_lmin), F_(uom_kwh), F_(uom_wh), FL_(hours)[0], FL_(minutes)[0],
F_(uom_ua), F_(uom_bar), F_(uom_kw), F_(uom_w), F_(uom_kb), FL_(seconds)[0], F_(uom_dbm), F_(uom_fahrenheit), F_(uom_mv),
F_(uom_sqm), F_(uom_m3), F_(uom_l), F_(uom_kmin), F_(uom_k), F_(uom_blank)
};

View File

@@ -49,27 +49,28 @@ class DeviceValue {
enum DeviceValueUOM : uint8_t {
NONE = 0, // 0
DEGREES, // 1
DEGREES_R, // 2
DEGREES_R, // 2 - relative temperature
PERCENT, // 3
LMIN, // 4
KWH, // 5
WH, // 6
LMIN, // 4 - l/min
KWH, // 5 - kWh
WH, // 6 - Wh
HOURS, // 7
MINUTES, // 8
UA, // 9
UA, // 9 - µA
BAR, // 10
KW, // 11
KW, // 11 - kW
W, // 12
KB, // 13
SECONDS, // 14
DBM, // 15
DBM, // 15 - dBm
FAHRENHEIT, // 16
MV, // 17
SQM, // 18 square meter
M3, // 19 cubic meter
L, // 20
MV, // 17 - mV
SQM, // 18 - square meter
M3, // 19 - cubic meter
L, // 20 - liter
KMIN, // 21 - Kelvin * minutes
CONNECTIVITY // 22 - used in HA
K, // 22 - Kelvin
CONNECTIVITY // 23 - used in HA
};
// TAG mapping - maps to DeviceValueTAG_s in emsdevice.cpp

View File

@@ -522,7 +522,7 @@ bool Helpers::hasValue(const uint16_t & value) {
}
bool Helpers::hasValue(const uint32_t & value) {
return (value != EMS_VALUE_ULONG_NOTSET);
return (value < EMS_VALUE_ULONG_NOTSET);
}
// checks if we can convert a char string to an int value

View File

@@ -216,6 +216,7 @@ MAKE_PSTR(uom_sqm, "m²")
MAKE_PSTR(uom_m3, "")
MAKE_PSTR(uom_l, "l")
MAKE_PSTR(uom_kmin, "K*min")
MAKE_PSTR(uom_k, "K")
// MQTT topics and prefixes
MAKE_PSTR(heating_active, "heating_active")

View File

@@ -376,9 +376,14 @@ MAKE_PSTR_LIST(auxHeaterDelay, "auxheaterdelay", "auxilliary heater on delay", "
MAKE_PSTR_LIST(minTempSilent, "mintempsilent", "min. outside temp. for silent mode", "Minimale Aussentemperatur Silentmodus", " Stiller gebruik min. buitentemp", "", "", "", "Fct silencieux: Temp. extérieure min.")
MAKE_PSTR_LIST(tempParMode, "tempparmode", "outside temp. parallel mode", "Aussentemperatur Parallelmodus", "Buitentemp. parallelbedr", "", "", "", "Temp. ext. fct parallèle")
MAKE_PSTR_LIST(auxHeatMixValve, "auxheatmix", "aux. heater mixing valve", "Mischer Zusatzheizer", "Bijverwarming menger", "", "", "", "Chauffage auxiliaire mélangeur")
MAKE_PSTR_LIST(hpHystHeat, "hphystheat", "HP on/off hyst heat", "Schalthysterese Heizen", "Aan/uit-hysteresis in verw. bedrijf", "På/av-hystereses Husv.", "Histerez wł/wył Ogrzew.", "På/av-hysterese Oppvar.", "Hystérésis Marche en mode chauffage")
MAKE_PSTR_LIST(hpHystHeat, "hphystheat", "on/off hyst heat", "Schalthysterese Heizen", "Aan/uit-hysteresis in verw. bedrijf", "På/av-hystereses Husv.", "Histerez wł/wył Ogrzew.", "På/av-hysterese Oppvar.", "Hystérésis Marche en mode chauffage")
MAKE_PSTR_LIST(hpHystCool, "hphystcool", "on/off hyst cool", "Schalthysterese Kühlen", "Aan/uit-hysteresis in koelbedrijf ", "", "", "", "Hystérésis Marche en mode refroidissement")
MAKE_PSTR_LIST(hpHystPool, "hphystpool", "on/off hyst pool", "Schalthysterese Pool", "an/uit-hysteresis in zwembadbedri", "", "", "", "Hystérésis Marche en mode piscine")
MAKE_PSTR_LIST(tempDiffHeat, "tempdiffheat", "temp. diff. TC3/TC0 heat", "Temp.diff. TC3/TC0 Heizen", "Temp.vers. TC3/TC0 verw", "", "", "", "Delta T TC3/TC0 Chauff")
MAKE_PSTR_LIST(tempDiffCool, "tempdiffcool", "temp. diff. TC3/TC0 cool", "Temp.diff. TC3/TC0 Kühlen", "Temp.vers. TC3/TC0 koel.", "", "", "", "Delta T TC3/TC0 Refroid.")
MAKE_PSTR_LIST(wwComfOffTemp, "wwcomfoff", "comfort switch off", "Komfort Ausschalttemp", "Comfort Uitschakeltemp.", "", "", "", "Confort Temp. d'arrêt")
MAKE_PSTR_LIST(wwEcoOffTemp, "wwecooff", "eco switch off", "ECO Ausschalttemp", "Eco Uitschakeltemp.", "", "", "", "Eco Temp. d'arrêt")
// hybrid heatpump
MAKE_PSTR_LIST(hybridStrategy, "hybridstrategy", "hybrid control strategy", "Hybrid Strategie", "Hybride strategie", "Hybrid kontrollstrategi", "strategia sterowania hybrydowego", "hybrid kontrollstrategi", "stratégie contrôle hybride")

View File

@@ -1119,6 +1119,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
switch (uom) {
case DeviceValueUOM::DEGREES:
case DeviceValueUOM::DEGREES_R:
case DeviceValueUOM::K:
doc[ic_ha] = F_(icondegrees);
break;
case DeviceValueUOM::PERCENT:
@@ -1184,6 +1185,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
switch (uom) {
case DeviceValueUOM::DEGREES:
case DeviceValueUOM::DEGREES_R:
case DeviceValueUOM::K:
doc[sc_ha] = F_(measurement);
doc[dc_ha] = "temperature"; // no icon needed
break;

View File

@@ -47,6 +47,7 @@ static constexpr int8_t EMS_VALUE_INT_NOTSET = 0x7F; // for signed 8-
static constexpr uint16_t EMS_VALUE_USHORT_NOTSET = 0x7D00; // 32000: for 2-byte unsigned shorts
static constexpr int16_t EMS_VALUE_SHORT_NOTSET = 0x7D00; // 32000: for 2-byte signed shorts
static constexpr uint32_t EMS_VALUE_ULONG_NOTSET = 0x00FFFFFF; // for 3-byte and 4-byte longs
// 4 byte value is 21474836 (0x147AE14), we use only the lower one, see https://github.com/emsesp/EMS-ESP32/issues/820
static constexpr uint8_t EMS_MAX_TELEGRAM_LENGTH = 32; // max length of a complete EMS telegram
static constexpr uint8_t EMS_MAX_TELEGRAM_MESSAGE_LENGTH = 27; // max length of message block, assuming EMS1.0