add back 4wayValve as bool, #2844

This commit is contained in:
MichaelDvP
2026-02-09 09:36:13 +01:00
parent ac8ef646e9
commit 909edf394d
4 changed files with 12 additions and 5 deletions

View File

@@ -647,6 +647,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
DeviceValueUOM::DEGREES,
MAKE_CF_CB(set_pool_temp));
// register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &hp4wayValve_, DeviceValueType::ENUM, FL_(enum_4way), FL_(hp4wayValve), DeviceValueUOM::NONE);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &hp4wayValve_, DeviceValueType::BOOL, FL_(hp4wayValve), DeviceValueUOM::NONE);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &hpInput[0].state, DeviceValueType::BOOL, FL_(hpInput1), DeviceValueUOM::NONE);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&hpInput[0].option,
@@ -1731,7 +1732,9 @@ void Boiler::process_HpPower(std::shared_ptr<const Telegram> telegram) {
has_bitupdate(telegram, hp3wayValve_, 0, 6);
// has_bitupdate(telegram, heating_, 0, 0); // heating on? https://github.com/emsesp/EMS-ESP32/discussions/1898
has_bitupdate(telegram, hpSwitchValve_, 0, 4);
if (coolingType_ == 3) {
has_bitupdate(telegram, hp4wayValve_, 0, 3); // https://github.com/emsesp/EMS-ESP32/issues/2844#issuecomment-3869770845
}
has_bitupdate(telegram, elHeatStep1_, 3, 0);
has_bitupdate(telegram, elHeatStep2_, 3, 1);
has_bitupdate(telegram, elHeatStep3_, 3, 2);
@@ -1831,6 +1834,8 @@ void Boiler::process_HpInConfig(std::shared_ptr<const Telegram> telegram) {
// Boiler(0x08) -W-> Me(0x0B), HpHeaterConfig(0x0485)
void Boiler::process_HpCooling(std::shared_ptr<const Telegram> telegram) {
// coolingtype to set 4wayvalve (0x48D), type not published yet, https://github.com/emsesp/EMS-ESP32/issues/2844#issuecomment-3869770845
has_update(telegram, coolingType_, 0); // none = 0, passive cooling box = 1, active cooling box = 2, 4-way valve = 3, active and passive cooling box = 4.
has_update(telegram, pvCooling_, 21);
}

View File

@@ -270,6 +270,7 @@ class Boiler : public EMSdevice {
uint8_t powerReduction_;
uint8_t pvCooling_;
uint8_t coolingType_;
uint8_t auxHeatMode_;
uint8_t auxMaxLimit_;
uint8_t auxLimitStart_;

View File

@@ -137,8 +137,6 @@ StateUpdateResult WebCustomEntity::update(JsonObject root, WebCustomEntity & web
snprintf(key, sizeof(key), "c:%s", entityItem.name);
if (EMSESP::nvs_.isKey(key)) {
entityItem.data = EMSESP::nvs_.getString(key).c_str();
} else {
EMSESP::nvs_.putString(key, entityItem.data.c_str());
}
}
webCustomEntity.customEntityItems.push_back(entityItem); // add to list
@@ -174,13 +172,16 @@ bool WebCustomEntityService::command_setvalue(const char * value, const int8_t i
for (CustomEntityItem & entityItem : *customEntityItems_) {
if (Helpers::toLower(entityItem.name) == Helpers::toLower(name)) {
if (entityItem.data == value) {
return true; // no change
}
if (entityItem.ram == 1) {
entityItem.data = value;
} else if (entityItem.ram == 2) { // NVS
entityItem.data = value;
char key[sizeof(entityItem.name) + 2];
snprintf(key, sizeof(key), "c:%s", entityItem.name);
if (EMSESP::nvs_.getString(key) != entityItem.data.c_str()) {
if (!EMSESP::nvs_.isKey(key) || EMSESP::nvs_.getString(key) != entityItem.data.c_str()) {
EMSESP::nvs_.putString(key, entityItem.data.c_str());
}
} else if (entityItem.value_type == DeviceValueType::STRING) {