Missing CayenneMQTTESP8266.h


#1

Hi, Missing the CayenneMQTTESP8266.h library

  • Device & model: Wemos D1 R2 with MQTT
  • Dashboard: not aplicable but web
  • Observed Bug:
    The Wemos was working fine with the CayenneMQTTESP8266.h library.
    This library was found on GitHub - Cayenne-MQTT-ESP

My ‘problem’ started when I refreshed the Arduino IDE completly and relevant libraries like Cayenne’s were added with the “Library manager”

Missing above library I tried to use CayenneMQTTESP8266Shield.h (in vain).
So the bug/question is why the CayenneMQTTESP8266.h library not part of the standard Cayenne suite available from the Library Manager?


#2

So just to clarify, your question is basically why do you have to download 2 cayenne libraries ?

Or is something wrong with the library you downloaded?

~Benny


#3

@bestes the remark is my sketches working fine with library CayenneMQTTESP8266.h but this library is not in the official two Cayenne downloads directly available in Arduino’s Library Manager. The library can only be found in GitHub and btw is working fine; I have used this library with success with devices like Wemos D1 R2 and SonOff Basic.

The confusing part was I asumed that it was replaced with CayenneMQTTESP8266Shield.h but was encountering only problems to get that library working.

(I prepared the topic, did not finish or publish it but likely I did, sorry for that)


#4

@bestes,

Having trouble with this error. Hunting high and low for the right libraries. The files I have I secluded in another folder when I wipe the IDE to start over (too many invalid library errors) If I move the saved files to the libraries file, I get access denied for cayenne.properties. Si My question is where to find the gist for the cayenne master and the cayenne MQTT master?

This is what I get:
Arduino: 1.8.1 (Windows 10), Board: “Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

C:\Arduino Sketchbook\plduino_A3_smooth_MQTT\plduino_A3_smooth_MQTT.ino:26:34: fatal error: CayenneESP8266Shield.h: No such file or directory

#include <CayenneESP8266Shield.h>

                              ^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


#5

can you search for cayenne MQTT in sketch > include library > manage libraries. and install it.


#6

I did


#7

cab you share a screenshot.


#8


#9

download this zip file and install https://github.com/myDevicesIoT/Cayenne-MQTT-Arduino


#10

Arduino: 1.8.1 (Windows 10), Board: “Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

In file included from C:\Arduino Sketchbook\plduino_A3_smooth_MQTT\plduino_A3_smooth_MQTT.ino:27:0:

C:\Arduino Sketchbook\libraries\CayenneMQTT\src/CayenneMQTTESP8266.h:25:25: fatal error: ESP8266WiFi.h: No such file or directory

#include <ESP8266WiFi.h>

                     ^

compilation terminated.

Here’s my sketch,I’m trying to switch to MQTT

//#define CAYENNE_DEBUG // Uncomment to show debug messages
//#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
//#include <CayenneESP8266Shield.h>
#include <CayenneMQTTESP8266.h>
//#include <PLDuino.h>
//#include <PLDuinoGUI.h>
//#include <TMRpcm_PLDuino.h>
#include <SPI.h>
//#include <SD.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#include <PLDuino.h>
#include <PLDTouch.h>
#include <PLDuinoGUI.h>
#include <using_namespace_PLDuinoGUI.h>
#include <DS3232RTC.h>
#include <TimeLib.h>
#include <Wire.h>
#include <avr/io.h>

//MQTT Authentication
char username[] = “0fd0”;
char password[] = “e3d2”;
char clientID[] = “06007”;

const int numReadings = 10;

int readings[numReadings]; // the readings from the analog input
int index = 0; // the index of the current reading
int total = 0; // the running total
int average = 0; // the average

int inputPin = A3;

Adafruit_ILI9341 tft = Adafruit_ILI9341(PLDuino::LCD_CS, PLDuino::LCD_DC);
PLDTouch touch(PLDuino::TOUCH_CS, PLDuino::TOUCH_IRQ);

