Jump to content

MQTT test on Orange Pi Lite


msmartbot

Recommended Posts

I use mosquitto as a MQTT broker on my opi+2e and it works well. It can be installed from standard repo, just do:

sudo apt-get update
sudo apt-get install mosquitto

Before you can publish or subscribe to any topic, you have to install some clients:

apt-get install mosquitto-clients

Then you can send data (publish) to the broker on a topic, and/or get them (subscribe):

# publish 32.5 value to topic sensor/temperature on localhost
mosquitto_pub -h localhost -t sensor/temperature -m 32.5

# subscribe to topic sensor/temperature on localhost: it waits until ctrl+c for any publish values
mosquitto_sub -h localhost -t "sensor/temperature"

To test your local broker, you have to write the subscribe command in a terminal and the publish one in another and you can repeat the publish one with different values. You should see the values appearing in the subscribe terminal.

 

You can also use node-red to manipulate MQTT message with other protocols or sources or targets for your data. You'll find easily some tutorials on the internet.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines