Install Mosquitto and its command line clients

Check it’s running

What you want to see is something like

To start, stop and restart the broker in future, use the commands

Test that it’s working

In your existing terminal, subscribe to the “testtopic” topic

Then open another terminal and send a message on that topic

If all goes well then should see the message printed to the first terminal

Success! You have a working MQTT broker running on the default port 1883.

Adding Websocket protocol support

Currently we only have MQTT protocol, so to enable Websockets on port 1884, we need to configure and restart Mosquitto. To do this, start by creating a configuration file in the appropriate location. I’ve called mine protocols.conf.

Define the contents like so

And again, restart with

 

Instalar Home Assistante em container Docker 

docker run --init -d --name="home-assistant" -e "TZ=Europe/Lisbon" -v /home/homeassistant:/config --net=host homeassistant/raspberrypi4-64-homeassistant:stable