Help decoding json format

Hi, i would like some help with decoding a sensor i got.
Mosquitto broker recieve:
{“applicationID”:“6”,“applicationName”:“Elvaco-Tempsensors”,“deviceName”:“Elvaco1”,“devEUI”:“94193a010600040c”,“txInfo”:{“frequency”:868100000,“dr”:0},“adr”:true,“fCnt”:29,“fPort”:2,“data”:“AnsiVCI6MjQuMTcsIkgiOjM4fQ==”}

Device data:

adr:true
applicationID:“6”
applicationName:“Elvaco-Tempsensors”
data:“AnsiVCI6MjQuMTcsIkgiOjM4fQ==”
devEUI:“94193a010600040c”
deviceName:“Elvaco1”
fCnt:28
fPort:2
dr:0
frequency:868500000

the node is a https://www.elvaco.se/en/product/sensors1/cma11l-indoor-sensor-for-temperaturehumidity-lorawan--1050140

it’s sending in message format json in plain text.

I’ve been reading the forum and the loraserver.io how to on decoding but i’m still at zero, any help would be greatly appreciated.

I can paste the lora frame raw information if needed.

You need to base64 decode the data field (beware if you try to copy it from this posting it has been munged with pretty alternate quotes, you will have to substitute true ascii quotes if using a command which needs it quoted)

Once decoded you will find the contents are:

{“T”:24.17,“H”:38}

Which seems self-explanatory, apart from being a horribly inefficient way to encode information. Given LoRaWAN’s low bandwidth in longer range situations (your packet report shows the slowest DR0 was used!), a more efficient binary encoding really should be used.

1 Like

Thanks, figured it had something to do with base64.

So, the smaller the message = longer range?

No, but longer range messages need to have small packets, otherwise they take absurdly long on the air - which is any of impolite, an increase in the risk of suffering interference, or in same places outright illegal. Because LoRaWAN has fairly long, fixed-size headers, at the slower data rates just the header can end up consuming most of a reasonable packet duration, leaving only a few bytes (if any) for application data.

Your sensor took something like 18 bytes, to send only 3-4 bytes worth of information.

Allright, i changed my nodes to the standard format but that one doesnt’ seem to use base64 or hex, i should be getting bytes but i get “AAJlkAkB+xsq”, so i guess that needs to be decoded and then i will get bytes that needs to be translated into the proper message i can read?

That’s clearly base64, why do you say it isn’t?

As for the payload contents:

00 02 65 90 09 01 fb 1b 2a

you’ll have to check the node documentation or source code.

Yes it is, i used the wrong base64 decoder.

So i need to convert the base64 to hex to dec, i’m not a coder, could you point me in the right directions on how that java code would look like?

When i use https://www.scadacore.com/tools/programming-calculators/online-hex-converter/
i can decode the hex into binary, and when i decode binary to decimal i think i get the correct value, but how do i translate this into javascript code?

https://imgur.com/a/2nSOgOi that is the node message format.