Hi everyone,
I publish here because i see there are more active discussion around MQTT .
I’m working with:
chirpstack-application-server version : 3.10.0
chirpstack-network-server version : 3.9.0
chirpstack-gateway-bridge version : 3.8.0
All on a rpi with raspbian buster…
The problem is when i subscribe to my application topic events i receive the “objectJSON” as a string format (double quoted and unescaped ) like if its stringify twice during the transport…
If i do this command on the gateway:
mosquitto_sub -t "application/3/#" -v
application/3/device/12345678910/rx {"applicationID":"3","applicationName":"sondehumtemp","deviceName":"node01","devEUI":"123456789=",
"rxInfo":[{"gatewayID":"3KY123456=","time":"2020-05-09T09:15:24.313107Z","timeSinceGPSEpoch":"1273050941.313s","rssi":-53,"loRaSNR":8,"channel":2,"rfChain":1,"board":0,"antenna":0,"location":{"latitude":0,"longitude":0,"altitude":0,"source":"UNKNOWN","accuracy":0},"fineTimestampType":"NONE","context":"d+GjNA==","uplinkID":"qZLyA4YOTOG6zkNcAp6kBw==","crcStatus":"CRC_OK"}],
"txInfo":{"frequency":868500000,"modulation":"LORA","loRaModulationInfo":{"bandwidth":125,"spreadingFactor":12,"codeRate":"4/5","polarizationInversion":false}},
"adr":true,
"dr":0,
"fCnt":1221,
"fPort":8,
"data":"CAIBbgdoawZzJbcCZwCvBAIDvQ==",
"objectJSON":"{\"barometer\":965.5,\"battery\":3.66,\"gasResistance\":9.57,\"humidity\":53.5,\"temperature\":17.5}","tags":{}}
The induce problem is i cant do JSON.parse(myMQTTmessage).
error unexpected token at position...
I use this script for decode payload data, that you can found here: (i have just remove all the unit for a simpler integration…)
Just to add : i have integrate this “data events” into a postgres data base … all look very good , I could “query” without problems differents elements of the objectJSON
.
i have ask on the RAK forum if they have the same problem … they answer that with the same script but an old version of chirpstack the result is different (in their case no problems).
Thanks for the help.