Button btnVoltage(“Front”, ILI9341_YELLOW, ILI9341_BLACK);

Button btnVoltage1(“Back”, ILI9341_YELLOW, ILI9341_BLACK);

Button btnVoltage2(“Battery”, ILI9341_BLUE, ILI9341_BLACK);

Button btnVoltage3(“Inverter”, ILI9341_RED, ILI9341_BLACK);

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
//char token[] = “opioxqafxw”;
// Your network name and password.
char ssid[] = “free”;
char password[] = “zzZw23521041”;

// Set ESP8266 Serial object
#define EspSerial Serial2
ESP8266 wifi(EspSerial);

void setup()

{
PLDuino::init();
PLDuino::enableLCD();
PLDuino::enableESP();
tft.begin();
tft.setRotation(3);
touch. init(1);

// initialize all the readings to 0:
for (int thisReading = 0; thisReading < numReadings; thisReading++)
readings[thisReading] = 0;

Serial.begin(9600);
delay(100);
// Set ESP8266 baud rate
EspSerial.begin(115200);
delay(100);

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

btnVoltage.setPositionAndSize(01, 01, 100, 75);
btnVoltage.draw(tft);

btnVoltage1.setPositionAndSize(01, 75, 100, 75);
btnVoltage1.draw(tft);

btnVoltage2.setPositionAndSize(01, 150, 100, 75);
btnVoltage2.draw(tft);

btnVoltage3.setPositionAndSize(175, 1, 150, 110);
btnVoltage3.draw(tft);

}

void loop()
{
Cayenne.run();
}
//front solar panel voltage
CAYENNE_OUT(V1)

{
int adcVal = analogRead(A0);
float adcVoltage = 55.0*adcVal/1024;
Cayenne.virtualWrite(V1,adcVoltage);
btnVoltage.setText(String(adcVoltage));
btnVoltage.draw(tft);
//delay (4000);
}
//back solar panel voltage
CAYENNE_OUT(V2)

{
int adcVal1 = analogRead(A1);
float adcVoltage1 = 55.0*adcVal1/1024;
Cayenne.virtualWrite(V2,adcVoltage1);
btnVoltage1.setText(String(adcVoltage1));
btnVoltage1.draw(tft);
//delay (4000);
}
//battery voltage
CAYENNE_OUT(V3)

{
int adcVal2 = analogRead(A2);
float adcVoltage2 = 55.0*adcVal2/1024;
Cayenne.virtualWrite(V3,adcVoltage2);
btnVoltage2.setText(String(adcVoltage2));
btnVoltage2.draw(tft);
//delay (4000);
}
//inverter voltage
CAYENNE_OUT(V4)

{

// subtract the last reading:
total= total - readings[index];
// read from the sensor:
readings[index] = analogRead(inputPin);
// add the reading to the total:
total= total + readings[index];
// advance to the next position in the array:
index = index + 1;

// if we’re at the end of the array…
if (index >= numReadings)
// …wrap around to the beginning:
index = 0;

// calculate the average:
average = total / numReadings * 575.0 / 1024;
// send it to the computer as ASCII digits
//float average = 575.0*numReadings/1024;
Cayenne.virtualWrite(V4,average);
btnVoltage3.setText(String(average));
btnVoltage3.draw(tft);
//Serial.println(average);
delay(1); // delay in between reads for stability
}

/int adcVal3 = analogRead(A3);
float adcVoltage3 = 575.0
adcVal3/1024;
Cayenne.virtualWrite(V4,adcVoltage3);
btnVoltage3.setText(String(adcVoltage3));
btnVoltage3.draw(tft);
//delay (4000);*/
//}

Thanks


#11

@jburhenn any ideas here?

~Benny


#12

If you are using the ESP8266 as a shield on the Mega try including CayenneMQTTESP8266Shield.h instead of CayenneMQTTESP8266.h. The CayenneMQTTESP8266.h file is for using a sketch on a standalone ESP8266, not for using it as a WiFi shield.


