uploaded 1 month ago
MQTT wrapper for setting up an MQTT connection


# MQTTRemote
[![Platform I/O CI](](
[![ESP-IDF CI](](
[![GitHub release](](

Arduino (using Arduino IDE or Platform I/O) and ESP-IDF (using Espressif IoT Development Framework or Platform I/O) 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
#### Platform I/O (Arduino or ESP-IDF):
Add the following to `libs_deps`:
#### Espressif IoT Development Framework:
In your existing `idf_component.yml` or in a new `idf_component.yml` next to your main component:
    version: ">=4.0.1"

### Examples
- [Arduino framework](examples/arduino/publish_and_subscribe/PublishAndSubscribe.ino)
- [ESP-IDF framework](examples/espidf/publish_and_subscribe/main/main.cpp)

### Functionallity verified on the following platforms and frameworks
- ESP32 (tested with platform I/O [espressif32@6.4.0]( / [arduino-esp32@2.0.11]( / [ESP-IDF@4.4.6]( / [ESP-IDF@5.1.2]( on ESP32-S2 and ESP32-C3)
- ESP8266 (tested with platform I/O [espressif8266@4.2.1]( / [ardunio-core@3.1.2](

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

### Dependencies
- For Arduino: @^2.5.1


Supports all targets

License: MIT

To add this component to your project, run: add-dependency "johboh/mqttremote^4.0.1"

or download archive


  • ESP-IDF >=4.4.3
  • Examples:


    To create a project from this example, run: create-project-from-example "johboh/mqttremote^4.0.1:espidf/publish_and_subscribe"

    or download archive (56 bytes)


    • Archive size
      Archive size: 10.16 KB
    • Downloaded in total
      Downloaded in total 521 times
    • Downloaded this version
      This version: 321 times


    johboh/mqttremote version: 4.0.1