Interroge le loraserver en python

Avec mqtt client

Télécharger l'archive, décompresser, exécuter python3 test2.py

La commande python3 test2.py retourne :

Sending CONNECT (u0, p0, wr0, wq0, wf0, c1, k60) client_id=b''

Sending SUBSCRIBE (d0) [(b'application/3/node/0102030405060708/rx', 0)]

Received CONNACK (0, 0)

rc: 0

Received SUBACK

Subscribed: 1 (0,)

Received PUBLISH (d0, q0, r0, m0), 'application/3/node/0102030405060708/rx', ... (316 bytes)

application/3/node/0102030405060708/rx 0 b'{"applicationID":"3","applicationName":"Test-de-Mesures","deviceName":"TestBureau","devEUI":"0102030405060708","txInfo":{"frequency":868100000,"dataRate":{"modulation":"LORA","bandwidth":125,"spreadFactor":7},"adr":true,"codeRate":"4/5"},"fCnt":45,"fPort":1,"data":"VGVtcDogMjUuOTAqQwpQcmVzc3VyZTogMTAwMS43MGhQYQ=="}'

Sending PINGREQ

Received PINGRESP

On peut ensuite lire la donnée :

echo "VGVtcDogMjUuODAqQwpQcmVzc3VyZTogMTAwMS4zOWhQYQ==" | base64 -d

Temp: 25.80*C