Has anybody been able to use MQTT library with Argon?

Hello, I have been trying to publish some messages to my MQTT broker which is running in the same network as the Argon. However, when I flash the sample MQTT example (modified with my ip address), the Argon flashes green for a few seconds and then it just goes black. No lights or flashing at all.

Any help getting MQTT running on any of the mesh devices will be greatly appreciated.

1 Like

I have not, but you could try flashing the test client that I posted recently to the Argon. You don't need to make any changes to the code. Just flash and go to the Particle Console where you can enter the broker's IP address (or DNS name), a topic and message to publish and/or a topic to subscribe to.

1 Like

By any chance have you tried this on the Argon or a Xenon?

I will give it a try anyways.

Thanks

No, but I would expect it to work. Let me know if you have any issues … I also need to get MQTT running on my Argons and Xenons

@Bear I tried the sample code (edited with the ip of my mqtt broker) that comes with the MQTT library and nothing is being published.

I have had many things working on the photon that don’t work on the Argon or Xenon.

Please give it a try and let me know if that works for you.

Thanks

I flashed it to my Argon, and it worked just fine …
To test, I opened a terminal on a Linux machine and typed “mosquitto_sub -t test-topic” to subscribe to “test-topic”

  • in SetBrokerIP: I entered my broker’s IP address, and clicked CALL
  • In SetPubTopic: I entered “test-topic” (without the quotes), and I clicked CALL
  • In Retain?: I entered F and clicked CALL
  • In Publish-Msg: I entered some text and clicked CALL and the text appeared in the Linux terminal.

To test the other way …

  • In Subscribe: I entered “another-topic” (without the quotes) and clicked CALL
  • I then opened a second Linux terminal and typed “mosquitto_pub -t another-topic -m another-message”
  • In GetMessage, I clicked GET, and “another-message” was displayed

@Bear, you are absolutely right!! I just tested your code and works fine. However, when I tried the sample code that comes with the MQTT library it does not work. I looked at the code and looks very similar to yours… I will review to make sure what is missing in the sample from the library. Thanks

@Bear Never mind. The sample from MQTT is also working. I removed the calls to RGB and everything worked fine.
Thanks a lot for your help.