HomeAssistantManager - A wrappe for MQTT autodiscovery
HomeAssistantManager is a lightweight MQTT auto-discovery library only for ESP32 that eliminates boilerplate code for Home Assistant integration.
Key features:
- Auto-discovery via MQTT - devices appear in HA automatically
- Simple API for sensors, switches, buttons, and binary sensors
- Built-in diagnostics (RSSI, uptime, heap, reset reason)
- Production-ready with comprehensive examples
Show me the code!
Here's a complete example that creates a temperature sensor and a button:
#include "HomeAssistantManager.h"
HA::Manager Manager("your-ssid", "your-password", "mqtt-host");
HA::Sensor::Generic tempSensor(&Manager, "Temperature", HA::Temperature);
HA::Button::Generic testButton(&Manager, "Test Button");
void setup() {
Manager.begin("ESP32_HASS", "MyCompany", "ESP32", "1.0.0");
testButton.setCommandCallback([]() {
Serial.println("Button pressed from HA!");
});
}
void loop() {
hassManager.loop();
tempSensor.setValue(23.5, 1);
delay(5000);
}
That's it! Your device appears in Home Assistant automatically (requires MQTT integration configured).
Supported: Sensors, Binary Sensors, Buttons, Switches, plus auto-diagnostic sensors.
Installation
PlatformIO:
lib_deps =
dereibims/HomeAssistantManager@^1.1.2
knolleary/PubSubClient@^2.8
bblanchon/ArduinoJson@^7.0
thijse/ArduinoLog@^1.0.1
Links: GitHub | PlatformIO Registry
Perfect for smart home projects, environmental monitoring, automation controllers, and learning ESP32/HA integration. Feedback welcome!
MIT Licensed | ESP32 only | Requires PubSubClient, ArduinoJson, ArduinoLog
Posted Feb 7, 2026, 11:00 PM UTC
118