mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-09-13 13:44:10 +00:00
revert mqtt dev7 changes
This commit is contained in:
+1
-3
@@ -504,7 +504,7 @@ void Mqtt::on_disconnect(espMqttClientTypes::DisconnectReason reason) {
|
||||
|
||||
// MQTT on_connect - when an MQTT connect is established
|
||||
void Mqtt::on_connect() {
|
||||
if (connecting_ || !connected()) {
|
||||
if (connecting_) {
|
||||
return; // prevent duplicated connections and unsuccessful tries
|
||||
}
|
||||
|
||||
@@ -513,7 +513,6 @@ void Mqtt::on_connect() {
|
||||
connecting_ = true;
|
||||
queuecount_ = mqttClient_->queueSize();
|
||||
|
||||
if (connectcount_ == 0) { // only on first connect and after reconfigure, HA messages are reain
|
||||
if (ha_enabled_) {
|
||||
queue_unsubscribe_message(discovery_prefix_ + "/+/" + Mqtt::basename() + "/#");
|
||||
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.
|
||||
queue_subscribe_message(discovery_prefix_ + "/+/" + Mqtt::basename() + "/#");
|
||||
}
|
||||
}
|
||||
|
||||
// re-subscribe to all custom registered MQTT topics
|
||||
resubscribe();
|
||||
|
||||
Reference in New Issue
Block a user