Skip to content

Commit

Permalink
pc0, pc1 flow, add uom l/h, fix emsesp#2001
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDvP committed Sep 16, 2024
1 parent a6ca131 commit 1c6464a
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 17 deletions.
6 changes: 4 additions & 2 deletions interface/src/app/main/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ export enum DeviceValueUOM {
KMIN,
K,
VOLTS,
MBAR
MBAR,
LH
}

export const DeviceValueUOM_s = [
Expand Down Expand Up @@ -210,7 +211,8 @@ export const DeviceValueUOM_s = [
'K*min',
'K',
'V',
'mbar'
'mbar',
'l/h'
];

export enum AnalogType {
Expand Down
57 changes: 54 additions & 3 deletions src/devices/boiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
register_telegram_type(0x4AF, "HPMeters", true, MAKE_PF_CB(process_HpMeters));
register_telegram_type(0x2CC, "HPPressure", true, MAKE_PF_CB(process_HpPressure));
register_telegram_type(0x4A5, "HPFan", true, MAKE_PF_CB(process_HpFan));
register_telegram_type(0x4AA, "HPPower2", true, MAKE_PF_CB(process_HpPower2));
register_telegram_type(0x4A7, "HPPowerLimit", true, MAKE_PF_CB(process_HpPowerLimit));
register_telegram_type(0x2D6, "HPPump2", true, MAKE_PF_CB(process_HpPump2));
}

// some gas boilers, see #1701
Expand Down Expand Up @@ -827,6 +830,18 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
FL_(hpShutdown),
DeviceValueUOM::NONE,
MAKE_CF_CB(set_shutdown));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &hpCurrPower_, DeviceValueType::UINT16, FL_(hpCurrPower), DeviceValueUOM::W);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&hpPowerLimit_,
DeviceValueType::UINT16,
FL_(hpPowerLimit),
DeviceValueUOM::W,
MAKE_CF_CB(set_hpPowerLimit));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &pc0Flow_, DeviceValueType::INT16, FL_(pc0Flow), DeviceValueUOM::LH);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &pc1Flow_, DeviceValueType::INT16, FL_(pc1Flow), DeviceValueUOM::LH);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &pc1On_, DeviceValueType::BOOL, FL_(pc1On), DeviceValueUOM::NONE);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &pc1Rate_, DeviceValueType::UINT8, FL_(pc1Rate), DeviceValueUOM::PERCENT);

// heatpump DHW settings
register_device_value(DeviceValueTAG::TAG_DHW1,
&wwAlternatingOper_,
Expand Down Expand Up @@ -1382,6 +1397,8 @@ void Boiler::process_UBAMonitorFastPlus(std::shared_ptr<const Telegram> telegram
if (Helpers::hasValue(exhaustTemp1_)) {
has_update(exhaustTemp_, exhaustTemp1_);
}
has_update(telegram, pc0Flow_, 36); // see https://github.com/emsesp/EMS-ESP32/issues/2001

// read 3 char service code / installation status as appears on the display
if ((telegram->message_length > 3) && (telegram->offset == 0)) {
char serviceCode[4] = {0};
Expand Down Expand Up @@ -1919,6 +1936,7 @@ void Boiler::process_HpSilentMode(std::shared_ptr<const Telegram> telegram) {
void Boiler::process_HpValve(std::shared_ptr<const Telegram> telegram) {
// has_bitupdate(telegram, auxHeaterStatus_, 0, 2);
has_update(telegram, auxHeatMixValve_, 7);
has_update(telegram, pc1Rate_, 13); // percent
}

// 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
Expand All @@ -1929,6 +1947,12 @@ void Boiler::process_HpPumps(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, hpPumpMode_, 18);
}

// 0x02D6, https://github.com/emsesp/EMS-ESP32/issues/2001
void Boiler::process_HpPump2(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, pc1On_, 0);
has_update(telegram, pc1Flow_, 9);
}

// 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) {
has_update(telegram, manDefrost_, 0); // off/on
Expand Down Expand Up @@ -2006,6 +2030,16 @@ void Boiler::process_HpFan(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, fan_, 9);
}

// 0x4AA
void Boiler::process_HpPower2(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, hpCurrPower_, 0);
}

// 0x4A7
void Boiler::process_HpPowerLimit(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, hpPowerLimit_, 0);
}

