set lastresponse also if not connected

This commit is contained in:
MichaelDvP
2025-12-19 18:50:51 +01:00
parent 1b8b72c443
commit f1841347a7

View File

@@ -595,10 +595,6 @@ void Mqtt::ha_status() {
// add sub or pub task to the queue. // add sub or pub task to the queue.
// the base is not included in the topic // 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) { 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) { if (topic == "response" && operation == Operation::PUBLISH) {
lastresponse_ = payload; lastresponse_ = payload;
if (!send_response_) { 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 // check free mem
#ifndef EMSESP_STANDALONE #ifndef EMSESP_STANDALONE
// if (ESP.getFreeHeap() < 60 * 1024 || ESP.getMaxAllocHeap() < 40 * 1024) { // if (ESP.getFreeHeap() < 60 * 1024 || ESP.getMaxAllocHeap() < 40 * 1024) {