What can be done with Labeeb IoT Arduino library for devices
Using this library,you will be able to communicate and publish data to Labeeb IoT through MQTT:
MQTT connectivity :
Client initialization : where you can specify the server address and access credentials.
Connect to Labeeb IoT server: where you can establish the connection with Labeeb IoT.
Publish data to Labeeb IoT platform: where you can send your data to Labeeb IoT.
Subscribe to data on Labeeb IoT platform :where you can receive data from other devices/ends through Labeeb platform.
Library download and import :
Before you start using this library you need:
1) Download the library files from here: Download link.
2) Extract the folder named : "LabeebIoT".
3) Copy the folder "LabeebIoT" to Arduino IDE library directory, regularly placed in : "C:\Program Files (x86)\Arduino\libraries ".
4) Start Arduino IDE and make sure the library is loaded by checking File > Examples > LabeebIoT, open the "ESP8266_push_sub_labeeb" example and follow the rest of this tutorial.
Hands on Using the Library to push data to Labeeb through MQTT on ESP8266 controller:
What is "ESP8266" ?
The ESP8266 is a low-cost Wi-Fi chip with full TCP/IP stack and MCU (microcontroller unit) capability produced by Shanghai-based Chinese manufacturer, Espressif Systems, and it's compatible with Arduino core and can be programmed using Arduino IDE.
Initialize the connection:
Create and initialize LabeebIoT object by calling the following constructor :
Since the parameters are :
a) espClient : wifi client object on ESP8266 or you can use Ethernet client object when using Arduino board with Ethernet shield.
b) mqtt_server: where you specify the address of MQTT hosting server : mea.labeeb-iot.com
c) port number of the MQTT broker, default is : 1883.
d) ENTERPRISE NAME : where you specify the enterprise name used when you have created your Labeeb account. If you dont have on, visit mea.labeeb-iot.com and create free account.
Connect to Labeeb IoT:
Use connectLabeeb function to establish the connection with Labeeb IoT platform with the following parameters:
a) Client ID: the Client ID that will be used to connect to the MQTT broker, can be any ID.
b) TEMPLATE ID: the device template ID that was created in Labeeb platform.
c) TEMPLATE PASS: the device template password that was specified while creating the device template.This password will be used to connect to the MQTT broker
Publish single datatype data to Labeeb IoT :
Use publishLabeebValue function to publish a single value to labeeb IoT platform with the following parameters:
a) device name: the device name within Labeeb IoT platform.
b) data model: the data type name which belong to the specified device.
c) data type: data type name which belong to the specified data model.
d) value: sensor value.
e) timestamp: Linux formatted time stamp.
f) optionally you can add location parameters: longitude,latitude,altitude.
Publish multiple data types to Labeeb IoT :
Use publishLabeeb function to publish a multiple values to labeeb IoT platform with the following parameters:
a) data Type - values pairs: use the following format : "datatype1:value1,datatype2:value2"
Subscribe to a specific topic:
you can also subscribe to some topic by calling: