Watch this video to follow along at each step:
Home Assistant is a popular open-source home automation platform that provides a unified interface to control and monitor different smart devices. Instead of juggling separate apps for different brands, you can manage everything through a single Home Assistant web dashboard on a local server like Raspberry Pi.
We've previously explored Home Assistant's WebSocket API using Postman. Now let's delve into Home Assistant's MQTT integration, used by 44% of all active installations, to access smart devices across your connected home.
When it comes to transmitting data in a connected home environment, REST, WebSockets, and MQTT are commonly used protocols, but for different use cases.
In the next section, let's try using MQTT with Home Assistant for home automation.
passwordfor the new user, since we will use those credentials to configure our MQTT devices and authorize our MQTT messages.
Hostnamefor the next step.
Hostnameof the broker from Step 2, and
passwordfrom the user created in Step 1.
mqtt://homeassistant.localand observe the connection details reflected on the bottom. This is also where you will see inbound and outbound messages displayed.
everything/smart/homeand hit Send. You can also save messages to re-use later on.
everything/smart/homeby switching the toggle on. This means the Postman client is subscribed to receive any data published to that topic.
everything/smart/hometo see what happens. Postman can send messages, and also receive messages published to the topic that it is subscribed to. This messaging pattern is called publish-subscribe. Notice outbound messages are displayed next to an up arrow, and inbound messages are displayed next to a down arrow.
If you have a device that communicates over MQTT, you may need to configure the device to enable Home Assistant discovery. Every device and manufacturer is likely to follow a different process, so the following steps are just one example.
Depending on the response format, you can also select the Visualization tab of the response to show a message stream in a graphical format, a more comprehensible way to view telemetry data. Learn more about the MQTT response.
Watch this video to recap the steps:
For more hands-on tutorials, check out these resources.