Author Topic: Setting up MQTT on pi and gateway  (Read 266 times)


  • Newbie
  • *
  • Posts: 6
    • View Profile
Setting up MQTT on pi and gateway
« on: June 28, 2017, 07:03:27 pm »
Let me explain my situation first, I've already successfully sent data to the losant web server using mqtt via the gateway with data from a mcModule 120 (it was very simple with great documentation), now my boss wants me to figure out how to send the same data to AWS,but from what I've found I can't directly publish the data due to the IOT certifications that AWS needs to accept data. I saw that you can use a pi as a "middleman" so to speak to receive the data from the gateway then publish it to AWS. I've installed mosquitto and the client runs ok (v3.1) on the pi but I do not know how to properly configure the gateway for this or what part of my code I should modify to make this work.

So has anyone been able to successfully do something similar or am I missing something obvious?.

Current code:

Share on Facebook Share on Twitter


  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Re: Setting up MQTT on pi and gateway
« Reply #1 on: June 30, 2017, 10:00:01 am »
I don't know anybody that uses a middle man on a pi.

Maybe you should look into moving your data to CloudMQTT (powered by AWS) and move it from there.


  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
  • mc-Things! The opportunities are endless!
  • Location: Canada
    • View Profile
Re: Setting up MQTT on pi and gateway
« Reply #2 on: July 04, 2017, 02:00:15 pm »
There were a couple of users that were discussing using Pi's as middle men - not sure the status of this.

Anyone out there that has done this that can help Bernstein?

As mcJohn mentioned, you can also forward the information to a service like CloudMQTT as an option. They do have a free tier and there are other ones out there as well. To help, you can check out this video that walks-through setting up CloudMQTT as a service. On this video we subscribe to the topic on an Android phone to view the data so not quite what you are looking to do but hopefully it helps a bit (CloudMQTT stuff starts around the 0:50 mark)
Need more mc-Modules, mc-Gateways or other mc-Things? Check out our product page: mc-Development kits are available too!
Check out a live Dashboard using mcThings and Losant! Click here:


  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: Setting up MQTT on pi and gateway
« Reply #3 on: July 08, 2017, 01:55:29 pm »
I'm using a pi to rebuild my temp capture platform, IFTTT just plain quit after the mc upgrades. Other than my issues posted elsewhere here, I am sending 'JSON" equivalent 'ListOfByte' successfully to my pi.

My plan is to use python libraries to captures the subscriptions and push them into PostgreSQL. It's all on my pi with a 128GB SSD. You might consider a middleman to push the data directly to a cloud hosted DB VS a cloud MQTT host and then to a DB.