From 966a25bcd0c2772c24888487d4391fe9ac61c003 Mon Sep 17 00:00:00 2001 From: stefan123t Date: Thu, 4 Aug 2022 01:19:46 +0200 Subject: [PATCH] add mClient->setServer as suggested in #120 --- tools/esp8266/mqtt.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/esp8266/mqtt.h b/tools/esp8266/mqtt.h index e8aecb10..4a9d3509 100644 --- a/tools/esp8266/mqtt.h +++ b/tools/esp8266/mqtt.h @@ -106,6 +106,10 @@ class mqtt { DPRINTLN(DBG_DEBUG, F("WIFI mEspClient.status ") + String(mEspClient.status()) ); if(!mClient->connected()) { if(strlen(mDevName) > 0) { + // der Server und der Port müssen neu gesetzt werden, + // da ein MQTT_CONNECTION_LOST -3 die Werte zerstört hat. + mClient->setServer(mBroker, mPort); + mClient->setBufferSize(MQTT_MAX_PACKET_SIZE); if((strlen(mUser) > 0) && (strlen(mPwd) > 0)) mClient->connect(mDevName, mUser, mPwd); else