diff --git a/src/core/emsdevice.h b/src/core/emsdevice.h index bfe3560e8..74b0dd1aa 100644 --- a/src/core/emsdevice.h +++ b/src/core/emsdevice.h @@ -197,16 +197,17 @@ class EMSdevice { } } - void has_enumupdate(std::shared_ptr telegram, - uint8_t & value, - const uint8_t index, - const std::vector & maskIn, - const std::vector & maskOut) { + void has_enumupdate(std::shared_ptr telegram, uint8_t & value, const uint8_t index, const std::vector & maskIn) { uint8_t val = value < maskIn.size() ? maskIn[value] : EMS_VALUE_UINT8_NOTSET; if (telegram->read_value(val, index)) { - value = val < maskOut.size() ? maskOut[val] : EMS_VALUE_UINT8_NOTSET; - has_update_ = true; - publish_value((void *)&value); + for (uint8_t i = 0; i < maskIn.size(); i++) { + if (val == maskIn[i]) { + value = i; + has_update_ = true; + publish_value((void *)&value); + return; + } + } } } diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index dc61a9b08..7cdac85ed 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -1805,9 +1805,9 @@ void Boiler::process_HpCooling(std::shared_ptr telegram) { // Boiler(0x08) -W-> Me(0x0B), HpHeaterConfig(0x0492), data: 03 00 00 04 00 void Boiler::process_HpHeaterConfig(std::shared_ptr 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}); + has_enumupdate(telegram, maxHeatComp_, 2, {0, 2, 4, 5}); + has_enumupdate(telegram, maxHeatHeat_, 3, {2, 4, 5}); + has_enumupdate(telegram, maxHeatDhw_, 4, {2, 4, 5}); return; } has_update(telegram, maxHeatComp_, 2); diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index edb028a10..a49e10485 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -1275,14 +1275,14 @@ void Thermostat::process_RC300WWmode(std::shared_ptr telegram) { has_update(telegram, dhw->wwCircPump_, 1); // FF=off, 0=on ? if (model() == EMSdevice::EMS_DEVICE_FLAG_BC400 || model() == EMSdevice::EMS_DEVICE_FLAG_HMC310) { - has_enumupdate(telegram, dhw->wwMode_, 2, {0, 5, 1, 2, 4}, {0, 2, 3, 0, 4, 1}); + has_enumupdate(telegram, dhw->wwMode_, 2, {0, 5, 1, 2, 4}); } else if (model() == EMSdevice::EMS_DEVICE_FLAG_R3000) { // https://github.com/emsesp/EMS-ESP32/pull/1722#discussion_r1582823521 - has_enumupdate(telegram, dhw->wwMode_, 2, {1, 2, 5}, {0, 0, 1, 0, 0, 2}); // normal, comfort, eco+ + has_enumupdate(telegram, dhw->wwMode_, 2, {1, 2, 5}); // normal, comfort, eco+ } else if (model() == EMSdevice::EMS_DEVICE_FLAG_CR120) { - has_enumupdate(telegram, dhw->wwMode_, 2, {1, 2, 4}, {0, 0, 1, 0, 2, 0}); // normal, comfort, auto + has_enumupdate(telegram, dhw->wwMode_, 2, {1, 2, 4}); // normal, comfort, auto } else if (model() == EMSdevice::EMS_DEVICE_FLAG_RC100) { - has_enumupdate(telegram, dhw->wwMode_, 2, {0, 2, 3}, {0, 0, 1, 2, 0, 0}); // normal, on, auto + has_enumupdate(telegram, dhw->wwMode_, 2, {0, 2, 3}); // normal, on, auto } else { has_update(telegram, dhw->wwMode_, 2); // 0=off, 1=low, 2=high, 3=auto, 4=own prog } @@ -4171,6 +4171,10 @@ bool Thermostat::set_temperature(const float temperature, const uint8_t mode, co // add the write command to the Tx queue. value is *2 // post validate is the corresponding monitor or set type IDs as they can differ per model write_command(set_typeid, offset, (uint8_t)(temperature * (float)factor), validate_typeid); + // update selTemp now, readback from monitor telegram takes a while + if (mode == HeatingCircuit::Mode::AUTO) { + has_update(hc->selTemp,(int16_t)(temperature * factor)); + } return true; } LOG_DEBUG("temperature mode %d not found", mode);