Lesson 4 MQTT - Water-Monitor/IoT-Portfolio-FJS GitHub Wiki

While playing around in Node-Red we had to setup MQTT in it as well. We learned the commands that are supported by IoTEmpowered and played around with it.

MQTT

MQTT

Allows us to publish and receive messages wia ip addresses. To get Mosquitto running, we need to enter 'iot' in the terminal. Then enter 'mqtt_broker' to run Mosquitto.

  • mqtt_sub = subscribe (listen) to a topic
  • mqtt_pub = publish (send) a message in a topic
  • shorter version: mqtt_send & mqtt_listen

Example: mqtt_pub -h 192.168.12.1 -t food -m apple

Wildcards

  • adding a 'hashtag' allows us to listen to all topics
  • the 'plus' is a placeholder, everything that’s in quotation “topic/+” will be added. For example topic/one and topic/two exist. With topic/+ you will receive both.

Reflection Stijn

I am familiar with command-line and I like it. I explained to Johanna why we only had to run the start up command for the Node-Red and MQTT on one computer. With the topics I was messing a lot, since I wanted to try out what was all possible with it. What I found out was that with -v you can see more information. Johanna found out that you could do something with + and #, so I divied into that. Toms example helped a lot to finally get an example myself working. I also explained and helped Fadi with the commands and the different possibilities that exist.

I found it really cool to work with MQTT. I have worked with AMQP in the past for a week during school, so I understood the basics and the reasoning behind it. The way we setted it up and did it was new for me and is very refreshing. To me its such a cool concept that you can make topics and send messages to multiple devices at once.

However, I think the explanation that we covered in class about MQTT was very vague for those who had never hearded about it. For me it was enough, but I think giving less attention to list all different messaging frameworks and therefore focus on how MQTT works and what it is on a deeper level would have been easier for those who did not have any experience or knowledge with MQTT.