diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 383ebc6eb..d384ceb02 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -78,6 +78,8 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const if (model() == EMSdevice::EMS_DEVICE_FLAG_HEATPUMP) { register_telegram_type(0x494, F("UBAEnergySupplied"), false, MAKE_PF_CB(process_UBAEnergySupplied)); register_telegram_type(0x495, F("UBAInformation"), false, MAKE_PF_CB(process_UBAInformation)); + register_telegram_type(0x48D, F("HpPower"), false, MAKE_PF_CB(process_HpPower)); + register_telegram_type(0x48F, F("HpOutdoor"), false, MAKE_PF_CB(process_HpOutdoor)); } // MQTT commands for boiler topic register_device_value(TAG_BOILER_DATA, &dummybool_, DeviceValueType::BOOL, nullptr, FL_(wwtapactivated), DeviceValueUOM::NONE, MAKE_CF_CB(set_tapwarmwater_activated)); @@ -140,19 +142,30 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const register_device_value(TAG_BOILER_DATA, &upTimeCompWw_, DeviceValueType::TIME, FL_(div60), FL_(upTimeCompWw), DeviceValueUOM::MINUTES); register_device_value(TAG_BOILER_DATA, &heatingStarts_, DeviceValueType::ULONG, nullptr, FL_(heatingStarts), DeviceValueUOM::NONE); register_device_value(TAG_BOILER_DATA, &coolingStarts_, DeviceValueType::ULONG, nullptr, FL_(coolingStarts), DeviceValueUOM::NONE); - register_device_value(TAG_BOILER_DATA, &nrgConsTotal_, DeviceValueType::ULONG, nullptr, FL_(nrgConsTotal), DeviceValueUOM::NONE); - register_device_value(TAG_BOILER_DATA, &nrgConsCompTotal_, DeviceValueType::ULONG, nullptr, FL_(nrgConsCompTotal), DeviceValueUOM::NONE); - register_device_value(TAG_BOILER_DATA, &nrgConsCompHeating_, DeviceValueType::ULONG, nullptr, FL_(nrgConsCompHeating), DeviceValueUOM::NONE); - register_device_value(TAG_BOILER_DATA, &nrgConsCompWw_, DeviceValueType::ULONG, nullptr, FL_(nrgConsCompWw), DeviceValueUOM::NONE); - register_device_value(TAG_BOILER_DATA, &nrgConsCompCooling_, DeviceValueType::ULONG, nullptr, FL_(nrgConsCompCooling), DeviceValueUOM::NONE); - register_device_value(TAG_BOILER_DATA, &auxElecHeatNrgConsTotal_, DeviceValueType::ULONG, nullptr, FL_(auxElecHeatNrgConsTotal), DeviceValueUOM::NONE); - register_device_value(TAG_BOILER_DATA, &auxElecHeatNrgConsHeating_, DeviceValueType::ULONG, nullptr, FL_(auxElecHeatNrgConsHeating), DeviceValueUOM::NONE); - register_device_value(TAG_BOILER_DATA, &auxElecHeatNrgConsWW_, DeviceValueType::ULONG, nullptr, FL_(auxElecHeatNrgConsWW), DeviceValueUOM::NONE); - - register_device_value(TAG_BOILER_DATA, &nrgSuppTotal_, DeviceValueType::ULONG, nullptr, FL_(nrgSuppTotal), DeviceValueUOM::NONE); - register_device_value(TAG_BOILER_DATA, &nrgSuppHeating_, DeviceValueType::ULONG, nullptr, FL_(nrgSuppHeating), DeviceValueUOM::NONE); - register_device_value(TAG_BOILER_DATA, &nrgSuppWw_, DeviceValueType::ULONG, nullptr, FL_(nrgSuppWw), DeviceValueUOM::NONE); - register_device_value(TAG_BOILER_DATA, &nrgSuppCooling_, DeviceValueType::ULONG, nullptr, FL_(nrgSuppCooling), DeviceValueUOM::NONE); + register_device_value(TAG_BOILER_DATA, &nrgConsTotal_, DeviceValueType::ULONG, nullptr, FL_(nrgConsTotal), DeviceValueUOM::KWH); + register_device_value(TAG_BOILER_DATA, &nrgConsCompTotal_, DeviceValueType::ULONG, nullptr, FL_(nrgConsCompTotal), DeviceValueUOM::KWH); + register_device_value(TAG_BOILER_DATA, &nrgConsCompHeating_, DeviceValueType::ULONG, nullptr, FL_(nrgConsCompHeating), DeviceValueUOM::KWH); + register_device_value(TAG_BOILER_DATA, &nrgConsCompWw_, DeviceValueType::ULONG, nullptr, FL_(nrgConsCompWw), DeviceValueUOM::KWH); + register_device_value(TAG_BOILER_DATA, &nrgConsCompCooling_, DeviceValueType::ULONG, nullptr, FL_(nrgConsCompCooling), DeviceValueUOM::KWH); + register_device_value(TAG_BOILER_DATA, &auxElecHeatNrgConsTotal_, DeviceValueType::ULONG, nullptr, FL_(auxElecHeatNrgConsTotal), DeviceValueUOM::KWH); + register_device_value(TAG_BOILER_DATA, &auxElecHeatNrgConsHeating_, DeviceValueType::ULONG, nullptr, FL_(auxElecHeatNrgConsHeating), DeviceValueUOM::KWH); + register_device_value(TAG_BOILER_DATA, &auxElecHeatNrgConsWW_, DeviceValueType::ULONG, nullptr, FL_(auxElecHeatNrgConsWW), DeviceValueUOM::KWH); + register_device_value(TAG_BOILER_DATA, &nrgSuppTotal_, DeviceValueType::ULONG, nullptr, FL_(nrgSuppTotal), DeviceValueUOM::KWH); + register_device_value(TAG_BOILER_DATA, &nrgSuppHeating_, DeviceValueType::ULONG, nullptr, FL_(nrgSuppHeating), DeviceValueUOM::KWH); + register_device_value(TAG_BOILER_DATA, &nrgSuppWw_, DeviceValueType::ULONG, nullptr, FL_(nrgSuppWw), DeviceValueUOM::KWH); + register_device_value(TAG_BOILER_DATA, &nrgSuppCooling_, DeviceValueType::ULONG, nullptr, FL_(nrgSuppCooling), DeviceValueUOM::KWH); + register_device_value(TAG_BOILER_DATA, &hpPower_, DeviceValueType::UINT, FL_(div10), FL_(hpPower), DeviceValueUOM::KW); + register_device_value(TAG_BOILER_DATA, &hpTc0_, DeviceValueType::SHORT, FL_(div10), FL_(hpTc0), DeviceValueUOM::DEGREES); + register_device_value(TAG_BOILER_DATA, &hpTc1_, DeviceValueType::SHORT, FL_(div10), FL_(hpTc1), DeviceValueUOM::DEGREES); + register_device_value(TAG_BOILER_DATA, &hpTc3_, DeviceValueType::SHORT, FL_(div10), FL_(hpTc3), DeviceValueUOM::DEGREES); + register_device_value(TAG_BOILER_DATA, &hpTr3_, DeviceValueType::SHORT, FL_(div10), FL_(hpTr3), DeviceValueUOM::DEGREES); + register_device_value(TAG_BOILER_DATA, &hpTr4_, DeviceValueType::SHORT, FL_(div10), FL_(hpTr4), DeviceValueUOM::DEGREES); + register_device_value(TAG_BOILER_DATA, &hpTr5_, DeviceValueType::SHORT, FL_(div10), FL_(hpTr5), DeviceValueUOM::DEGREES); + register_device_value(TAG_BOILER_DATA, &hpTr6_, DeviceValueType::SHORT, FL_(div10), FL_(hpTr6), DeviceValueUOM::DEGREES); + register_device_value(TAG_BOILER_DATA, &hpTr7_, DeviceValueType::SHORT, FL_(div10), FL_(hpTr7), DeviceValueUOM::DEGREES); + register_device_value(TAG_BOILER_DATA, &hpTl2_, DeviceValueType::SHORT, FL_(div10), FL_(hpTl2), DeviceValueUOM::DEGREES); + register_device_value(TAG_BOILER_DATA, &hpPl1_, DeviceValueType::SHORT, FL_(div10), FL_(hpPl1), DeviceValueUOM::DEGREES); + register_device_value(TAG_BOILER_DATA, &hpPh1_, DeviceValueType::SHORT, FL_(div10), FL_(hpPh1), DeviceValueUOM::DEGREES); } // warm water - boiler_data_ww topic @@ -571,6 +584,27 @@ void Boiler::process_UBAEnergySupplied(std::shared_ptr telegram) has_update(telegram->read_value(nrgSuppCooling_, 16)); } +// Heatpump power - type 0x48D +void Boiler::process_HpPower(std::shared_ptr telegram){ + has_update(telegram->read_value(hpPower_, 11)); + +} + +// Heatpump outdoor unit - type 0x48F +void Boiler::process_HpOutdoor(std::shared_ptr telegram){ + has_update(telegram->read_value(hpTc0_, 6)); + has_update(telegram->read_value(hpTc1_, 4)); + has_update(telegram->read_value(hpTc3_, 2)); + has_update(telegram->read_value(hpTr3_, 16)); + has_update(telegram->read_value(hpTr4_, 18)); + has_update(telegram->read_value(hpTr5_, 20)); + has_update(telegram->read_value(hpTr6_, 0)); + has_update(telegram->read_value(hpTr7_, 31)); + has_update(telegram->read_value(hpTl2_, 12)); + has_update(telegram->read_value(hpPl1_, 27)); + has_update(telegram->read_value(hpPh1_, 29)); +} + // 0x2A - MC110Status // e.g. 88 00 2A 00 00 00 00 00 00 00 00 00 D2 00 00 80 00 00 01 08 80 00 02 47 00 // see https://github.com/emsesp/EMS-ESP/issues/397 diff --git a/src/devices/boiler.h b/src/devices/boiler.h index fc78d971a..87a239192 100644 --- a/src/devices/boiler.h +++ b/src/devices/boiler.h @@ -154,6 +154,20 @@ class Boiler : public EMSdevice { uint8_t maintenanceType_; uint16_t maintenanceTime_; + // heatpump + uint8_t hpPower_; + int16_t hpTc0_; + int16_t hpTc1_; + int16_t hpTc3_; + int16_t hpTr3_; + int16_t hpTr4_; + int16_t hpTr5_; + int16_t hpTr6_; + int16_t hpTr7_; + int16_t hpTl2_; + int16_t hpPl1_; + int16_t hpPh1_; + void process_UBAParameterWW(std::shared_ptr telegram); void process_UBAMonitorFast(std::shared_ptr telegram); void process_UBATotalUptime(std::shared_ptr telegram); @@ -177,6 +191,8 @@ class Boiler : public EMSdevice { void process_UBAEnergySupplied(std::shared_ptr telegram); void process_CascadeMessage(std::shared_ptr telegram); void process_UBASettingsWW(std::shared_ptr telegram); + void process_HpPower(std::shared_ptr telegram); + void process_HpOutdoor(std::shared_ptr telegram); // commands - none of these use the additional id parameter bool set_warmwater_mode(const char * value, const int8_t id); diff --git a/src/devices/mixer.cpp b/src/devices/mixer.cpp index 88f9af118..ba3dee030 100644 --- a/src/devices/mixer.cpp +++ b/src/devices/mixer.cpp @@ -69,8 +69,8 @@ Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const s uint8_t tag = TAG_WWC1 + hc_ - 1; register_device_value(tag, &id_, DeviceValueType::UINT, nullptr, FL_(ID), DeviceValueUOM::NONE); register_device_value(tag, &flowTempHc_, DeviceValueType::USHORT, FL_(div10), FL_(wwTemp), DeviceValueUOM::DEGREES); - register_device_value(tag, &pumpStatus_, DeviceValueType::BOOL, nullptr, FL_(pumpStatus), DeviceValueUOM::PUMP); - register_device_value(tag, &status_, DeviceValueType::INT, nullptr, FL_(tempStatus), DeviceValueUOM::NONE); + register_device_value(tag, &pumpStatus_, DeviceValueType::BOOL, nullptr, FL_(wwPumpStatus), DeviceValueUOM::PUMP); + register_device_value(tag, &status_, DeviceValueType::INT, nullptr, FL_(wwTempStatus), DeviceValueUOM::NONE); } id_ = product_id; diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index 9bdffff51..7009ad97a 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -33,7 +33,8 @@ static const __FlashStringHelper * DeviceValueUOM_s[] __attribute__((__aligned__ F_(hours), F_(minutes), F_(ua), - F_(bar) + F_(bar), + F_(kw) }; @@ -649,11 +650,11 @@ bool EMSdevice::get_value_info(JsonObject & root, const char * cmd, const int8_t // search device value with this tag for (auto & dv : devicevalues_) { - if (strcmp(cmd, uuid::read_flash_string(dv.short_name).c_str()) == 0 && (tag <= 0 || tag == dv.tag)) { + if (strcmp(cmd, Helpers::toLower(uuid::read_flash_string(dv.short_name)).c_str()) == 0 && (tag <= 0 || tag == dv.tag)) { uint8_t divider = (dv.options_size == 1) ? Helpers::atoint(uuid::read_flash_string(dv.options[0]).c_str()) : 0; json["name"] = dv.short_name; - if (dv.tag >= DeviceValueTAG::TAG_HC1) { - json["circuit"] = tag_to_string(dv.tag); + if (!tag_to_mqtt(dv.tag).empty()) { + json["circuit"] = tag_to_mqtt(dv.tag); } switch (dv.type) { case DeviceValueType::ENUM: { diff --git a/src/emsdevice.h b/src/emsdevice.h index 1f0c1560c..06d54d7fd 100644 --- a/src/emsdevice.h +++ b/src/emsdevice.h @@ -57,7 +57,7 @@ enum DeviceValueType : uint8_t { // Unit Of Measurement mapping - maps to DeviceValueUOM_s in emsdevice.cpp // uom - also used with HA // sequence is important! -enum DeviceValueUOM : uint8_t { NONE = 0, DEGREES, PERCENT, LMIN, KWH, WH, HOURS, MINUTES, UA, BAR, PUMP }; +enum DeviceValueUOM : uint8_t { NONE = 0, DEGREES, PERCENT, LMIN, KWH, WH, HOURS, MINUTES, UA, BAR, KW, PUMP }; // TAG mapping - maps to DeviceValueTAG_s in emsdevice.cpp enum DeviceValueTAG : uint8_t { diff --git a/src/locale_EN.h b/src/locale_EN.h index f4d4ad6c3..7b6a36eda 100644 --- a/src/locale_EN.h +++ b/src/locale_EN.h @@ -160,6 +160,7 @@ MAKE_PSTR(minutes, "minutes") MAKE_PSTR(hours, "hours") MAKE_PSTR(ua, "uA") MAKE_PSTR(lmin, "l/min") +MAKE_PSTR(kw, "kW") // TAG mapping - maps to DeviceValueTAG_s in emsdevice.cpp // use empty string if want to suppress showing tags @@ -318,7 +319,7 @@ MAKE_PSTR_LIST(enum_hamode, F_(off), F_(heat), F_(auto), F_(heat), F_(off), F_(h */ MAKE_PSTR(homeassistant, "homeassistant/") -// if for all devices +// id for all devices // empty full name to prevent being shown in web or console MAKE_PSTR_LIST(ID, F_(id)) @@ -395,6 +396,19 @@ MAKE_PSTR_LIST(auxElecHeatNrgConsTotal, F("auxelecheatnrgconstotal"), F("auxilia MAKE_PSTR_LIST(auxElecHeatNrgConsHeating, F("auxelecheatnrgconsheating"), F("auxiliary electrical heater energy consumption heating")) MAKE_PSTR_LIST(auxElecHeatNrgConsWW, F("auxelecheatnrgconsww"), F("auxiliary electrical heater energy consumption")) +MAKE_PSTR_LIST(hpPower, F("hppower"), F("heatpump power")) +MAKE_PSTR_LIST(hpTc0, F("hptc0"), F("water temperature condenser inlet (TC0)")) +MAKE_PSTR_LIST(hpTc1, F("hptc1"), F("water temperture condenser output (TC1)")) +MAKE_PSTR_LIST(hpTc3, F("hptc3"), F("condenser temperature (TC3)")) +MAKE_PSTR_LIST(hpTr3, F("hptr3"), F("refrigerant temperature liquid side (condenser output) (TR3)")) +MAKE_PSTR_LIST(hpTr4, F("hptr4"), F("evaporator inlet temperature (TR4)")) +MAKE_PSTR_LIST(hpTr5, F("hptr5"), F("compressor Inlet temperature (TR5)")) +MAKE_PSTR_LIST(hpTr6, F("hptr6"), F("compressor outlet temperature (TR6)")) +MAKE_PSTR_LIST(hpTr7, F("hptr7"), F("refrigerant temperature gas side (condenser input) (TR7)")) +MAKE_PSTR_LIST(hpTl2, F("hptl2"), F("air inlet temperature (TL2)")) +MAKE_PSTR_LIST(hpPl1, F("hppl1"), F("low pressure side temperature (PL1)")) +MAKE_PSTR_LIST(hpPh1, F("hpph1"), F("high pressure side temperature (PH1)")) + MAKE_PSTR_LIST(wWSelTemp, F("wwseltemp"), F("selected temperature")) MAKE_PSTR_LIST(wWSetTemp, F("wwsettemp"), F("set temperature")) MAKE_PSTR_LIST(wWType, F("wwtype"), F("type")) @@ -418,7 +432,7 @@ MAKE_PSTR_LIST(wWCharging, F("wwcharging"), F("charging")) MAKE_PSTR_LIST(wWRecharging, F("wwrecharging"), F("recharging")) MAKE_PSTR_LIST(wWTempOK, F("wwtempok"), F("temperature ok")) MAKE_PSTR_LIST(wWActive, F("wwactive"), F("active")) -MAKE_PSTR_LIST(wWHeat, F("wwHeat"), F("heating")) +MAKE_PSTR_LIST(wWHeat, F("wwheat"), F("heating")) MAKE_PSTR_LIST(wWSetPumpPower, F("wwsetpumppower"), F("pump set power")) MAKE_PSTR_LIST(mixerTemp, F("mixertemp"), F("mixer temperature")) MAKE_PSTR_LIST(tankMiddleTemp, F("tankmiddletemp"), F("tank middle temperature (TS3)")) @@ -506,7 +520,8 @@ 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(tempStatus, F("tempstatus"), F("temperature switch in assigned hc (MC1)")) +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 warm water temperature")) // solar