#13

@jburhenn My PLduino has an ESP02 and mega integrated within it. @kreggly helped me with this sketch, but I will try it.

Edit: No Go either
In file included from C:\Arduino Sketchbook\plduino_A3_smooth_MQTT\plduino_A3_smooth_MQTT.ino:26:0:

C:\Arduino\libraries\CayenneMQTT\src/CayenneMQTTESP8266Shield.h:31:34: fatal error: ESP8266SerialLibrary.h: No such file or directory

#include “ESP8266SerialLibrary.h” :sob::sob::sob:


#14

You can Install the ESP8266SerialLibrary.zip library via the Arduino IDE (Sketch->Include Library->Add .ZIP Library) from the extras\libraries folder where the CayenneMQTT library is installed (e.g. My Documents\Arduino\libraries\CayenneMQTT\extras\libraries).


#15

Something about your files system is wrong here, it keeps saying in output

But it should be

\src\CayenneMQTTESP8266.h

for windows users


#16

the libraries for my PLDuino don’t seem to be playing well with mqtt. I uninstalled arduino delted all other files. saved sketchbook. re-installed arduino ide and moved sketches back. downloaded boards and libraries for the PLDuino. I get close but now i’m getting this:

Arduino: 1.8.5 (Windows Store 1.8.10.0) (Windows 10), Board: “Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

C:\Users\Pancho\Documents\Arduino\plduino_A3_smooth_MQTT\plduino_A3_smooth_MQTT.ino:7:21: fatal error: C:\Users\Pancho\Documents\Arduino\libraries\PLDuino/PLDuino.h: Permission denied

#include <PLDuino.h>

                 ^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


#17

I haven’t used a PLDuino myself but this link suggest you need to install PLDuino/ESP-02 and PLDuino/Mega2560 board packages: https://github.com/digitalloggers/plduino-arduinoide-package.

Have you installed both of those? Are you selecting the PLDuino/Mega2560 board as your target, not Arduino/Genuino Mega or Mega 2560?


#18

i had these boards installed up until i got a message from arduino saying failed to load keywords.txt please re-install arduino. this started after re-installing the first time after a restart. might be a windows 10 sp issue.


#19

This looks like windows permission problem, disable UAC on your windows system and try again


#20

I had some really flaky things going on with my laptop so I purged anything having to do with Arduino. even my video adapter dump until I reloaded the driver. bots or virus who knows, McAfee didn’t detect it.

I’ve got other errors now that could be file structure or just my sketch. I’m just beginning to grasp a bit of MQTT. The error mentions a lot about esp8266. Sometimes it’s hard to tell which line is the actual problem. Would you care to look at the error message?

Thanks

#include <ESP8266_HardSer.h>

#include <ESP8266SerialLibrary.h>


//#include <CayenneMQTTESP8266Shield.h>
#include <CayenneMQTTESP8266.h>
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#include <PLDuino.h>
#include <PLDTouch.h>
#include <PLDuinoGUI.h>
#include <using_namespace_PLDuinoGUI.h>
#include <DS3232RTC.h>
#include <TimeLib.h>
#include <Wire.h>
#include <avr/io.h>

//MQTT Authentication
char username[] = "0fd05b2 ";
char password[] = "e3d25bad21 ";
char clientID[] = "06007ee0-1 ";

const int numReadings = 10;

int readings[numReadings];      // the readings from the analog input
int index = 0;                  // the index of the current reading
int total = 0;                  // the running total
int average = 0;                // the average

int inputPin = A3;


Adafruit_ILI9341 tft = Adafruit_ILI9341(PLDuino::LCD_CS, PLDuino::LCD_DC);
PLDTouch touch(PLDuino::TOUCH_CS, PLDuino::TOUCH_IRQ);

Button btnVoltage("Front", ILI9341_YELLOW, ILI9341_BLACK);

Button btnVoltage1("Back", ILI9341_YELLOW, ILI9341_BLACK);

