Skip to content

A simple and efficient MQTT helper for Arduino / ESP32 based on Espressif MQTT Client

License

Notifications You must be signed in to change notification settings

mathieucarbou/MycilaMQTT

Repository files navigation

MycilaMQTT

License: MIT Continuous Integration PlatformIO Registry

A simple and efficient MQTT helper for Arduino / ESP32 based on Espressif MQTT Client

  • Automatic reconnect
  • Automatic resubscribe
  • Dead simple configuration which allows easier integration with a configuration system and quick reload (end() and begin()) of the client
  • automatic management of will topic
  • Arduino 3 (ESP-IDF 5.1) Support

Usage

  mqtt.onConnect([]() {
    Serial.println("MQTT connected");
  });

  mqtt.subscribe("my-app/value/set", [](const String& topic, const String& payload) {
    Serial.printf("MQTT message received: %s -> %s\r\n", topic.c_str(), payload.c_str());
  });

  mqtt.begin();
  mqtt.publish("my-app/value", "Hello World!");