// Boiler(0x08) -B-> All(0x00), ?(0x2E), data: 00 00 1C CE 00 00 05 E8 00 00 00 18 00 00 00 02
void Boiler::process_Meters(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, gasMeterHeat_, 0);
Expand Down Expand Up @@ -2439,9 +2473,16 @@ bool Boiler::set_max_pump(const char * value, const int8_t id) {

bool Boiler::set_pumpMode(const char * value, const int8_t id) {
uint8_t v;
if (Helpers::value2enum(value, v, FL_(enum_pumpMode))) {
write_command(EMS_TYPE_UBAParameters, 11, v, EMS_TYPE_UBAParameters);
return true;
if (is_received(EMS_TYPE_UBAParametersPlus)) {
if (Helpers::value2enum(value, v, FL_(enum_pumpCharacter))) {
write_command(EMS_TYPE_UBAParametersPlus, 15, v, EMS_TYPE_UBAParametersPlus);
return true;
}
} else {
if (Helpers::value2enum(value, v, FL_(enum_pumpMode))) {
write_command(EMS_TYPE_UBAParameters, 11, v, EMS_TYPE_UBAParameters);
return true;
}
}
return false;
}
Expand Down Expand Up @@ -3072,6 +3113,16 @@ bool Boiler::set_hpDiffPress(const char * value, const int8_t id) {
return false;
}

bool Boiler::set_hpPowerLimit(const char * value, const int8_t id) {
int v;
if (Helpers::value2number(value, v)) {
uint8_t data[2] = {(uint8_t)(v >> 8), (uint8_t)v};
write_command(0x4A7, 0, data, 2, 0x4A7);
return true;
}
return false;
}

bool Boiler::set_vp_cooling(const char * value, const int8_t id) {
bool v;
if (Helpers::value2bool(value, v)) {
Expand Down
30 changes: 20 additions & 10 deletions src/devices/boiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,16 +287,22 @@ class Boiler : public EMSdevice {
uint8_t wwEcoStopTemp_;
uint8_t wwEcoPlusStopTemp_;

uint8_t vp_cooling_;
uint8_t heatCable_;
uint8_t VC0valve_;
uint8_t primePump_;
uint8_t primePumpMod_;
uint8_t hp3wayValve_;
uint8_t hp4wayValve_;
uint8_t elHeatStep1_;
uint8_t elHeatStep2_;
uint8_t elHeatStep3_;
uint8_t vp_cooling_;
uint8_t heatCable_;
uint8_t VC0valve_;
uint8_t primePump_;
uint8_t primePumpMod_;
uint8_t hp3wayValve_;
uint8_t hp4wayValve_;
uint8_t elHeatStep1_;
uint8_t elHeatStep2_;
uint8_t elHeatStep3_;
uint16_t hpPowerLimit_;
uint16_t hpCurrPower_;
int16_t pc0Flow_;
int16_t pc1Flow_;
uint8_t pc1Rate_;
uint8_t pc1On_;

// HIU
// uint16_t cwFlowRate_; // cold water flow rate *10
Expand Down Expand Up @@ -364,13 +370,16 @@ class Boiler : public EMSdevice {
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_HpPump2(std::shared_ptr<const Telegram> telegram);
void process_HpDhwSettings(std::shared_ptr<const Telegram> telegram);
void process_HpSettings2(std::shared_ptr<const Telegram> telegram);
void process_HpSettings3(std::shared_ptr<const Telegram> telegram);
void process_HpEnergy(std::shared_ptr<const Telegram> telegram);
void process_HpMeters(std::shared_ptr<const Telegram> telegram);
void process_WeatherComp(std::shared_ptr<const Telegram> telegram);
void process_HpFan(std::shared_ptr<const Telegram> telegram);
void process_HpPower2(std::shared_ptr<const Telegram> telegram);
void process_HpPowerLimit(std::shared_ptr<const Telegram> telegram);

void process_Meters(std::shared_ptr<const Telegram> telegram);
void process_Energy(std::shared_ptr<const Telegram> telegram);
Expand Down Expand Up @@ -468,6 +477,7 @@ class Boiler : public EMSdevice {
bool set_hpPumpMode(const char * value, const int8_t id);
bool set_hpMaxPower(const char * value, const int8_t id);
bool set_hpDiffPress(const char * value, const int8_t id);
bool set_hpPowerLimit(const char * value, const int8_t id);

bool set_auxLimit(const char * value, const int8_t id);
inline bool set_auxMaxLimit(const char * value, const int8_t id) {
Expand Down
2 changes: 1 addition & 1 deletion src/emsdevicevalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const char * DeviceValue::DeviceValueUOM_s[] = {
F_(uom_blank), // 0
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_volts), F_(uom_mbar), F_(uom_blank)
F_(uom_m3), F_(uom_l), F_(uom_kmin), F_(uom_k), F_(uom_volts), F_(uom_mbar), F_(uom_lh), F_(uom_blank)

};

Expand Down
3 changes: 2 additions & 1 deletion src/emsdevicevalue.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class DeviceValue {
K, // 22 - K
VOLTS, // 23 - V
MBAR, // 24 - mbar
CONNECTIVITY // 25 - used in HA
LH, // 25 - l/h
CONNECTIVITY // 26 - used in HA
};

// TAG mapping - maps to DeviceValueTAG_s in emsdevice.cpp
Expand Down
1 change: 1 addition & 0 deletions src/locale_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ MAKE_WORD_CUSTOM(uom_kmin, "K*min")
MAKE_WORD_CUSTOM(uom_k, "K")
MAKE_WORD_CUSTOM(uom_volts, "V")
MAKE_WORD_CUSTOM(uom_mbar, "mbar")
MAKE_WORD_CUSTOM(uom_lh, "l/h")

// MQTT topics and prefixes
MAKE_WORD_CUSTOM(heating_active, "heating_active")
Expand Down
6 changes: 6 additions & 0 deletions src/locale_translations.h
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,10 @@ MAKE_TRANSLATION(heatoffdelay, "heatoffdelay", "heat-off delay", "Heizausschaltv
MAKE_TRANSLATION(hpSetDiffPress, "hpsetdiffpress", "set differental pressure", "Pumpensolldruck", "", "", "różnica ciśnień", "", "", "", "", "nastaviť diferenčný tlak") // TODO translate
MAKE_TRANSLATION(hpFan, "fan", "fan", "Lüfter", "", "", "wentylator", "", "", "", "", "ventilátor") // TODO translate
MAKE_TRANSLATION(hpShutdown, "shutdown", "shutdown", "Abschalten", "", "", "wyłączenie", "", "", "", "", "vypnutie") // TODO translate
MAKE_TRANSLATION(pc0Flow, "pc0flow", "Flow PC0", "Durchfluss PC0", "", "", "", "", "", "", "", "") // TODO translate
MAKE_TRANSLATION(pc1Flow, "pc1flow", "Flow PC1", "Durchfluss PC1", "", "", "", "", "", "", "", "") // TODO translate
MAKE_TRANSLATION(pc1On, "pc1on", "PC1", "PC1", "", "", "", "", "", "", "", "") // TODO translate
MAKE_TRANSLATION(pc1Rate, "pc1rate", "PC1 rate", "PC1 Rate", "", "", "", "", "", "", "", "") // TODO translate

// hybrid heatpump
MAKE_TRANSLATION(hybridStrategy, "hybridstrategy", "hybrid control strategy", "Hybrid-Steuerungsstrategie", "Hybride strategie", "Hybrid kontrollstrategi", "strategia sterowania hybrydowego", "hybrid kontrollstrategi", "stratégie contrôle hybride", "hibrit kontrol stratejisi", "strategia comtrollo ibrido", "hybridná stratégia riadenia")
Expand Down Expand Up @@ -568,6 +572,8 @@ MAKE_TRANSLATION(meterCool, "metercool", "meter cooling", "Messung: Kühlen", ""
MAKE_TRANSLATION(meterWw, "meter", "meter", "Messung", "", "", "licznik", "", "", "", "", "počítadlo") // TODO translate
MAKE_TRANSLATION(gasMeterHeat, "gasmeterheat", "gas meter heating", "Gaszähler: Heizen", "", "", "licznik gazu na ogrzewanie", "", "", "", "", "počítadlo plynu kúrenia") // TODO translate
MAKE_TRANSLATION(gasMeterWw, "gasmeter", "gas meter", "Gaszähler", "", "", "licznik gazu", "", "", "", "", "počítadlo plynu") // TODO translate
MAKE_TRANSLATION(hpCurrPower, "hpcurrpower", "compressor current power", "akt. Kompressorleistung", "", "", "", "", "", "", "", "") // TODO translate
MAKE_TRANSLATION(hpPowerLimit, "hppowerlimit", "power limit", "Leistungsgrenze", "", "", "", "", "", "", "", "") // TODO translate

// HIU
MAKE_TRANSLATION(netFlowTemp, "netflowtemp", "heat network flow temp", "Systemvorlauftemperatur", "Netto aanvoertemperatuur", "", "temp. zasilania sieci cieplnej", "", "", "ısıtma şebekesi akış derecesi", "temperatura di mandata della rete di riscaldamento", "teplota prívodu tepelnej siete") // TODO translate
Expand Down
1 change: 1 addition & 0 deletions src/mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,7 @@ void Mqtt::add_ha_uom(JsonObject doc, const uint8_t type, const uint8_t uom, con
doc["ic"] = F_(iconkb);
break;
case DeviceValueUOM::LMIN:
case DeviceValueUOM::LH:
doc["ic"] = F_(iconlmin);
doc[sc_ha] = F_(measurement);
break;
Expand Down

0 comments on commit 1c6464a

Please sign in to comment.