Button btnVoltage2("Battery", ILI9341_BLUE, ILI9341_BLACK);

Button btnVoltage3("Inverter", ILI9341_RED, ILI9341_BLACK);

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
//char token[] = "opioxqafxw";
// Your network name and password.
char ssid[] = "free";
char WiFipassword[] = "zzZw23521041";

// Set ESP8266 Serial object
 #define EspSerial Serial2
 ESP8266 wifi(EspSerial);

void setup()

{
  PLDuino::init();
  PLDuino::enableLCD();
  PLDuino::enableESP();
  tft.begin();
  tft.setRotation(3);
  touch. init(1);

  // initialize all the readings to 0: 
  for (int thisReading = 0; thisReading < numReadings; thisReading++)
    readings[thisReading] = 0;

  Serial.begin(9600);
  delay(100);
  // Set ESP8266 baud rate
  EspSerial.begin(115200);
  delay(100);

  Cayenne.begin(username, password, clientID, wifi, ssid, WiFipassword);

  btnVoltage.setPositionAndSize(01, 01, 100, 75);
  btnVoltage.draw(tft);

  btnVoltage1.setPositionAndSize(01, 75, 100, 75);
  btnVoltage1.draw(tft);

  btnVoltage2.setPositionAndSize(01, 150, 100, 75);
  btnVoltage2.draw(tft);

  btnVoltage3.setPositionAndSize(175, 1, 150, 110);
  btnVoltage3.draw(tft);
  
 
}

void loop() {
  Cayenne.loop();
}
//front solar panel voltage
CAYENNE_OUT_DEFAULT()

{
  int adcVal = analogRead(A0);
  float adcVoltage = 55.0*adcVal/1024;
  Cayenne.virtualWrite(V1,adcVoltage);
  btnVoltage.setText(String(adcVoltage));
  btnVoltage.draw(tft);
  //delay (4000);
}
//back solar panel voltage
CAYENNE_OUT(V2)

{
  int adcVal1 = analogRead(A1);
  float adcVoltage1 = 55.0*adcVal1/1024;
  Cayenne.virtualWrite(V2,adcVoltage1);
  btnVoltage1.setText(String(adcVoltage1));
  btnVoltage1.draw(tft);
  //delay (4000);
}
//battery voltage
CAYENNE_OUT(V3)

{
  int adcVal2 = analogRead(A2);
  float adcVoltage2 = 55.0*adcVal2/1024;
  Cayenne.virtualWrite(V3,adcVoltage2);
  btnVoltage2.setText(String(adcVoltage2));
  btnVoltage2.draw(tft); 
  //delay (4000);
}
//inverter voltage
CAYENNE_OUT(V4)

{
  
  // subtract the last reading:
  total= total - readings[index];         
  // read from the sensor:  
  readings[index] = analogRead(inputPin); 
  // add the reading to the total:
  total= total + readings[index];       
  // advance to the next position in the array:  
  index = index + 1;                    

  // if we're at the end of the array...
  if (index >= numReadings)              
    // ...wrap around to the beginning: 
    index = 0;                           

  // calculate the average:
  average = total / numReadings * 575.0 / 1024;         
  // send it to the computer as ASCII digits
  //float average = 575.0*numReadings/1024;
  Cayenne.virtualWrite(V4,average);
  btnVoltage3.setText(String(average));
  btnVoltage3.draw(tft);
  //Serial.println(average);   
  delay(1);        // delay in between reads for stability            
}
CAYENNE_IN_DEFAULT()
{
  CAYENNE_LOG("Channel %u, value %s", request.channel, getValue.asString());
  //Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError("Error message");
}

  
  /*int adcVal3 = analogRead(A3);
  float adcVoltage3 = 575.0*adcVal3/1024;
  Cayenne.virtualWrite(V4,adcVoltage3);
  btnVoltage3.setText(String(adcVoltage3));
  btnVoltage3.draw(tft);
  //delay (4000);*/
//}