WiFiManager


#1

Hi.
I have a project that has been running now for a few days and I want to add Cayenne to it.
I use WiFiManager (ESO8266) and can seem to find how to add Cayenne with out changing all the WiFi connection part.
Is that code that will work with connection to the Internet is already up?


#2

Cayenne starts up wifi, and if it is broken, you can start it yourself.
(Cant figure out how to indent a while loop on this editor!)

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

while (WiFi.status() != WL_CONNECTED) {
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, wifiPassword);
Serial.println("\nConnecting to WiFi");
Serial.print(".");
delay(1000);
}

configTime(timezone * 3600, 0, “pool.ntp.org”, “time.nist.gov”);


#3

Got it yo work.
I added this include to my project
#include <CayenneMQTTESP8266.h>
char username[] = “XXXXX”;
char password[] = “XXXXX”;
char clientID[] = “XXXXX”;

and in my setup:
WiFiManager wifiManager;
wifiManager.autoConnect(“AutoConnectAP”);
Serial.println(“WiFi…”);
Cayenne.begin(username, password, clientID);

and it works! no changes to my code… no changes to my .h nada!


#4

What is it for ? For a real time ?


#5

Yes. Part of time.h

now = time(nullptr);

I used it for midnight resets, and later to send my nice time format HHMM.SS to the database rather than the string of UTC time.