Skip to content

Arduino library MQTT wrapper for setting up an MQTT connection

License

Notifications You must be signed in to change notification settings

Johboh/MQTTRemote

Repository files navigation

MQTTRemote

PlatformIO CI ESP-IDF CI Arduino IDE GitHub release Clang-format

Arduino (using Arduino IDE or PlatformIO) and ESP-IDF (using Espressif IoT Development Framework or PlatformIO) compatible library MQTT wrapper for setting up an MQTT connection.

The wrapper was created to reduce boilerplate of common MQTT setup code that I was repeated in various projects.

Given the MQTT host and credentials, it connects to the host and reconnect on connection loss. It provides methods for publishing messages as well as subscribing to topics. On connection, it publish online to the client-id/status topic, and sets up a last will to publish offline to the same topic on connection loss/device offline. This is a common practice for devices running as Home Assistant nodes.

Installation

PlatformIO (Arduino or ESP-IDF):

Add the following to libs_deps:

   Johboh/MQTTRemote

Espressif IoT Development Framework:

In your existing idf_component.yml or in a new idf_component.yml next to your main component:

dependencies:
  johboh/mqttremote:
    version: ">=4.0.5"

Arduino IDE:

Search for MQTTRemote by johboh in the library manager. See note about version above.

Note: Need ESP32 core v3.0.3 until this issue has been fixed. If you get issues with undefined reference to lwip_hook_ip6_input'`, try a different ESP32 core version. Need at least 3+ for C++17 support.

Examples

Functionallity verified on the following platforms and frameworks

Newer version most probably work too, but they have not been verified.

Dependencies

About

Arduino library MQTT wrapper for setting up an MQTT connection

Resources

License

Stars

Watchers

Forks

Packages

No packages published