diff --git a/src/ems-esp.ino b/src/ems-esp.ino index b250801b4..e7f238ddc 100644 --- a/src/ems-esp.ino +++ b/src/ems-esp.ino @@ -895,7 +895,6 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) { } else if (message[0] == '0') { ems_setWarmWaterActivated(false); } - publishValues(true); // publish back immediately } // shower timer @@ -1149,11 +1148,11 @@ void loop() { ds18.loop(); } - // publish the values to MQTT, regardless if the values haven't changed - // we don't want to publish when doing a deep scan of the thermostat + // publish the values to MQTT, only if the values have changed + // although we don't want to publish when doing a deep scan of the thermostat if (ems_getEmsRefreshed() && (scanThermostat_count == 0)) { - publishValues(true); - ems_setEmsRefreshed(false); + publishValues(false); + ems_setEmsRefreshed(false); // reset } // do shower logic, if enabled diff --git a/src/ems.cpp b/src/ems.cpp index 2b654ca40..e72edd394 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -524,6 +524,7 @@ void _createValidate() { // safety check: only do a validate after a write and when we have a type to validate if ((EMS_TxTelegram.action != EMS_TX_TELEGRAM_WRITE) || (EMS_TxTelegram.type_validate == EMS_ID_NONE)) { + EMS_TxQueue.shift(); // remove from queue return; } @@ -582,7 +583,7 @@ void ems_parseTelegram(uint8_t * telegram, uint8_t length) { EMS_Sys_Status.emsTxPkgs++; // got a success 01. Send a validate to check the value of the last write emsaurt_tx_poll(); // send a poll to free the EMS bus - _createValidate(); // create a validate Tx request + _createValidate(); // create a validate Tx request (if needed) } else if (value == EMS_TX_ERROR) { // last write failed (04), delete it from queue and dont bother to retry if (EMS_Sys_Status.emsLogging == EMS_SYS_LOGGING_VERBOSE) { @@ -767,9 +768,9 @@ void _processType(uint8_t * telegram, uint8_t length) { // release the lock on the TxQueue EMS_Sys_Status.emsTxStatus = EMS_TX_STATUS_IDLE; - // at this point we can assume Txstatus is EMS_TX_STATUS_WAIT + // at this point we can assume Txstatus is EMS_TX_STATUS_WAIT so we just sent a read/write/validate // for READ, WRITE or VALIDATE the dest (telegram[1]) is always us, so check for this - // if not we probably didn't get any response so remove the last Tx from the queue and process the telegram + // and if not we probably didn't get any response so remove the last Tx from the queue and process the telegram anyway if ((telegram[1] & 0x7F) != EMS_ID_ME) { _removeTxQueue(); _ems_processTelegram(telegram, length);