diff --git a/src/core/mqtt.cpp b/src/core/mqtt.cpp index 4a8c6cc36..5fc577b72 100644 --- a/src/core/mqtt.cpp +++ b/src/core/mqtt.cpp @@ -595,10 +595,6 @@ void Mqtt::ha_status() { // add sub or pub task to the queue. // the base is not included in the topic bool Mqtt::queue_message(const uint8_t operation, const std::string & topic, const std::string & payload, const bool retain) { - if (!mqtt_enabled_ || topic.empty() || !connected()) { - return false; // quit, not using MQTT - } - if (topic == "response" && operation == Operation::PUBLISH) { lastresponse_ = payload; if (!send_response_) { @@ -606,6 +602,10 @@ bool Mqtt::queue_message(const uint8_t operation, const std::string & topic, con } } + if (!mqtt_enabled_ || topic.empty() || !connected()) { + return false; // quit, not using MQTT + } + // check free mem #ifndef EMSESP_STANDALONE // if (ESP.getFreeHeap() < 60 * 1024 || ESP.getMaxAllocHeap() < 40 * 1024) {