revert mqtt dev7 changes

This commit is contained in:
MichaelDvP
2026-08-19 11:49:29 +02:00
parent edd1677526
commit 469ca8bf05
+1 -3
View File
@@ -504,7 +504,7 @@ void Mqtt::on_disconnect(espMqttClientTypes::DisconnectReason reason) {
// MQTT on_connect - when an MQTT connect is established // MQTT on_connect - when an MQTT connect is established
void Mqtt::on_connect() { void Mqtt::on_connect() {
if (connecting_ || !connected()) { if (connecting_) {
return; // prevent duplicated connections and unsuccessful tries return; // prevent duplicated connections and unsuccessful tries
} }
@@ -513,7 +513,6 @@ void Mqtt::on_connect() {
connecting_ = true; connecting_ = true;
queuecount_ = mqttClient_->queueSize(); queuecount_ = mqttClient_->queueSize();
if (connectcount_ == 0) { // only on first connect and after reconfigure, HA messages are reain
if (ha_enabled_) { if (ha_enabled_) {
queue_unsubscribe_message(discovery_prefix_ + "/+/" + Mqtt::basename() + "/#"); queue_unsubscribe_message(discovery_prefix_ + "/+/" + Mqtt::basename() + "/#");
EMSESP::reset_mqtt_ha(); // re-create all HA devices if there are any EMSESP::reset_mqtt_ha(); // re-create all HA devices if there are any
@@ -526,7 +525,6 @@ void Mqtt::on_connect() {
// disable HA, wait 5 minutes (to allow the broker to send all), than reenable HA again. // disable HA, wait 5 minutes (to allow the broker to send all), than reenable HA again.
queue_subscribe_message(discovery_prefix_ + "/+/" + Mqtt::basename() + "/#"); queue_subscribe_message(discovery_prefix_ + "/+/" + Mqtt::basename() + "/#");
} }
}
// re-subscribe to all custom registered MQTT topics // re-subscribe to all custom registered MQTT topics
resubscribe(); resubscribe();