Mosquitto: Difference between revisions
Jump to navigation
Jump to search
(15 intermediate revisions by the same user not shown) | |||
Line 16: | Line 16: | ||
ssh -L 1883:localhost:1883 [email protected] | ssh -L 1883:localhost:1883 [email protected] | ||
</source> | |||
==MQTT Users== | |||
<source lang="bash" highlight="5,6,11,13" line> | |||
cat > /etc/mosquitto/conf.d/users.conf <<'EOF' | |||
# Chorke Academia, Inc | |||
# MQTT Users Config | |||
allow_anonymous false | |||
password_file /etc/mosquitto/passwd | |||
EOF | |||
cd /etc/mosquitto/ | |||
# create first only user | |||
mosquitto_passwd -c passwd admin | |||
# create next respective mqtt users | |||
mosquitto_passwd -b passwd user pass | |||
cd $HOME | |||
</source> | |||
==MQTT Testing== | |||
<source lang="bash"> | |||
mosquitto_sub -u user -P pass -t dev/test | |||
mosquitto_sub -u user -P pass -t dev/test -d | |||
mosquitto_pub -u user -P pass -t dev/test -m 'Hello, World' | |||
mosquitto_pub -u user -P pass -t dev/test -m 'Hello, Academian' | |||
</source> | |||
<source lang="bash"> | |||
mosquitto_sub -h host -u user -P pass -t dev/test | |||
mosquitto_sub -h host -u user -P pass -t dev/test -d | |||
mosquitto_pub -h host -u user -P pass -t dev/test -m 'Hello, World' | |||
mosquitto_pub -h host -u user -P pass -t dev/test -m 'Hello, Academian' | |||
</source> | </source> | ||
Line 39: | Line 74: | ||
==References== | ==References== | ||
* [https://mosquitto.org/blog/2013/01/mosquitto-debian-repository/ Mosquitto Debian repository] | * [https://mosquitto.org/blog/2013/01/mosquitto-debian-repository/ Mosquitto Debian repository] | ||
* [https://github.com/knolleary/pubsubclient Arduino Client for MQTT] | |||
* [https://github.com/sanjeshpathak/Mosquitto-Dashboard Mosquitto Dashboard] | |||
* [https://mosquitto.org/download/ Mosquitto Download] | * [https://mosquitto.org/download/ Mosquitto Download] | ||
* [https://pastebin.com/Etn59ppp Mosquitto Config] | * [https://pastebin.com/Etn59ppp Mosquitto Config] | ||
* [https://www.home-assistant.io/getting-started/ Home Assistant] | * [https://www.home-assistant.io/getting-started/ Home Assistant] | ||
* [https://nodered.org/ Node-RED] | * [https://nodered.org/ Node-RED] |
Latest revision as of 02:58, 23 March 2020
df -h
vcgencmd measure_temp
apt list --upgradable
apt upgrade
apt -f install
apt install mosquitto/stable
apt install mosquitto-clients/stable
df -h
mosquitto -v
systemctl start mosquitto
systemctl status mosquitto
systemctl enable mosquitto
ssh -L 1883:localhost:1883 [email protected]
MQTT Users
cat > /etc/mosquitto/conf.d/users.conf <<'EOF'
# Chorke Academia, Inc
# MQTT Users Config
allow_anonymous false
password_file /etc/mosquitto/passwd
EOF
cd /etc/mosquitto/
# create first only user
mosquitto_passwd -c passwd admin
# create next respective mqtt users
mosquitto_passwd -b passwd user pass
cd $HOME
MQTT Testing
mosquitto_sub -u user -P pass -t dev/test
mosquitto_sub -u user -P pass -t dev/test -d
mosquitto_pub -u user -P pass -t dev/test -m 'Hello, World'
mosquitto_pub -u user -P pass -t dev/test -m 'Hello, Academian'
mosquitto_sub -h host -u user -P pass -t dev/test
mosquitto_sub -h host -u user -P pass -t dev/test -d
mosquitto_pub -h host -u user -P pass -t dev/test -m 'Hello, World'
mosquitto_pub -h host -u user -P pass -t dev/test -m 'Hello, Academian'
NodeRED
df -h
vcgencmd measure_temp
apt list --upgradable
apt upgrade
apt -f install
apt install nodered/stable
df -h
systemctl start nodered
systemctl status nodered
systemctl enable nodered
ssh -L 1880:localhost:1880 [email protected] http://localhost:1880/