Home Assistant MQTT Discovery
Create a test sensor/entity through MQTT discovery and verify availability handling.
Topology and objective
Device → MQTT broker → Home Assistant discovery/state/availability topics.
Hardware and tools
- Supported development board
- USB data cable
- Current-limited supply
- Serial monitor and logic analyser when applicable
Security and RF safety
- Use broker authentication and topic ACLs.nDo not expose Home Assistant or MQTT directly to the internet.nRemove test entities and retained messages after the lab.
Practical procedure
- Use a dedicated test device ID.nPublish retained discovery configuration.nPublish state and online availability.nRestart subscriber and verify retained restoration.nPublish offline and remove test discovery when complete.
Telemetry / payload
{"name":"Lab Temperature","state_topic":"tcs/lab/ha01/state","availability_topic":"tcs/lab/ha01/status","unit_of_measurement":"°C"}Starter code / config
Discovery topic: homeassistant/sensor/ha01/temperature/configExpected results
| Checkpoint | Expected | Tool |
|---|---|---|
| Discovery | Entity appears once | Home AssistantnAvailability |
Troubleshooting
| Symptom | Check | Action |
|---|---|---|
| Entity missing | Validate discovery prefix and retained JSON | Republish valid confignStale entity |
Local-only sandbox
Commands & telemetry simulator
Send command
Simulator ready. No network connection is used.
