Skip to content
Projets

À propos

A library to make using WiFi & MQTT on the ESP8266 easy.

Systèmes et infrastructure

Comment ces chiffres sont mesurés

What you can do

  • Automatic WiFi and MQTT Connection Management: Handles connecting, reconnecting, and resubscribing to MQTT topics.
  • MQTT Topic Subscription Management: Add, remove, and auto-resubscribe to topics.
  • OTA Updates: Easily enable/disable OTA, set OTA password and hostname.
  • Broadcast Mode: Create an access point for configuration or OTA when no WiFi is available.

Progression mesurée des étoiles

in 24h
0
in 7 days
0
in 15 days
+1
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

ESPHelper

ESPHelper is a C++ library designed to simplify WiFi and MQTT connectivity for ESP8266 and ESP32 platforms. It manages WiFi and MQTT connections, automatic reconnection, topic subscriptions, and supports OTA (Over-The-Air) updates, making it ideal for IoT and home automation projects.

Features

  • Automatic WiFi and MQTT Connection Management: Handles connecting, reconnecting, and resubscribing to MQTT topics.
  • MQTT Topic Subscription Management: Add, remove, and auto-resubscribe to topics.
  • OTA Updates: Easily enable/disable OTA, set OTA password and hostname.
  • Broadcast Mode: Create an access point for configuration or OTA when no WiFi is available.
  • Web Configuration: Optional web interface for device configuration (ESPHelperWebConfig).
  • Callback Support: Set custom callbacks for WiFi connection, WiFi loss, and MQTT messages.
  • Secure MQTT: Supports SSL/TLS connections to MQTT brokers.

Requirements

Make sure you have these libraries installed:

In addition to those libraries, make sure that you have the ESP core files installed for your platform.

Getting Started

See the examples/GettingStarted folder for usage examples.

Basic Usage

#include "ESPHelper.h"

ESPHelper helper;

void setup() {
    helper.setSSID("yourSSID");
    helper.setPASS("yourPassword");
    helper.setMQTTIP("mqtt.example.com");
    helper.begin();
}

void loop() {
    helper.loop();
}

Useful Methods:

  • bool begin(); Initialize the system (must be called once).

  • int loop(); must be called as often as possible to maintain connections and run the various subsystems

  • bool subscribe(char* topic); subscribe to a given MQTT topic (will NOT auto re-subscribe on connection lost)

  • bool addSubscription(char* topic); add a topic to the subscription list (will auto re-subscribe on connection lost)

  • bool removeSubscription(char* topic); remove a topic from the subscription list and unsubscribe

  • void publish(char* topic, char* payload); publish a given MQTT message to a given topic

ToDo

  • Implement callback for lost WiFi connection

Explorer des projets similaires

Chargement…