Skip to content

A CoogleIOT wrapper class to simplify integrating sensors with IoT frameworks

License

Notifications You must be signed in to change notification settings

mikeofqyn/CoogleSensors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CoogleIOT wrapper library to manage sensors and actuators

The library CoogleIOT (https://github.com/ThisSmartHouse/CoogleIOT) simplifies the development of IOT projects based on Espressif ESP8266 boards.

This wrapper library extends the CoogleIOT API adding some functions to make even easier the task of generating MQTT messages and control the sensor through mqtt messages.

Tested with:

  • NodeMCU 1.0 ESP8266 (ESP-12E) Module
  • ESP-01 Module (Generic ESP8266 module)

ESP-12E:

    Using board 'nodemcuv2' from platform in folder:
        C:\Users\<user>\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.1

ESP-01:

    Using core 'esp8266' from platform in folder: 
        C:\Users\<user>\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.1

Compatibility Issues

Some configuration has to be made on the PubSubClient library which cannot be made in the sketch , since #define macros in the main .ino files are not visible to the compiler while compiling the libraries' .cpp files.

PubSubClient default packet size

The library's default packet size of 128 won't work with CoogleIOT as explained in CoogleIOT's README.md doc (MQTT Client Notes, https://github.com/ThisSmartHouse/CoogleIOT#mqtt-client-notes).

In PubSubClient.h

 // MQTT_MAX_PACKET_SIZE : Maximum packet size  
 // [NOTE] CHANGED FROM 128 TO 1024 FOR COMPATIBILITY WITH COOGLEIOT
 #ifndef MQTT_MAX_PACKET_SIZE
 #define MQTT_MAX_PACKET_SIZE 1024  // WAS 128
 #endif

Old MQTT brokers

Very old versiosn id the Mosquitto MQTT broker rejected version 3_1_1 messages which is the default in the library. In this case, change to 3_1:

In PubSubClient.h

 // MQTT_VERSION : Pick the version 
 // [NOTE] Use 3_1 for compatibility with very old mosquitto brokers
 #define MQTT_VERSION MQTT_VERSION_3_1  // remove to use 3_1_!
 #ifndef MQTT_VERSION
 #define MQTT_VERSION MQTT_VERSION_3_1_1
 #endif

About

A CoogleIOT wrapper class to simplify integrating sensors with IoT frameworks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published