diff --git a/src/core/mqtt.cpp b/src/core/mqtt.cpp index 5ee46cf6c..32aa5f303 100644 --- a/src/core/mqtt.cpp +++ b/src/core/mqtt.cpp @@ -509,14 +509,14 @@ void Mqtt::on_connect() { queue_subscribe_message(discovery_prefix_ + "/+/" + Mqtt::basename() + "/#"); } - // send initial MQTT messages for some of our services - EMSESP::system_.send_heartbeat(); // send heartbeat - // re-subscribe to all custom registered MQTT topics resubscribe(); // publish to the last will topic (see Mqtt::start() function) to say we're alive queue_publish_retain("status", "online"); // retain: https://github.com/emsesp/EMS-ESP32/discussions/2086 + + // send initial MQTT messages for some of our services + EMSESP::system_.send_heartbeat(); // send heartbeat } // Home Assistant Discovery - the main master Device called EMS-ESP diff --git a/src/core/system.cpp b/src/core/system.cpp index 9e7994c90..0d57db613 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -731,11 +731,6 @@ void System::heartbeat_json(JsonObject output) { // send periodic MQTT message with system information void System::send_heartbeat() { - // don't send heartbeat if WiFi or MQTT is not connected - if (!Mqtt::connected()) { - return; - } - refreshHeapMem(); // refresh free heap and max alloc heap JsonDocument doc;