MQTT can be installed within Home Assistant for communication with devices that support MQTT. In the case of Zigbee devices will use Zigbee2MQTT which utilises this server.
Install MQTT
- Add MQTT broker to HASS
- Go to Settings -> Add-Ons, click Add-On Store
- Find Mosquito broker and install; will install in HASS
- Tick Watchdog
- Accept default config (Configuration tab)
- Press Start
- Add MQTT integration
- Go to Settings -> Devices and Services -> Integrations tab
- MQTT should appear as a discovered integration
- Click Configure then click Submit
- Click Finish
Configure MQTT Devices
- Devices need MQTT setup:
- Host: 192.168.0.21 [IP address of Home Assistant]
- Port: 1883
- Username: homeassistant
- PW: [STRONGBOX]
- To find MQTT server settings:
- Go to Settings -> Devices and Services -> Integrations tab
- On Mosquito broker click Configure, click Re-Configure MQTT
- The broker options will be shown and the username/password can be checked
Standard MQTT Devices
- Devices that have been setup with ESPHome are automatically configured in Home Assistant. Other devices will need MQTT to be manually configured:
- Setup device with MQTT server IP / username / PW as above
- In Home Assistant’s
configuration.yaml
file add code to process MQTT message (could be packaged intomqtt.yaml
if gets many entries):
1 2 3 4 5 6
# Read MQTT from Garage Sensor mqtt: sensor: - name: "Garage Temperature" state_topic: "esp-gina/temperature" unit_of_measurement: "°C"