[go: nahoru, domu]

Setting up MQTT with Auto-Discovery on Home Assistant (settings)

After you’ve installed things for MQTT in Home Assistant, it’s time to make some settings.

1. Enable debug logs.

I don’t actually have much insight into what this does, but whatever. It sounds good. I did it. It didn’t hurt.

In the configuration.yaml file (see previous post for information on how to edit files), add:

logger:  
  default: warning  
  logs:  
    homeassistant.components.mqtt: debug

… and then reload the settings by restarting. Configuration -> Server Controls -> Check Configuration. If it’s ok, then continue to Server Management / Restart (all on the same page as Check Configuration). Give it a few minutes to restart. 

If you’re making more changes, you could bundle them and restart after making all of them. However, if you, like me, don’t know what you’re doing, then restarting individually gives you confidence that you didn’t just break something, and that you can make a small fix rather than have to dig into the details.

Link: here

2. Enable auto-discovery of MQTT devices

Auto-discovery is a bit of a misnomer – it doesn’t discover anything, it just allows you to add devices via MQTT instead of doing it with manual configuration files.

This is also in the configuration.yaml file. You need to specify a “topic” prefix that MQTT will listen out for. Basically anything that uses this prefix as a name will go through the auto-discovery flow and *might* be picked up for discovery. I used “homeassistant” here, use whatever you want; this is not for authentication. Here’s the part of the file:

mqtt:  
  discovery: true  
  discovery_prefix: homeassistant

In short, when I use a topic like “homeassistant/sensor/clouds” then Home Assistant (well, the MQTT integration) will consider it for auto-discovery. 

Reload the settings by restarting. Configuration -> Server Controls -> Check Configuration. If it’s ok, then continue to Server Management / Restart (all on the same page as Check Configuration). Give it a few minutes to restart. 

Links: MQTT discovery in Home Assistant

Comments / questions

There's currently no commenting functionality here. If you'd like to comment, please use Mastodon and mention me ( @hi@johnmu.com ) there. Thanks!

Related pages