Using MQTT on Onion Omega2+

MQTT is an important protocol for data exchange in IoT networks.The communication between the producer of data (publisher) and the consumer of that data (subscriber) goes over an MQTT Broker always.

publish_subscribe

There are some free MQTT Broker around. I use CloudMQTT  of the Swedish company 84codes AB for my applications. CloudMQTT are Mosquitto server in the cloud.

Whats’s to do on Onion Omega2+ side after creating an MQTT account?

We have to install Mosquitto.

opkg update 
opkg install mosquitto mosquitto-client libmosquitto

I have here several temperature sensors in a controller network that send temperature and humidity data to the CloudMQTT broker.

To subscribe these data the follwoing subscribe command is needed on Onion Omega2+:

mosquitto_sub -h m20.cloudmqtt.com -u "ra.....id" -P "ah.....8JS" -p 12394 -t "DHT11/+/#" -v

You must change the user (-u), password (-P), and port (-p) to the login data of your broker account.

As you can see from the following screenshot it’s winter in Switzerland with around 2°C and 80 % rel. Humidity.

subscription

Using MQTT on Onion Omega2+

2 thoughts on “Using MQTT on Onion Omega2+

Leave a comment