This library helps you to connect to viralink.io server with The most needed examples.
- Connect to viralink.io or any Thingsboard server via MQTT Protocol.
- Send Telemetry and Attributes to Server
- OTA Update via MQTT. (Only supports esp8266 and esp32)
- Implement the queue for queuing the mqtt messages when not connected to server to prevent data lost
- Implement custom Uptime class instead of millis(). millis() only support 49 days but this implementation support upto 584m year! (uint64_t milliseconds).
- Configure your network Interfaces and Auto Connect to Interfaces base on priorities, Also you can set Auto Reconnect that will try to reconnect when interface disconnected!
- MQTTController.loop() can run on other cores (on freeRTOS systems like esp32).
- ESP8266
- ESP32
This library and its examples are dependent on the following libraries
- MQTT PubSub Client — for interacting with MQTT.
- ArduinoJSON — for dealing with JSON files.
- TinyGSM — for connecting via GSM network. Only Used in examples and it is Optional.
- SSLClient — for connecting to MQTT client via ssl. Only used in examples and it is Optional. Not Working ON ESP8266!.
You can install this library via Platformio and/or Arduino IDE.
All dependencies will be installed automatically.
Just add ViraLink-MQTT-Client to your platformio.ini
This is a example of paltformio.ini for ESP32 DevKit.
NOTE: This is just an example. Update the version of the library to the latest !
[env:myenv]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
lib_deps =
viralink/Viralink_Arduino_SDK @ ^0.1.0
All Required libraries can be installed directly from the Arduino Library manager.
- From Tools => Manage Libraries...
- Search for ViraLink-MQTT-Client
- Select Install
- Select Install All
If you are using platformio just rename one example .ino file to main.cpp file in your src folder.
Build the project:
pio run -e myenv
Upload (flash) to the board:
pio run -t upload -e myenv