prefixkit Ask an engineerAsk Support RU

Smart home

MQTT discovery generator

Build an MQTT discovery message so a sensor, switch, button or number appears in Home Assistant by itself: the homeassistant/…/config topic, JSON with unique_id and device, mosquitto_pub commands and a configuration.yaml variant.

You can also publish from the browser with the MQTT client.

How discovery works

Home Assistant listens on homeassistant////config. When a description arrives there, the entity appears by itself, with no configuration.yaml edit. Publish it retained so the broker keeps it across Home Assistant restarts. To remove the entity, publish an empty retained message to the same topic. unique_id lets you rename and edit the entity in the UI, and the device block groups entities into one device.

Nothing shows up? Check the MQTT integration is set up with the same broker as the sender, and that the JSON is valid. Zigbee2MQTT and ESPHome use the same mechanism, with nothing to configure: Zigbee device catalog.

Idea?