Reconnect to network

Hi, I’m new in Cayenne and I want to do this
-Connect to Cayenne
-Network goes off
-Still send data through Serial Monitor
-If network is available again, reconnect
But I’ve not found out anything helpful

#include <CayenneMQTTESP32.h> //Librería de Cayenne MQTT 
#define CAYENNE_PRINT Serial

// Información de red WiFi
char ssid[] = "xd"; 
char wifiPassword[] = "xd"; 

char username[] = "xd";
char password[] = "xd";
char clientID[] = "xd";

void setup()
  Cayenne.begin(username, password, clientID, ssid, wifiPassword);

void loop()

  int pot = analogRead(34);
  //Envió de lecturas cada 10 segundos.
  Cayenne.virtualWrite(1, pot);
  //Se imprimen los siguientes datos en el monitor serie.
  CAYENNE_PRINT.println("Enviando Temperatura a Cayenne:");
1 Like

Suggest look for response from server (Cayenne) IF any response or error when doing some routine / timed post and then detect loss of the connection. I use python and MQTT running on Pi makes this kind of thing pretty easy. Also ttyS0 serial port on the Pi is very easy to use ( and has power pins adjacent for running a small micro )

I find the python running on any old Pi good for this sort of trick

The python starters here open up some pretty powerful ideas using simple MQTT that may be helpful.
~ A

1 Like