Mosquitto: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 38: Line 38:
==MQTT Testing==
==MQTT Testing==
<source lang="bash">
<source lang="bash">
# mosquitto_sub -u arduino -P arduino -t dev/test
mosquitto_sub -d -u arduino -P arduino -t dev/test
mosquitto_sub -d -u arduino -P arduino -t dev/test
mosquitto_pub -m 'Hello, World' -u user -P pass -t dev/test
mosquitto_pub -m 'Hello, World' -u user -P pass -t dev/test

Revision as of 23:05, 19 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 arduino -P arduino -t dev/test
mosquitto_sub -d -u arduino -P arduino -t dev/test
mosquitto_pub -m 'Hello, World' -u user -P pass -t dev/test
mosquitto_pub -m 'Hello, Academian' -u user -P pass -t dev/test

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/

References