Migration: python paho.mqtt an Node Red

Hi everybody,
Sorry for my poor english, i will try to be understandable !

I’m a teacher in France and i work with young students (15 to 19 years old), i teach mechanics, computerscience and a lot of other things, so i’m not a specialist ! Last year i set up a nice activity for my students. It was simple and was working fine: This activity consisted of publishing some data (like temperature, luminosity …) from a MKR1310 (with Arduino IDE) to the ttn V2 console … and collect these data in 2 ways: python with paho.mqtt and Node-Red to build a nice HMI.

Today, i try to migrate my work to the new ttn V3. I don’t have any problem to publish data on ttn V3 with my MKR1310 … but i can’t collect these data with paho.mqtt and node-red ! I looked for a solution to my problem, but i didn’t succeed yet, so, if anyone can help me he is welcome !

1: paho.mqtt with python
I need three parameters at the beginning of my code:
APPEUI = ‘70B3D5xxxxx14BD4’
APPID = ‘the_name_of_my_app’
PSW = ‘ttn-account-v2.xXxXxXxXxXxXxXxX2xK0isQ6cUSp8’

I thinks it’s ok for the APPEUI en APPID, i’ve find them in the ttn v3 console, but i don’t know how to find the PWD (it’s the ACCESS KEY in ttn v2 console).

2: Node-Red
I think it’s the same problem, i don’t know wich password i have to set in the security panel of the “mqtt-broker node” . Currently, Node-red can’t connect to ttn !

Thanks for your help ! If it’s necessary, i can send you the entire code to help me (python & Node-red).
I keep on searching a solution …

Franck.

Here’s the Python solved for you:

The user name is YOUR_USER_NAME@ttn - example highlighted in blue below.

In v3 the MQTT integration page will show you this and there is a big blue button to generate the API key which is the password.

Screenshot 2021-05-29 at 10.56.07

You should be able to use the same credentials for Node-Red.

2 Likes

Thank you !

@ttn” was missing … i tried it but it wasn’t working either … because my “password” was wrong too !
I had generated a new “API key” but didn’t copy it immediatly. I copied the API key from “Go To API keys” wich is different !

So now i have downloaded the certificate for TLS, and i can see my python app and my Node-red app connecting in the ttn V3 console. I can collect the data from the whole of my application (#) with python and Node-red, and now i will update my code to decode the JSON.

Thank you again for your help.

Franck.

1 Like

That, for anyone else reading along, is the API ID, the one you can use to manage the API Key with using the API for keys …

It is categorically NOT the API Key aka the Password - you get one chance to see / copy that and then, poof, it’s gone in some magic smoke with, presumably, some sort of hash held in the TTS database.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.