Browse code

adaugat posibilitatea de reset via mqtt

Andrei Bucur authored on 05/03/2018 15:12:41
Showing 1 changed files
... ...
@@ -21,7 +21,7 @@ char mqttRELAY[23];
21 21
 char mqttLWT[22];
22 22
 
23 23
 const String model = "NodeMCU Releu";
24
-const String ver = "v2.0.1";
24
+const String ver = "v2.0.2";
25 25
 const char* mqttServer = "mqtt.clickhome.ro";
26 26
 const int mqttPort = 1883;
27 27
 long loopTimer = 900000; // miliseconds - by default trimite la 15 minute
... ...
@@ -233,6 +233,16 @@ void getMessage(char* topic, byte* payload, unsigned int length) {
233 233
         #endif
234 234
    }
235 235
 
236
+  // reset la ESP
237
+  if (mqttMessage == "reset")
238
+  {
239
+      String lastwords="Am fost resetat ...";
240
+      client.publish(mqttESP, lastwords.c_str(), TRUE);
241
+      delay (3000);
242
+      ESP.reset();
243
+      delay (5000);
244
+  }
245
+
236 246
   if (mqttMessage == "stare")
237 247
   {
238 248
     // citesc starea si o trimit