The Ultimate Smart Home Integration Cookbook

Integration: It enables the smart home hub to communicate and work with various smart devices or services.

MQTT Integration

MQTT (Message Queuing Telemetry Transport) is a lightweight and efficient messaging protocol that provides a publish-subscribe communication model. The MQTT broker can be installed on all most any hardware, but Home Assistant has a plugin that we can use to set one up quickly. MQTT is popular with the DIY community because it’s great for devices with limited resources and unreliable networks. Some popular projects are ESPHome and Tasmota, to name a few. MQTT is also perfect for communicating between hubs without additional bulky add-ons.

Automation Details

Requirements

  • Custom Integrations

Actions:

  • Install MQTT Broker
Proficient
Proficient

Hubitat

Hubitat MQTT Integration

The Official Documentation for Hubitat MQTT Interface

Hubitat supports MQTT right out of the box, but only within drivers and doesn't have a broker.

Important: We still need an MQTT broker so we will be using the Home Assistant integration.

Home Assistant

Home Assistant MQTT Integration

The Official Documentation for Home Assistant MQTT Broker

Setting Up the Automation

  1. Important: The MQTT Broker service requires a user account.  It’s best security practice to create a new service account that only will be used for this service and has minimal privileges.

    First click Settings, then select People.

    Home Assistant Settings Menu
  2. Select the Users tab from the top of the screen, then click Add User.

    Home Assistant Users Screen
  3. Next, fill in the new service account information.  Then for security reasons, only allow the account to log in from the local network and is NOT an administrator. Finally, click the Create button.

    Home Assistant Add User
  4. Click the Settings tab, then select Add-ons.

    Home Assistant Settings Menu
  5. Click the Add-on Store button.

    Home Assistant Add-ons Screen
  6. Select the Mosquitto broker from the official add-ons list.

    Home Assistant Add-on Store Screen
  7. Next click Install.

    Home Assistant Mosquitto Broker Screen
  8. Once the broker is installed, make sure that the service starts on boot and any other setting you want.  Then click Start.

    Home Assistant Mosquitto Broker Settings
  9. Next, go to Settings and Devices & Services.

    Home Assistant Settings Screen
  10. You should see the MQTT under Discovered, click the Configure button.

    If you don’t see it you will have to click the Add Integrations and search for it.

    Home Assistant Integrations Screen
  11. Click the Submit button.

    Home Assistant Integrations Screen MQTT Add-on
  12. Finally, click Finish.

    Home Assistant Integrations Screen MQTT Add-onv
  13. Then click the MQTT from the list of Integrations.

    Home Assistant Integrations Screen
  14. In the MQTT integration, select configure next to the Mosquitto broker.

    Home Assistant MQTT Integrations Screen
  15. Under MQTT Settings, click Re-Configure MQTT.

    Home Assistant Mosquitto Broker Configuration Screen
  16. On the Broker Options screen, enter your MQTT service account we created earlier. Then click Next.

    Home Assistant Mosquitto Broker Options Screen
  17. Next, click Submit.

    Success: That’s it, the Mosquitto Broker is installed and configured.

    Home Assistant Mosquitto Broker Options Screen
  18. Now we will perform a quick test to ensure everything is working correctly.

    1. Under the Listen to a Topic section, enter a topic. This can be anything you like.
    2. Then click Start Listening.
    3. Under the Publish a packet section, enter the exact same topic we entered earlier.
    4. Then, for the Payload, enter some text.
    5. Finally, click Publish.

    Home Assistant Mosquitto Broker Configuration Screen
  19. You should see your topic’s payload under the Listen to a Topic section.

    Home Assistant Mosquitto Broker Configuration Screen