diff --git a/NidayandHelper.cpp b/NidayandHelper.cpp index 5fc588f..9b6383e 100644 --- a/NidayandHelper.cpp +++ b/NidayandHelper.cpp @@ -88,9 +88,10 @@ void NidayandHelper::mqtt_reconnect(PubSubClient& psclient, String uid, String p this->mqtt_publish(psclient, "/raw/esp8266/register", "{ \"id\": \"" + String(ESP.getChipId()) + "\", \"ip\":\"" + WiFi.localIP().toString() +"\"}"); //Setup subscription - if (topics.empty()){ + if (!topics.empty()){ for (const char* t : topics){ psclient.subscribe(t); + Serial.println("Subscribed to "+String(t)); } } diff --git a/motor_on_a_roller_blind-ws.ino b/motor_on_a_roller_blind-ws.ino index b1c6161..9b3bee2 100644 --- a/motor_on_a_roller_blind-ws.ino +++ b/motor_on_a_roller_blind-ws.ino @@ -103,17 +103,7 @@ void sendmsg(String topic, String payload) { helper.mqtt_publish(psclient, topic, payload); } -/* - Connect the MQTT client to the - MQTT server -*/ -void reconnect() { - if (!mqttActive) - return; - - helper.mqtt_reconnect(psclient, mqtt_uid, mqtt_pwd, { inputTopic.c_str() }); -} /**************************************************************************************** */