Author Topic: Trouble sending/receiving data to CloudMQTT  (Read 177 times)

babramovitch

  • Newbie
  • *
  • Posts: 9
    • View Profile
Trouble sending/receiving data to CloudMQTT
« on: October 02, 2017, 08:59:29 pm »
I'm having problems sending/reading data to/from cloudMQTT.

I watched the below video but the gateway UI is different now, so I'm not sure if I'm doing something wrong with all the latest changes, or doing something else that's wrong. 

https://www.youtube.com/watch?v=WfkQmg5P-3k

Specifically the YouTube video doesn't have client id, or WiFi settings but from what I can gather the client id is anything I want thats unique? I've tried with/without WiFi settings as well with no luck. If I'm already connected to the WiFi, are the settings required? I'm assuming that's if I want MQTT to transmit over a different network?

In the Android app, I can connect, and I subscribe but receive nothing. I've tried subscribing to mcThings/#, as well as mcThings, mcThings/, mcThings/*, #, *

I've attached all my settings.

I tried the MotionSensor app and the MQTT portion wasn't working, so to simplify things I'm trying the below right now.

Class Blinky
    Shared Event GreenLed() RaiseEvent Every 2000 milliSeconds       
        Dim payload As ListOfByte = New ListOfByte
        Dim payString As String = ""
       
        payString = "test payload"
       
        LedGreen = Not LedGreen         
       
        payload.Add(payString)
        Lplan.Publish("mcThings/Testing", payload)       
    End Event 
End Class
« Last Edit: October 02, 2017, 09:19:24 pm by babramovitch »

Social Buttons


mc-T2

  • Administrator
  • Full Member
  • *****
  • Posts: 239
  • mc-Things! The opportunities are endless!
  • Location: Canada
    • View Profile
Re: Trouble sending/receiving data to CloudMQTT
« Reply #1 on: October 03, 2017, 11:24:19 am »
Hi Babramovitch,

Yes, that video was put together using an older version of mcStudio (when the gateway configuration did not include all the features as it does today).

Client ID - You have the same client ID in your gateway settings as you do in your app settings - this could be the problem. They need to be unique (not the same) otherwise they can't 'talk' to eachother. Try changing the client ID either in the gateway config or on the app to something different and try it out.

As for WIFI, You can connect the gateway using WPS or, you can enter the SSID and Password into the gateway configuration (you need to connect the gateway to either WPS or ethernet first to be able enter those details). If you are already connected to WIFI (most likely through WPS), then you don't need to enter the SSID and password info - the gateway will remember the WPS details and continue to connect to that network until you change it

Everything else appears to be good - let us know if changing the client ID allows this to work for you
Thanks!
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

babramovitch

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Trouble sending/receiving data to CloudMQTT
« Reply #2 on: October 03, 2017, 11:54:06 am »
Ah, I thought it meant unique as in not being used by someone else, but used by you everywhere. 

I've changed the client id to be different on the Android device (added a few digits to the end), restarted the app and reconnected in addition to restarting the gateway/module program,  but I'm still not receiving anything after 10 minutes.

mc-T2

  • Administrator
  • Full Member
  • *****
  • Posts: 239
  • mc-Things! The opportunities are endless!
  • Location: Canada
    • View Profile
Re: Trouble sending/receiving data to CloudMQTT
« Reply #3 on: October 03, 2017, 12:12:42 pm »
Can you try leaving the client ID blank within the gateway configuration and also, subscribe to the exact topic (mcThings/Testing) in the application and see if that works.

As you can see from the video, this does work!  :) just need to figure out where this is going wrong for you
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

babramovitch

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Trouble sending/receiving data to CloudMQTT
« Reply #4 on: October 03, 2017, 12:49:45 pm »
Still no luck =(

I removed the client id from the gateway configuration, and added a sub to mcThings/Testing in the Android app. 

I also tried rebooting the CloudMQTT server, this is the startup details that appear under the server log

Quote
1507051319: mosquitto version 1.4.10 terminating
1507051319: mosquitto version 1.4.10 (build date Thu, 25 Aug 2016 15:32:03 +0100) starting
1507051319: Config loaded from /var/lib/mosquitto/10933/mosquitto.conf.
1507051319: Opening ipv4 listen socket on port 20933.
1507051319: Opening websockets listen socket on port 30933.
1507051319: Opening ipv4 listen socket on port 10933.
1507051406: New connection from my.phones.ip.address on port 10933.

I can see my phone connecting in the server logs, but I don't my computer (mcGateway) connect. 


mc-Abe

  • Full Member
  • ***
  • Posts: 167
    • View Profile
    • mc-Things
Re: Trouble sending/receiving data to CloudMQTT
« Reply #5 on: October 04, 2017, 11:48:20 am »
The fact that you don't see the mcGateway110 connecting to your broker in the logs makes me think that it cannot resolve the MQTT broker hostname to an IP address. Due to some hardware limitation, the mcGateway110 uses the default gateway as the DNS server which might not always be the case. Can you verify that your default gateway is indeed your DNS server and if not please enter the IP address of the DNS server in the gateway configuration.

Alternatively you could just enter the IP address of your broker for a quick and dirty test. Note that this is not recommended as the IP address might change without your knowledge.

And as always make sure you have all the latest versions released as we will be fixing problems as we find them.

Hopefully this helps with your problem.

babramovitch

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Trouble sending/receiving data to CloudMQTT
« Reply #6 on: October 04, 2017, 05:15:49 pm »
I was able to get it to work by typing in the IP address of the cloudmqtt server and power cycling the unit.

I then manually inputted my DNS server as suggested and power cycled it, and now the gateway will no longer connect in mcStudio. 

It can see it in the device list, but pressing the connect button does nothing. It just clicks, no thinking or anything.

I've tried uninstalling studio, including deleting the mcThings folder, rebooting the computer, as well as holding the reset button on the gateway, and it still won't connect.

It looks like somehow entering the DNS IP address has broken my ability to connect, and I can't figure out how to reset it.  I can no longer do anything with the modules.

Note - The gateway is on the most recent software versions


« Last Edit: October 04, 2017, 05:24:38 pm by babramovitch »

babramovitch

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Trouble sending/receiving data to CloudMQTT
« Reply #7 on: October 04, 2017, 05:45:06 pm »
Hooking it up to Ethernet let me connect properly, and I was able to delete the info, and then connect properly over wifi.

Not sure what happened there... but it's now working with the DNS added, and using the m10.cloudmqtt.com

mcThings

  • We Connect Things To The Internet... That Can't Be Plugged In.
  • Administrator
  • Jr. Member
  • *****
  • Posts: 68
    • View Profile
    • www.mcthings.com
Re: Trouble sending/receiving data to CloudMQTT
« Reply #8 on: October 11, 2017, 09:33:36 am »
Glad to hear you've got it working @babramovitch. Thanks for following up!