First attempt at mqtt not compiling

Hi guys, this is my first attempt at using mqtt with the esp8266 and i havent’ been able to get compile the cayenne mqtt sketch for the past few hours. i get this error below
I’m using a wemos nodemcu with oled screen.
any idea what the problem could be from my error log?

Build options changed, rebuilding all
In file included from C:\Users\W4R10C~1\AppData\Local\Temp\arduino_modified_sketch_695137\ESP8266Shield.ino:21:0:

C:\Users\w4r10ck3r\Documents\Arduino\libraries\Cayenne-MQTT-Arduino-master\src/CayenneMQTTESP8266Shield.h:29:34: fatal error: ESP8266SerialLibrary.h: No such file or directory

#include “ESP8266SerialLibrary.h”
^

compilation terminated.

exit status 1
Error compiling for board Generic ESP8266 Module.

@aotrakstar use this code and make sure you have CayenneMQTT library installed.

// This example shows how to connect to Cayenne using an ESP8266 and send/receive sample data.
// Make sure you install the ESP8266 Board Package via the Arduino IDE Board Manager and select the correct ESP8266 board before compiling. 

//#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#include <CayenneMQTTESP8266.h>

// WiFi network info.
char ssid[] = "ssid";
char wifiPassword[] = "wifiPassword";

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "MQTT_USERNAME";
char password[] = "MQTT_PASSWORD";
char clientID[] = "CLIENT_ID";

unsigned long lastMillis = 0;

void setup() {
	Serial.begin(9600);
	Cayenne.begin(username, password, clientID, ssid, wifiPassword);
}

void loop() {
	Cayenne.loop();

	//Publish data every 10 seconds (10000 milliseconds). Change this value to publish at a different interval.
	if (millis() - lastMillis > 10000) {
		lastMillis = millis();
		//Write data to Cayenne here. This example just sends the current uptime in milliseconds.
		Cayenne.virtualWrite(0, lastMillis);
		//Some examples of other functions you can use to send data.
		//Cayenne.celsiusWrite(1, 22.0);
		//Cayenne.luxWrite(2, 700);
		//Cayenne.virtualWrite(3, 50, TYPE_PROXIMITY, UNIT_CENTIMETER);
	}
}

//Default function for processing actuator commands from the Cayenne Dashboard.
//You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands.
CAYENNE_IN_DEFAULT()
{
	CAYENNE_LOG("CAYENNE_IN_DEFAULT(%u) - %s, %s", request.channel, 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");
}

I tried your sktech, now i get this error :slight_smile:C:\Users\w4r10ck3r\Documents\AVIS\cayenne_esp8266_mqtt\cayenne_esp8266_mqtt.ino:6:32: fatal error: CayenneMQTTESP8266.h: No such file or directory

I am positive that the CayenneMQTTESP8266.h file is present in the library.

Hello,
Where is CayenneMQTTESP8266.h located ? This sketch should compile without errors .

My bad… it failed to compile since because i had downloaded the arduino mqtt zip file instead of the esp8266. So i no longer get that error. this is the new error while compiling

C:\Users\w4r10ck3r\Documents\Arduino\libraries\ESP8266WiFi\src\ESP8266WiFiSTA.cpp:623:14: error: ‘WPS_CB_ST_UNK’ was not declared in this scope

Sounds like that error is caused by not having the board installed in the IDE Follow these instructions to get that installed and let us know if it works!

1 Like

The installation instruction link is dead.

Works for me, try this one GitHub - esp8266/Arduino: ESP8266 core for Arduino

I have deleted and reinstalled the ide as well as the esp8266 core and its still one error or the other:

C:\Users\w4r10ck3r\Documents\Arduino\libraries\Cayenne-MQTT-ESP-master\src/CayenneArduinoMQTTClient.h:46:7: note: no known conversion for argument 1 from ‘WiFiClient’ to ‘int&’

Can you post the code you are using?

i have same problem

Arduino: 1.8.6 (Windows 7), Board: “Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

Multiple libraries were found for “CayenneMQTTESP8266Shield.h”
ceklib:21:38: error: CayenneMQTTESP8266Shield.h: No such file or directory

Used: C:\Users\dika zahra\Documents\Arduino\libraries\CayenneMQTT
compilation terminated.

Not used: C:\Users\dika zahra\Documents\Arduino\libraries\Cayenne-MQTT-Arduino-master
Not used: C:\Users\dika zahra\Documents\Arduino\libraries\Cayenne-MQTT-Arduino-master
Not used: C:\Users\dika zahra\Documents\Arduino\libraries\Cayenne-MQTT-Arduino-master
Not used: C:\Users\dika zahra\Documents\Arduino\libraries\Cayenne-MQTT-Arduino-master
exit status 1
CayenneMQTTESP8266Shield.h: No such file or directory

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

help me please

Please don’t post in multiple topics