/hass-mqtt

Home Assistant projects for working with MQTT

Primary LanguagePythonMIT LicenseMIT

hass-mqtt

Home Assistant MQTT projects and notes

Setup MQTT broker in Home Assistant

There is a built in broker, but I decided to use the addon broker in hassos instead. There was an issue using TLS between the containers, but otherwise the setup was pretty straight forward. More details:

First MQTT sensor

Home Assistant can generate sensors dynamically if you enable the MQTT discovery option. Once enabled the following topic/payloads will create new entities.

Topic: homeassistant/binary_sensor/garden/config
Payload: {"name": "garden", "device_class": "motion"}

Topic: homeassistant/binary_sensor/garden/state
Payload: ON
Payload: OFF

To remove the sensor send an empty payload to the same config topic

More resources