Automation - MQTT
Jump to navigation
Jump to search
- Proven on Mint 19.3
- Proven on SparkyLinux 5.11
- Proven on raw Debian (With a caveat)
Installing Mosquitto
sudo apt-get install mosquitto
Pretty simple, eh?
Ensure that Mosquitto broker is running
sudo service mosquitto status
expected result is Active: active (running)
Debian Caveat
Install client tools for testing etc
(Do this on any machine expected to manually use MQTT)
sudo apt install mosquitto-clients
Testing
In a terminal:
mosquitto_sub -h localhost -t "mqtt" -v
In another terminal:
mosquitto_pub -h localhost -t "mqtt" -m "Hello MQTT"
Now the message “mqtt Hello MQTT
” will be displayed in the first terminal where the topic “mqtt” is subscribed.
Subscribing to #
gives you a subscription to everything except for topics that start with a $
(these are normally control topics anyway).