Author Topic: How to start with MQTT  (Read 736 times)

gaston

  • Newbie
  • *
  • Posts: 26
    • View Profile
How to start with MQTT
« on: June 24, 2016, 06:03:07 am »
I a newbie to McThings and I am not a programmer, but eager to learn.
I watched the Door Switch Video. Very instructive and well done.
I open up an MQTT broker account with CLOUDMQTT as per the video.
However, there is nothing's about how to connect the phone application.

I am a iPhone user, any suggestion of a appl (IOS) than I can use on my phone and how to connect it to receive data from the MQTT broker?

Share on Facebook Share on Twitter


kristofferis

  • Sr. Member
  • ****
  • Posts: 287
  • Location: Sweden
    • View Profile
Re: How to start with MQTT
« Reply #1 on: June 24, 2016, 06:11:45 am »
Hello.
This is one of the good things with mcThings, you don't have to be a programmer to get started. There is a lot if example codes on the forum and if there is a question just ask and you will most likely get a good response.

Me myself use Android and not IOS but if you want to make some tests with MQTT then I recommend the Chrome App MQTTLens I assume that you use Chrome on you windows PC there you run mcStudio.
MQTTlens is a simple app that you could use to subscribe and publish to MQTT broker.
Like Like x 1 View List

plains203

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: How to start with MQTT
« Reply #2 on: June 24, 2016, 06:15:44 am »
MQTT Inspector is a good App for ios. The MQTT provider you signed up with will have some good info on how to access them via the app.
McGateway 0.6-360, 0.7-405
McModules 0.7-358
McStudio 0.7-894

gaston

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: How to start with MQTT
« Reply #3 on: June 24, 2016, 07:06:51 am »
Thank for you quick replies
kristofferis, you are right. I am using Chrome on my Window 10 PC. I just installed MQTTLens on my PC.
                  do you have an example for the whole process. What MQTT broker you are using, the program running on McThings how does MQTTLens fit in the story?  I understand that my McModule will be publishing, Is MQTTLens your Broker or the subcriper to the McThings publication?

plain203, I looked into MQTT Inpector. This appl look like a debuging tool to monitor traffic from publisher/broker/subscriber. I need to create these connection before monitoring and debuging. I was more interested in an appl wher you can see the result of a publication from McThing like in the video.
I might need it later on in my learing experience

kristofferis

  • Sr. Member
  • ****
  • Posts: 287
  • Location: Sweden
    • View Profile
Re: How to start with MQTT
« Reply #4 on: June 24, 2016, 07:20:56 am »
I am running a MQTT broker on a server that i have, I am using Mosquitto MQTT Broker.
mcGateway is connected to that broker and my mcModules is publishing information to that broker.

Example the current temperature, battery voltage on the modules and things like that and its easy to add more functions to the modules, monitor open windows/doors.
maybe you have seen my example in the forum about connecting to a touchscreen.

One of the reasons that i like the MQTT is that it is very simple to connect things to it, create a homepage that subscribes on some topics and displays the current temperatures.
If you connect a relay to a mcModule  then you could turn on / off that relay from the same homepage.
Very simple to send/receive information and let many different things share information.

I am using MQTTlens just to see what's going on when I am testing some new code that publish to the broker, I could also from MQTTLens publish information to the broker, so it's most for debugging. 

I could recommend reading the different parts of this blog
http://www.hivemq.com/blog/mqtt-essentials-part-1-introducing-mqtt just to get started with MQTT.
Useful Useful x 2 View List

plains203

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: How to start with MQTT
« Reply #5 on: June 24, 2016, 07:22:57 am »
You can publish (Send Messages) or subscribe (Recieve Messages) with the tool which means you can interact with your mcthings from your ios device and is very helpful when learning what your doing. You can use this to do something simple like turn the led on, on your module or you could get it to control your garage door etc with some additional wiring and components and code. Then once you have commands working through something simple like the app or the chrome extension then you could work on integrating into something else custom or openhab etc etc.
McGateway 0.6-360, 0.7-405
McModules 0.7-358
McStudio 0.7-894

mc-T2

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
  • mc-Things! The opportunities are endless!
  • Location: Canada
    • View Profile
Re: How to start with MQTT
« Reply #6 on: June 24, 2016, 11:04:59 am »
@Gaston - The app I used for the video (MQTT Dashboard) allowed me to enter my broker information and then enter the topics I was subscribed to via the settings. I was going to go through the instructions during the video but it was already getting long! The app settings were very intuitive and i assume other MQTT apps for Android and Apple will be similar. I had a quick search online and it does appear the MQTT Inspector is the best app available for Apple currently. In both Android and Apple there is a serious lack of these MQTT apps so if you know any app developers, this might be a good choice for their next app creation!
Need more mc-Modules, mc-Gateways or other mc-Things? Check out our product page: www.mcthings.com/products. mc-Development kits are available too!
Check out a live Dashboard using mcThings and Losant! Click here: https://goo.gl/ST43hB

gaston

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: How to start with MQTT
« Reply #7 on: June 24, 2016, 01:21:01 pm »
Thank you for the information. I am not yet ready to jump into MQTT still investigating.

There are examples programs in McStudio to Publish/Subcribe LightSwitch. These exchanges being made between 2 McModule, do they also require a MQTT Broker or does McGateway does the job of publishing and subcribing between two units under its control?

kristofferis

  • Sr. Member
  • ****
  • Posts: 287
  • Location: Sweden
    • View Profile
Re: How to start with MQTT
« Reply #8 on: June 24, 2016, 01:27:09 pm »
That you could do without broker.

Answer from mc-John:
You can publish to any device that is connected to the same gateway and subscribed to the topic. If you want to publish to a device that is connected to another gateway you MUST use MQTT. The MQTT broker can be in the LAN or in the cloud.
Like Like x 1 View List