Receiving (decrypted) device data / FRMPayload

Hello again!

Hope everyone is ok.

I configured the lora server and logged-in the API by localhost. I wait for a mbus device to make my first test.

I would like to know,if the usage of API (in the browser) creates a new connection with a gateway and m-bus devices, and if i will be able to read a value or a telegram by the m-bus device.

I mean that,after the connection i will receive a value (13 Celcius degrees for a temperature device, for example) or a telegram packet which i have to make a new API (in Java for example) to decode it, in a number (integer or float)?

Excuse me, but i don’t have in my mind the exactly usage of the API.

Thanks in advance,
Nikos.

To receive data, you need to subscribe to the MQTT, see: https://docs.loraserver.io/lora-app-server/integrate/data/.

An other option is to setup a HTTP integration (this is a per application setting). In this case LoRa App Server will make a POST request to an endpoint that you have configured. The JSON payload is exactly the same as the JSON over MQTT payload. For integrations, see: https://docs.loraserver.io/lora-app-server/integrate/integrations/

1 Like

Thanks for the reply @brocaar!

As i understand, using the API in browser i can just establish the connection and take raw data right?

To decode this raw data in understandable (received) format data i have to use the subscription on the MQTT, as the doc refers to?

1 Like

Hey Orne!
My question concerns docker image of the server. I try to subscribe my mqtt client to the semtech-mote application which is a part of default installation. Tell me please some details about this application: what is the port for mqtt if it is a mqtt server, which topics it uses…or maybe it’s a ws related app.

Need more details about the instalation. But for MQTT integration you must read this:

https://docs.loraserver.io/lora-app-server/integrate/data/

Mosquitto does not have websocket active by default

If you are using docker you should see something like this executing $ docker ps:

1 Like

Hey! Thanks for info but I need something different. Trying to say that docker image of the server (compact edition, not this one that you have pointed on the screen) has 1 builtin application for Handlers. It is called semtech-mote. So I just want to know how this application works.

That doesn’t look like the LoRa (App) Server interface, so I’m not sure if you’re asking your question at the right place.

@lance Probably you should contact Petr Gotthard at https://github.com/gotthardp/lorawan-server , because this is the image of his loraserver software…

LOL! Guess what? I thought that Orne and Peter is the same man with the same server but one of the releases is for full installations and the other is for lightweight.)))))) My baaaaaad guys, sorry…

Hello.
I installed the server, app-server and so on and subscribed to MQTT with Node.red. I can see all fields but “data” field is encrypted, like this:

{“applicationID”:“1”,“applicationName”:“test_ds18b20”,“deviceName”:“arduino_uno”,“devEUI”:“1234567890123456”,“rxInfo”:[{“mac”:“aa755a0048050130”,“rssi”:-57,“loRaSNR”:10,“name”:“raspberry_pi”,“latitude”:48.466860686785175,“longitude”:1.019478797912605,“altitude”:0}],“txInfo”:{“frequency”:868100000,“dataRate”:{“modulation”:“LORA”,“bandwidth”:125,“spreadFactor”:7},“adr”:true,“codeRate”:“4/5”},“fCnt”:9,“fPort”:1,“data”:“Z29vZGJ5ZQ==”,“object”:{}}

I cant decrypt this on Node.red side.
On app-server i found this setting “Payload codec”.
and it gives me some choices: Caayenne LPP - didnt work and gives me same encrypted data, and Custom JavaScript codec functions:


but i dont know what i must change on this function. Should i paste here my fPort number? If yes what about bytes, where i must get it?

Basically i want to recieve in node.red something like this (data with object):
…
“fCnt”: 10, // frame-counter
“fPort”: 5, // FPort
“data”: “…”, // base64 encoded payload (decrypted)
“object”: { // decoded object (when application coded has been configured)
“temperatureSensor”: {“1”: 25},
“humiditySensor”: {“1”: 32}
}
}
as mentioned here - https://docs.loraserver.io/lora-app-server/integrate/data/
Also i saw this - lorawan package - github.com/brocaar/lorawan - Go Packages but i dont know what to do exactley, should i just paste code from this link to Custom JavaScript codec functions in app-server or what?
Can @brocaar please guide me how to do this and if possible with some examples
Thanks alot

As node im using arduino uno+dragino shield (RFM95) http://wiki.dragino.com/index.php?title=Lora_Shield with LMIC library for LoRaWAN.
As gateway im using raspberry pi+sx1301 with semteh packet_forwarder.

Please note that the data is not encrypted but base64 encoded. As the payload is basically an array of bytes, you either make sure that on the device you encode the data using the Cayenne LPP encoding, or you need to define your own decoder function to decode your data from an array of bytes to a JSON object.

Hi @trt_rtrt,

For just an example, I am sending an Hex payload over the node. So at mosquitto subscribing I will receive encode in base 64. So I used some libraries that take the data, decode64 and encode16. That returns my original data sent by node.

Which library did you use?

Hi @trt_rtrt!

For each application you can use owns called encripted/decrypted libraries.

For example if use Node-RED you can install encrypt library search n the Manage Palletes

Thanks for answering!

1 Like

Since LoRa App Server 0.19.0 you will also be able to see the live event logs for a given device. This will show the join, ack, error and uplink events and contain exactly the same data as the MQTT of HTTP integration messages. This is for debugging only, and is not a replacement for building integrations.

https://forum.loraserver.io/t/release-lora-app-server-0-19-0/1089

FYI, I am not seeing the downlink messages in the Live Event Log. I see the ack from a confirmed downlink, but not the downlink itself.

you can use this:

credits to @RussNelson

i’m try to send data from node to server, now it success but i can’t decode payloads. i’m not understand data format. someone explain for me.

note: i used to send this data to ttn then i’m modify that code for send to loraserver, in ttn payloads are hex ascii format it easy to decode.
.
.
.
this is data format that i can see

please help me !!!