MycilaHADiscovery¶
Simple and efficient Home Assistant MQTT Discovery library for Arduino / ESP32.
The library builds Home Assistant discovery configuration payloads for you: you describe entities with plain C++ objects, publish them through your MQTT transport, and Home Assistant creates the corresponding devices and entities. Strings are owned by the components, so IDs, names and topics can be generated at runtime.
Releasing¶
Run the Bump version workflow with a major.minor.patch version to open a pull request against the default branch. The script can also be run locally as python3 .github/scripts/update-version.py 1.2.3; it updates the library descriptors, version macros, and current-version references in the README and documentation.
The workflow requires Actions to be allowed to create pull requests in the repository settings. Pull requests created with GITHUB_TOKEN do not trigger other workflows; optionally configure a VERSION_BUMP_TOKEN repository secret with a token that can write contents and pull requests to run the usual checks.
After merging the bump, create and push a tag for that commit. Run Publish to PlatformIO with the tag name (or latest for the most recently created tag). Configure the PLATFORMIO_AUTH_TOKEN repository secret before publishing.
Supported Components¶
Editable components:
- Button
- Switch / Outlet
- Select
- Number (slider, box, auto with min, max, step)
- Text (input)
- Climate (temperature, mode, action and preset topics)
- Cover (positions and tilt)
- Fan (speed, oscillation, direction, presets)
- Date, Time and Datetime
- Notify
- Siren (tones, duration and volume)
- Valve
- Humidifier
- Lock
- Water Heater
- Device Tracker
- Light (brightness, color temperature, RGB / RGBW / RGBWW, HS, XY, effects)
The components map to these Home Assistant MQTT platforms: button, switch, select, number, text, climate, cover, fan, date, time, datetime, notify, siren, valve, humidifier, lock, water_heater, device_tracker, light, sensor, binary_sensor and update.
Sensors:
- Value (text), State (binary), Gauge (measurement), Counter (total increasing), Total and Enum
- Update (firmware)
Features¶
- Device grouping: entities are attached to a single device
- Availability: global (LWT) and per component topics with payloads and templates
- Optional entity IDs (
default_entity_id, slugified like Home Assistant), enabled-by-default settings and expiration (expireAfter) for sensors - Custom discovery topics per component (
configTopicoverride) - String ownership: components take IDs, names and topics by value — safe for dynamically generated entities
Every component reference page lists the options using the same names as the Home Assistant MQTT documentation.