This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Easiest way to subscribe to MQTT messages from Thingy91 on the nRF Cloud

Hi,

What's the easiest way to subscribe to the MQTT messages that the thingy91 sends to the nRF cloud?

I have tried setting it up with a node-red and a python client, but I'm never able to connect to the MQTT broker that is set up in the nRF cloud. I want to find out the easiest way to subscribe to these messages so that I can present them in a web application like node-red or similar.

The documentation that is found under APIs doesn't seem to help me, as I'm unable to connect to the broker. As I can see the data being sent to the nRF cloud, I figured it wouldn't be too difficult to just parse that data somewhere else.

Thanks

Best regards

Joakim Uddenfeldt

  • Hello Joakim, 
     

    The documentation that is found under APIs doesn't seem to help me, as I'm unable to connect to the broker.

    I assume you mean nRF Cloud API documentation, specifically the MQTT chapter?

    Can you share how you are trying to connect?

    Kind regards,
    Øyvind

  • Hi Øyvind,

    Here is what I have done:

    I start by downloading and installing new certificates on my Thingy using these instructions:

    https://devzone.nordicsemi.com/nordic/cellular-iot-guides/b/getting-started-cellular/posts/nrf-cloud-certificate-update

    After that, I register my Thingy to my nRF account using the GUI on the nRF Cloud website

    I then use the swagger gui to download the MQTT information, such as endpoint and topics using the following curl command

    curl -X GET "">api.nrfcloud.com/.../account" -H "accept: application/json" -H "Authorization: Bearer

    With the following python code, I try to subscribe to the messages that my thingy sends (which I can see in the nRF cloud GUI

    However, i'm never able to connect successfully? I have tried the same with node-red, but i'm unable to connect using that as well.

    Do you have any idea what I might be doing incorrectly? 

    Best regards

    Joakim Uddenfeldt

  • Hi Joakim,

    Have you tried using Mosquitto to confirm the connection?  What is the Client ID you are using to connect?

    -Øyvind

  • Hi Øyvind, 

    I haven't tried Mosquitto yet, but will do that. My client ID is the following: prod-7215a082-a8f3-4507-a03d-a7e2e0d55387-account

    Thanks

    Best regards

    Joakim Uddenfeldt

  • Hi Joakim, 

    So I tried using Mosquitto to subscribe to my Thingy:91 using: 

    This outputs: 

    Where did you get the certificates from? Did you use the following command from the MQTT API?

    Which will output:

    Or did you download from your nRF Cloud Account? See image below, which downloads a .json file to import to LTE Link Monitor - Certificate Manager

    Kind regards,

    Øyvind

1 2 3