ha optimistic, cs6800 changes, custom entity hide

This commit is contained in:
MichaelDvP
2025-05-10 13:38:19 +02:00
parent dc1094b6ba
commit b3320c3e48
26 changed files with 320 additions and 166 deletions

View File

@@ -68,7 +68,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
register_telegram_type(0x28, "WeatherComp", true, MAKE_PF_CB(process_WeatherComp));
}
if (model() == EMSdevice::EMS_DEVICE_FLAG_HEATPUMP) {
if (!isHeatPump()) {
register_telegram_type(0x494, "UBAEnergySupplied", false, MAKE_PF_CB(process_UBAEnergySupplied));
register_telegram_type(0x495, "UBAInformation", false, MAKE_PF_CB(process_UBAInformation));
register_telegram_type(0x48D, "HpPower", true, MAKE_PF_CB(process_HpPower));
@@ -96,7 +96,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
}
// some gas boilers, see #1701
if (model() != EMSdevice::EMS_DEVICE_FLAG_HEATPUMP) {
if (!isHeatPump()) {
register_telegram_type(0x2E, "Meters", false, MAKE_PF_CB(process_Meters));
register_telegram_type(0x3B, "Energy", false, MAKE_PF_CB(process_Energy));
}
@@ -187,7 +187,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
DeviceValueUOM::DEGREES);
// exclude burner related entities from heatpump and HIU
if (model() != EMSdevice::EMS_DEVICE_FLAG_HEATPUMP && model() != EMSdevice::EMS_DEVICE_FLAG_HIU) {
if (!isHeatPump() && model() != EMSdevice::EMS_DEVICE_FLAG_HIU) {
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&exhaustTemp_,
DeviceValueType::UINT16,
@@ -411,7 +411,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
99);
}
*/
if (model() != EMSdevice::EMS_DEVICE_FLAG_HEATPUMP) {
if (!isHeatPump()) {
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&meterHeat_,
DeviceValueType::UINT24,
@@ -436,7 +436,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
}
// heatpump info
if (model() == EMSdevice::EMS_DEVICE_FLAG_HEATPUMP) {
if (isHeatPump()) {
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&nrgTotal_,
DeviceValueType::UINT24,
@@ -655,27 +655,51 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
FL_(hpIn4Opt),
DeviceValueUOM::NONE,
MAKE_CF_CB(set_HpIn4Logic));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&maxHeatComp_,
DeviceValueType::ENUM,
FL_(enum_maxHeat),
FL_(maxHeatComp),
DeviceValueUOM::NONE,
MAKE_CF_CB(set_maxHeatComp));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&maxHeatHeat_,
DeviceValueType::ENUM,
FL_(enum_maxHeat),
FL_(maxHeatHeat),
DeviceValueUOM::NONE,
MAKE_CF_CB(set_maxHeatHeat));
register_device_value(DeviceValueTAG::TAG_DHW1,
&maxHeatDhw_,
DeviceValueType::ENUM,
FL_(enum_maxHeat),
FL_(maxHeatDhw),
DeviceValueUOM::NONE,
MAKE_CF_CB(set_maxHeatDhw));
if (model() == EMSdevice::EMS_DEVICE_FLAG_CS6800) {
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&maxHeatComp_,
DeviceValueType::ENUM,
FL_(enum_maxHeat1),
FL_(maxHeatComp),
DeviceValueUOM::NONE,
MAKE_CF_CB(set_maxHeatComp));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&maxHeatHeat_,
DeviceValueType::ENUM,
FL_(enum_maxHeat2),
FL_(maxHeatHeat),
DeviceValueUOM::NONE,
MAKE_CF_CB(set_maxHeatHeat));
register_device_value(DeviceValueTAG::TAG_DHW1,
&maxHeatDhw_,
DeviceValueType::ENUM,
FL_(enum_maxHeat2),
FL_(maxHeatDhw),
DeviceValueUOM::NONE,
MAKE_CF_CB(set_maxHeatDhw));
} else {
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&maxHeatComp_,
DeviceValueType::ENUM,
FL_(enum_maxHeat),
FL_(maxHeatComp),
DeviceValueUOM::NONE,
MAKE_CF_CB(set_maxHeatComp));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&maxHeatHeat_,
DeviceValueType::ENUM,
FL_(enum_maxHeat),
FL_(maxHeatHeat),
DeviceValueUOM::NONE,
MAKE_CF_CB(set_maxHeatHeat));
register_device_value(DeviceValueTAG::TAG_DHW1,
&maxHeatDhw_,
DeviceValueType::ENUM,
FL_(enum_maxHeat),
FL_(maxHeatDhw),
DeviceValueUOM::NONE,
MAKE_CF_CB(set_maxHeatDhw));
}
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&auxHeaterSource_,
DeviceValueType::ENUM,
@@ -1068,7 +1092,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
EMSESP::send_read_request(0xC6, device_id, 0, 21); // read last errorcode on start (not broadcasted)
if (model() != EMSdevice::EMS_DEVICE_FLAG_HEATPUMP && model() != EMSdevice::EMS_DEVICE_FLAG_HIU) {
if (!isHeatPump() && model() != EMSdevice::EMS_DEVICE_FLAG_HIU) {
register_telegram_type(0x04, "UBAFactory", true, MAKE_PF_CB(process_UBAFactory));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &nomPower_, DeviceValueType::UINT8, FL_(nomPower), DeviceValueUOM::KW, MAKE_CF_CB(set_nomPower));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
@@ -1189,7 +1213,7 @@ void Boiler::check_active() {
}
// calculate energy for boiler 0x08 from stored modulation an time in units of 0.01 Wh
if (model() != EMSdevice::EMS_DEVICE_FLAG_HEATPUMP && model() != EMSdevice::EMS_DEVICE_FLAG_HIU) {
if (!isHeatPump() && model() != EMSdevice::EMS_DEVICE_FLAG_HIU) {
// remember values from last call
static uint32_t powLastReadTime_ = uuid::get_uptime();
static uint8_t heatBurnPow = 0;
@@ -1780,6 +1804,12 @@ void Boiler::process_HpCooling(std::shared_ptr<const Telegram> telegram) {
// Boiler(0x08) -W-> Me(0x0B), HpHeaterConfig(0x0492), data: 03 00 00 04 00
void Boiler::process_HpHeaterConfig(std::shared_ptr<const Telegram> telegram) {
if (model() == EMSdevice::EMS_DEVICE_FLAG_CS6800) {
has_enumupdate(telegram, maxHeatComp_, 2, {0, 2, 4, 5}, {0, 0, 1, 0, 2, 3});
has_enumupdate(telegram, maxHeatHeat_, 3, {2, 4, 5}, {0, 0, 0, 0, 1, 2});
has_enumupdate(telegram, maxHeatDhw_, 4, {2, 4, 5}, {0, 0, 0, 0, 1, 2});
return;
}
has_update(telegram, maxHeatComp_, 2);
has_update(telegram, maxHeatHeat_, 3);
has_update(telegram, maxHeatDhw_, 4);
@@ -2080,7 +2110,7 @@ void Boiler::process_HpPump2(std::shared_ptr<const Telegram> telegram) {
// 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, auxHeaterSource_, 0); // https://github.com/emsesp/EMS-ESP32/discussions/2489
has_update(telegram, auxHeaterOnly_, 1);
has_update(telegram, auxHeaterOnly_, model() == EMSdevice::EMS_DEVICE_FLAG_CS6800 ? 3 : 1);
has_update(telegram, auxHeaterOff_, 2);
has_update(telegram, auxHeatMode_, 4); // eco/comfort
has_update(telegram, tempParMode_, 5);
@@ -3061,8 +3091,20 @@ bool Boiler::set_HpInLogic(const char * value, const int8_t id) {
bool Boiler::set_maxHeat(const char * value, const int8_t id) {
uint8_t v;
if (!Helpers::value2enum(value, v, FL_(enum_maxHeat))) {
return false;
if (model() == EMSdevice::EMS_DEVICE_FLAG_CS6800) {
if (id == 0) {
if (!Helpers::value2enum(value, v, FL_(enum_maxHeat1), {0, 2, 4, 5})) {
return false;
}
} else {
if (!Helpers::value2enum(value, v, FL_(enum_maxHeat2), {2, 4, 5})) {
return false;
}
}
} else {
if (!Helpers::value2enum(value, v, FL_(enum_maxHeat))) {
return false;
}
}
write_command(0x492, id, v, 0x492);
return true;
@@ -3107,7 +3149,7 @@ bool Boiler::set_minTempSilent(const char * value, const int8_t id) {
bool Boiler::set_additionalHeaterOnly(const char * value, const int8_t id) {
bool v;
if (Helpers::value2bool(value, v)) {
write_command(0x491, 1, v ? 1 : 0, 0x491);
write_command(0x491, model() == EMSdevice::EMS_DEVICE_FLAG_CS6800 ? 3 : 1, v ? 1 : 0, 0x491);
return true;
}
return false;

View File

@@ -34,6 +34,9 @@ class Boiler : public EMSdevice {
inline uint8_t model() const {
return (flags() & 0x0F);
}
inline bool isHeatPump() const {
return flags() & 0x08;
}
void check_active();
void store_energy();
@@ -45,6 +48,7 @@ class Boiler : public EMSdevice {
static constexpr uint8_t EMS_TYPE_UBAFunctionTest = 0x1D;
static constexpr uint8_t EMS_TYPE_UBAFlags = 0x35;
static constexpr uint8_t EMS_TYPE_UBASetPoints = 0x1A;
static constexpr uint16_t EMS_TYPE_UBASetPoints2 = 0x2E0;
static constexpr uint8_t EMS_TYPE_UBAParameters = 0x16;
static constexpr uint8_t EMS_TYPE_UBAParametersPlus = 0xE6;
static constexpr uint8_t EMS_TYPE_UBAParameterWWPlus = 0xEA;
@@ -82,12 +86,12 @@ class Boiler : public EMSdevice {
uint8_t wwActive_; //
uint8_t ww3wayValve_; // 3-way valve on WW
uint8_t wwChargePump_;
uint8_t wwFlowTempOffset_; // Boiler offset for ww heating
uint8_t wwMaxPower_; // DHW maximum power
uint8_t wwMaxTemp_; // DHW maximum temperature
uint32_t wwStarts_; // DHW starts
uint32_t wwStartsHp_; // DHW starts Heatpump
uint32_t wwWorkM_; // DHW minutes
uint8_t wwFlowTempOffset_; // Boiler offset for ww heating
uint8_t wwMaxPower_; // DHW maximum power
uint8_t wwMaxTemp_; // DHW maximum temperature
uint32_t wwStarts_; // DHW starts
uint32_t wwStartsHp_; // DHW starts Heatpump
uint32_t wwWorkM_; // DHW minutes
int8_t wwHystOn_;
int8_t wwHystOff_;
uint16_t wwMixerTemp_; // mixing temperature

View File

@@ -1275,30 +1275,14 @@ void Thermostat::process_RC300WWmode(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, dhw->wwCircPump_, 1); // FF=off, 0=on ?
if (model() == EMSdevice::EMS_DEVICE_FLAG_BC400 || model() == EMSdevice::EMS_DEVICE_FLAG_HMC310) {
const uint8_t modes[] = {0, 5, 1, 2, 4}; // off, eco+, eco, comfort, auto
uint8_t wwmode = dhw->wwMode_ < sizeof(modes) ? modes[dhw->wwMode_] : EMS_VALUE_UINT8_NOTSET;
telegram->read_value(wwmode, 2);
const uint8_t modes1[] = {0, 2, 3, 0, 4, 1};
has_update(dhw->wwMode_, wwmode < sizeof(modes1) ? modes1[wwmode] : EMS_VALUE_UINT8_NOTSET);
has_enumupdate(telegram, dhw->wwMode_, 2, {0, 5, 1, 2, 4}, {0, 2, 3, 0, 4, 1});
} else if (model() == EMSdevice::EMS_DEVICE_FLAG_R3000) {
// https://github.com/emsesp/EMS-ESP32/pull/1722#discussion_r1582823521
const uint8_t modes[] = {1, 2, 5}; // normal, comfort, eco+
uint8_t wwmode = dhw->wwMode_ < sizeof(modes) ? modes[dhw->wwMode_] : EMS_VALUE_UINT8_NOTSET;
telegram->read_value(wwmode, 2);
const uint8_t modes1[] = {0, 0, 1, 0, 0, 2}; // 0=normal (1), 1=comfort(2), 2=eco+(5)
has_update(dhw->wwMode_, wwmode < sizeof(modes1) ? modes1[wwmode] : EMS_VALUE_UINT8_NOTSET);
has_enumupdate(telegram, dhw->wwMode_, 2, {1, 2, 5}, {0, 0, 1, 0, 0, 2}); // normal, comfort, eco+
} else if (model() == EMSdevice::EMS_DEVICE_FLAG_CR120) {
const uint8_t modes[] = {1, 2, 4}; //// 0=normal (1), 1=comfort(2), 2=auto(4)
uint8_t wwmode = dhw->wwMode_ < sizeof(modes) ? modes[dhw->wwMode_] : EMS_VALUE_UINT8_NOTSET;
telegram->read_value(wwmode, 2);
const uint8_t modes1[] = {0, 0, 1, 0, 2, 0};
has_update(dhw->wwMode_, wwmode < sizeof(modes1) ? modes1[wwmode] : EMS_VALUE_UINT8_NOTSET);
has_enumupdate(telegram, dhw->wwMode_, 2, {1, 2, 4}, {0, 0, 1, 0, 2, 0}); // normal, comfort, auto
} else if (model() == EMSdevice::EMS_DEVICE_FLAG_RC100) {
const uint8_t modes[] = {0, 2, 3}; //// 0=off(0), 1=on(2), 2=auto(3)
uint8_t wwmode = dhw->wwMode_ < sizeof(modes) ? modes[dhw->wwMode_] : EMS_VALUE_UINT8_NOTSET;
telegram->read_value(wwmode, 2);
const uint8_t modes1[] = {0, 0, 1, 2, 0, 0};
has_update(dhw->wwMode_, wwmode < sizeof(modes1) ? modes1[wwmode] : EMS_VALUE_UINT8_NOTSET);
has_enumupdate(telegram, dhw->wwMode_, 2, {0, 2, 3}, {0, 0, 1, 2, 0, 0}); // normal, on, auto
} else {
has_update(telegram, dhw->wwMode_, 2); // 0=off, 1=low, 2=high, 3=auto, 4=own prog
}
@@ -2294,29 +2278,25 @@ bool Thermostat::set_wwmode(const char * value, const int8_t id) {
}
write_command(0xB0, 2, set, 0xB0);
} else if (model() == EMSdevice::EMS_DEVICE_FLAG_BC400 || model() == EMSdevice::EMS_DEVICE_FLAG_HMC310) {
if (!Helpers::value2enum(value, set, FL_(enum_wwMode4))) { // off, eco+, eco, comfort, auto
if (!Helpers::value2enum(value, set, FL_(enum_wwMode4), {0, 5, 1, 2, 4})) { // off, eco+, eco, comfort, auto
return false;
}
const uint8_t modes[] = {0, 5, 1, 2, 4};
write_command(0x02F5 + dhw->offset(), 2, modes[set], 0x02F5 + dhw->offset());
write_command(0x02F5 + dhw->offset(), 2, set, 0x02F5 + dhw->offset());
} else if (model() == EMSdevice::EMS_DEVICE_FLAG_CR120) {
if (!Helpers::value2enum(value, set, FL_(enum_wwMode6))) { // normal, comfort, auto
if (!Helpers::value2enum(value, set, FL_(enum_wwMode6), {0, 2, 4})) { // normal, comfort, auto
return false;
}
const uint8_t modes[] = {0, 2, 4};
write_command(0x02F5 + dhw->offset(), 2, modes[set], 0x02F5 + dhw->offset());
write_command(0x02F5 + dhw->offset(), 2, set, 0x02F5 + dhw->offset());
} else if (model() == EMSdevice::EMS_DEVICE_FLAG_RC100) {
if (!Helpers::value2enum(value, set, FL_(enum_wwMode2))) { // off, on, auto
if (!Helpers::value2enum(value, set, FL_(enum_wwMode2), {0, 2, 3})) { // off, on, auto
return false;
}
const uint8_t modes[] = {0, 2, 3};
write_command(0x02F5 + dhw->offset(), 2, modes[set], 0x02F5 + dhw->offset());
write_command(0x02F5 + dhw->offset(), 2, set, 0x02F5 + dhw->offset());
} else if (model() == EMSdevice::EMS_DEVICE_FLAG_R3000) { // Rego3000 - https://github.com/emsesp/EMS-ESP32/issues/1692
if (!Helpers::value2enum(value, set, FL_(enum_wwMode5))) {
if (!Helpers::value2enum(value, set, FL_(enum_wwMode5), {1, 2, 5})) {
return false;
}
const uint8_t modes[] = {1, 2, 5};
write_command(0x02F5 + dhw->offset(), 2, modes[set], 0x02F5 + dhw->offset());
write_command(0x02F5 + dhw->offset(), 2, set, 0x02F5 + dhw->offset());
} else if (model() == EMSdevice::EMS_DEVICE_FLAG_RC300) {
if (!Helpers::value2enum(value, set, FL_(enum_wwMode))) {
return false;