Skip to content

MQTT

What is it?

MQTT (or Eclipse Mosquitto) is a lightweight messaging protocol that is designed for use in constrained devices and low-bandwidth, high-latency, or unreliable networks. It is commonly used in Internet of Things (IoT) devices/applications for efficient and reliable communication between devices.

Also, MQTT does not have a web interface, so you will need to use a client to interact with it.

1. Installation

sb install sandbox-mqtt

2. Setup

You can connect MQTT to Home Assistant and Node Red via docker hostname. Add the MQTT integration in Home Assistant and use mqtt as the hostname/Broker, and 1883 as the port. In Node Red, you can use the mqtt node to connect to the MQTT server.

While MQTT can be set up to use a username and password, it is not recommended to expose it to the internet. So by default, MQTT is not exposed to the internet, nor does it have a username and password.

To add a username and password, you will need to edit the mosquitto.conf file. You can find the file in the /opt/mqtt/config/ directory. You will need to add the following lines to the file:

mosquitto.conf
allow_anonymous false 
user <username> 
password <password>