diff --git a/lib/uuid-console/src/shell.cpp b/lib/uuid-console/src/shell.cpp index 9caaa9ed7..3090aaf8c 100644 --- a/lib/uuid-console/src/shell.cpp +++ b/lib/uuid-console/src/shell.cpp @@ -58,8 +58,8 @@ Shell::~Shell() { void Shell::start() { #ifdef EMSESP_DEBUG - // uuid::log::Logger::register_handler(this, uuid::log::Level::DEBUG); // added by proddy - uuid::log::Logger::register_handler(this, uuid::log::Level::INFO); // added by proddy + uuid::log::Logger::register_handler(this, uuid::log::Level::DEBUG); // added by proddy + //uuid::log::Logger::register_handler(this, uuid::log::Level::INFO); // added by proddy #else uuid::log::Logger::register_handler(this, uuid::log::Level::NOTICE); #endif diff --git a/src/boiler.cpp b/src/boiler.cpp index c9b6bca9e..283c3fc01 100644 --- a/src/boiler.cpp +++ b/src/boiler.cpp @@ -447,7 +447,7 @@ void Boiler::check_active() { // heating // using a quick hack for checking the heating by looking at the Selected Flow Temp, but doesn't work for all boilers apparently if (selFlowTemp_ != EMS_VALUE_UINT_NOTSET && burnGas_ != EMS_VALUE_UINT_NOTSET) { - heating_active_ = ((selFlowTemp_ >= EMS_BOILER_SELFLOWTEMP_HEATING) && (burnGas_ != EMS_VALUE_BOOL_OFF)); + heating_active_ = (!tap_water_active_ && ((selFlowTemp_ >= EMS_BOILER_SELFLOWTEMP_HEATING) && (burnGas_ != EMS_VALUE_BOOL_OFF))); } // see if the heating or hot tap water has changed, if so send diff --git a/src/console.h b/src/console.h index 3f4d8c12f..337133426 100644 --- a/src/console.h +++ b/src/console.h @@ -59,6 +59,7 @@ using uuid::log::Level; #ifdef EMSESP_DEBUG MAKE_PSTR_WORD(test) #endif + MAKE_PSTR_WORD(exit) MAKE_PSTR_WORD(help) MAKE_PSTR_WORD(settings) diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 8f98e9b6e..825b8780b 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -425,7 +425,7 @@ bool EMSESP::process_telegram(std::shared_ptr telegram) { // check to see if we need to force an MQTT publish if (found) { if (emsdevice->updated_values()) { - emsdevice->publish_values(); + emsdevice->publish_values(); // publish to MQTT if we explicitly have too } } break; @@ -434,7 +434,7 @@ bool EMSESP::process_telegram(std::shared_ptr telegram) { } if (!found) { - LOG_DEBUG(F("No telegram type handler found for type ID 0x%02X (src 0x%02X, dest 0x%02X)"), telegram->type_id, telegram->src, telegram->dest); + LOG_DEBUG(F("No telegram type handler found for ID 0x%02X (src 0x%02X, dest 0x%02X)"), telegram->type_id, telegram->src, telegram->dest); } return found; @@ -586,7 +586,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) { txservice_.send_poll(); // close the bus txservice_.post_send_query(); // send type_id to last destination } else if (first_value == TxService::TX_WRITE_FAIL) { - LOG_DEBUG(F("Last Tx write rejected by host")); + LOG_ERROR(F("Last Tx write rejected by host")); txservice_.send_poll(); // close the bus } else { // ignore it, it's probably a poll and we can wait for the next one @@ -606,9 +606,9 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) { // So re-send the last Tx and increment retry count uint8_t retries = txservice_.retry_tx(); // returns 0 if exceeded count if (retries) { - LOG_DEBUG(F("Last Tx read failed. Retrying #%d..."), retries); + LOG_ERROR(F("Last Tx read failed. Retrying #%d..."), retries); } else { - LOG_DEBUG(F("Last Tx read failed. Giving up")); + LOG_ERROR(F("Last Tx read failed after %d retries"), txservice_.MAXIMUM_TX_RETRIES); } } } diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 0d9b1182c..4b7f6d41f 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -394,11 +394,7 @@ void Mqtt::on_publish(uint16_t packetId) { return; } - if (mqtt_message.packet_id_ == packetId) { -#ifdef EMSESP_DEBUG - LOG_DEBUG(F("Acknowledged PID %d. Removing from queue"), packetId); -#endif - } else { + if (mqtt_message.packet_id_ != packetId) { LOG_DEBUG(F("Mismatch, expecting PID %d, got %d"), mqtt_message.packet_id_, packetId); mqtt_publish_fails_++; // increment error count } @@ -423,9 +419,7 @@ char * Mqtt::make_topic(char * result, const std::string & topic) { } void Mqtt::start() { - publish("status", "online", true); // say we're alive to the Last Will topic, with retain on send_start_topic(); - send_heartbeat(); // send heartbeat if enabled } // send online appended with the version information as JSON @@ -441,6 +435,11 @@ void Mqtt::on_connect() { mqtt_reconnect_delay_ = Mqtt::MQTT_RECONNECT_DELAY_MIN; mqtt_last_connection_ = uuid::get_uptime(); mqtt_connecting_ = false; + + publish("status", "online", true); // say we're alive to the Last Will topic, with retain on + + send_heartbeat(); // send heartbeat if enabled + LOG_INFO(F("MQTT connected")); } @@ -603,9 +602,7 @@ void Mqtt::process_queue() { // but add the packet_id so we can check it later if (mqtt_qos_ != 0) { mqtt_messages_.front().packet_id_ = packet_id; -#ifdef EMSESP_DEBUG - LOG_DEBUG(F("Setting packetID for ACK to %d"), packet_id); -#endif + // LOG_DEBUG(F("Setting packetID for ACK to %d"), packet_id); return; } diff --git a/src/telegram.h b/src/telegram.h index 84d08bef8..3e9e59ebc 100644 --- a/src/telegram.h +++ b/src/telegram.h @@ -287,10 +287,9 @@ class TxService : public EMSbus { std::string last_tx_to_string() const; - - private: static constexpr uint8_t MAXIMUM_TX_RETRIES = 3; + private: uint8_t tx_telegram_id_ = 0; // queue counter static constexpr uint32_t TX_LOOP_WAIT = 10000; // when to check if Tx is up and running (10 sec) diff --git a/src/version.h b/src/version.h index 7a4641f7b..56a398129 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "2.0.0a8" +#define EMSESP_APP_VERSION "2.0.0a9"