Forming downlink packet to LoRa node


#1

Hello!
I was trying to figure out how to send a packet to LoRa node with random payload but got messed. :frowning: Say, what do I need to look for? I already have installed lora-server, lora-app-server, lora-dateway. Everything works fine, I was able to connect my GW to the server and receive some data from my node. But now I want to try to send some data to Class C device that I got on my table…
I’ve learned that it’s possible using API methonds but I’m new at this question so will be very thankful if you guide me a little…


#2

You could use the MQTT topic of your node for sending downlink data. See also: https://docs.loraserver.io/lora-app-server/integrate/data/.


#3

Thank you, Orne! I will try and will share my experience during this week.


#4

Okay, now I understand how to use pub and sub topics for any application and gateways. I can inject any data to desired topic and debug output from it. Right. But still my node doesn’t want to pull any data from the related tx topic.(( I got a suspicion that I need to send data to the gw or a specific topic which represents something like ‘scheduler’ for all devices…


#5

Your (Class-A) node needs to send an uplink in order to be able to receive a downlink. In practice: LoRa Server will check the downlink queue on receiving an uplink and then schedule a downlink transmission.


#6

Okay, I’m understanding that. So, in other words all I need is to inject a message to related topic and simply wait for next node’s transmission? Then it will pull injected message from broker during it’s RX1 (or 2) window…Right/ Okay, in that case what is the name of the topic it should be? /application/ID/nodes/NodeID/tx?


#7


#8


maybe you shoule read carefully


#9

Probably you did not understand my question…Thanks for the screen but exactly this is what I meant - the topic name. In my case it looks like application/10/node/0000000000000001/tx, it doesn’t matter what kind of info I send: already tried the dictionary in example above or to create something by my own.

Oct 11 11:56:25 mintvm lora-app-server[1735]: time=“2017-10-11T11:56:25+03:00” level=info msg=“handler/mqtt: data-down payload received” topic="application/10/node/0000000000000001/tx"
Oct 11 11:56:25 mintvm lora-app-server[1735]: time=“2017-10-11T11:56:25+03:00” level=error msg=“handler/mqtt: tx payload unmarshal error: illegal base64 data at input byte 5” data_base64=eyJkYXRhIjoiSGVsbG8sIE1pa2hhbHljaCEiLCJwb3J0IjoxLCJjb25maXJtZWQiOnRydWUsInRpbWUiOiJpbW1lZGlhdGVseSJ9

This is what happens right now when I try to inject something to topic. The problem is that my node do not pull anything from related tx topic)) Already tried to send a packet both on Class A and Class C devices…


#10

Here is the part of the log when the node transmit something and network server tries to access tx topic…

Oct 11 14:11:05 mintvm lora-app-server[1735]: time=“2017-10-11T14:11:05+03:00” level=info msg=“handler/mqtt: publishing data-up payload” topic="application/10/node/0000000000000001/rx"
Oct 11 14:11:05 mintvm lora-app-server[1735]: time=“2017-10-11T14:11:05+03:00” level=info msg=“data-down item requested by network-server, but queue is empty” dev_eui=0000000000000001

It’s saying that queue is empty…


#11

Please note the error:

Oct 11 11:56:25 mintvm lora-app-server[1735]: time=“2017-10-11T11:56:25+03:00” level=error msg=“handler/mqtt: tx payload unmarshal error: illegal base64 data at input byte 5” data_base64=eyJkYXRhIjoiSGVsbG8sIE1pa2hhbHljaCEiLCJwb3J0IjoxLCJjb25maXJtZWQiOnRydWUsInRpbWUiOiJpbW1lZGlhdGVseSJ9

Decoded, I see you’re sending:

{“data”:“Hello, Mikhalych!”,“port”:1,“confirmed”:true,“time”:“immediately”}

data must be base64 encoded :slight_smile: Also it doesn’t contain all fields as specified by the documentation.


#12

Thank you, Orne! Now things are getting cleaner for me. It seems that everything works now. I’ve edited the dictionary (massive) and placed the data encoded by base64. Now I need to catch this data at the node side somehow…Using lmic lib and dragino lora shield. The things is that the library is written only for sending data…:frowning:


#13

@lance Could you figure out about how to recieve this message on node ? Which Library to use ?
I am using Class C enabled Dorji Module with atmega328 but not yet able to catch these messages. It’ll be very helpful if u can tell how u got it done…


#14

Is there any way to configure in the lora_server itself to schedule data downlink to a node. I mean I need to send a data from node a to node b through gateway. Can I configure at caynee LLP or some javascript function to do this.


#15

No, this is not possible and must be done by an external application. CayenneLPP (and the custom JS functions) is only there to encode / decode the data. It does not interact with the API.