ESP8266 WiFi and Cayenne credential configurator


Update : Check this link for the new version of this library :

Here is a library to configure WiFi credential, static IP adress and hostname for your ESP8266.
It also set your Cayenne username, password and clientID via a web page in AP mode.
Inspired from kentaylor/WiFiManager (forked from tzapu/WiFiManager)

Cayenne_Connect folder contain the library.

Cayenne_test contain the example Cayenne_test.ino file.

    * File	:		Cayenne_test.ino
    * Date	:		2017-Dec-14
    * By	:		Jean-Daniel Lavoie
    * Description :	Inspired from kentaylor/WiFiManager (forked from tzapu/WiFiManager)
    *				Manage WiFi connection at every reboot for 60 seconds whit fixed IP.
    *				Connect to

    #include <Cayenne_Connect.h>

    //#define CAYENNE_DEBUG
    #define CAYENNE_PRINT Serial
    #include <CayenneMQTTESP8266.h>
    char username[48];																	// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
    char password[48];
    char clientID[48];

    #include <queue>																	// std::queue
    typedef enum user_request {
    	RESTART,																		// Reset event.
    	SEND,																			// Send event.
    } user_request;
    std::queue<user_request> request_queue;

    // setup()		Put your setup code here, to run once:
    void setup(void) {
    	LED_Init();																		// Turn on LED during BOOT.

    	Serial.begin(115200);															// Start serial for debug.
    	Serial.println(F(" "));															// First print is garbage.

    	Cayenne_Connect my_connection;													// Manage WiFi connection whit staticIP.
    	if (WiFi.isConnected()) {														// Turn LED OFF if connected.

    	strcpy(username, my_connection.getMQTTusername());
    	strcpy(password, my_connection.getMQTTpassword());
    	strcpy(clientID, my_connection.getMQTTclientID());
    	Cayenne.begin(username, password, clientID);									// Start Cayenne MQTT client.

    // loop()		Endless storie
    void loop() {

    	if (!request_queue.empty()) {
    		switch (request_queue.front()) {
    			case SEND:																// Update Cayenne dashboard.
    // Put your Cayenne.virtualWrite(...); here	
    				Cayenne.virtualWrite(1, false);										// Update cayenne_send button.
    				Serial.println(F("Cayenne server updated."));

    			case RESTART:															// Reset!!
    				Cayenne.virtualWrite(0, false);										// Update cayenne_restart button.
    				Serial.println(F("!!Restarting NOW!!"));

    				CAYENNE_LOG("Unknow user_request");

    // Function for processing actuator commands from the Cayenne Dashboard.
    CAYENNE_IN(0) {
    	CAYENNE_LOG("Restart requested.");

    CAYENNE_IN(1) {
    	CAYENNE_LOG("Cayenne write requested.");

    	CAYENNE_LOG("CAYENNE_IN_DEFAULT(%u) - %s, %s",, getValue.getId(), getValue.asString());
    	//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError("Error message");


Thank you for posting this @DJayDeee !


Awesome, thanks for posting this!


For an unfortunate reason Cayenne does not connect if we use static IP address anymore so I rework it to switch to DHCP after the configuration portal is close. But there is an issue ( with Arduino for ESP8266 and I need to use the lastest github repository of it.

Check this link for the new version of this library :