Problem with sending downlink via MQTT


#1

Hello,

I have loraserver up an running (GW bridge, loraserver and lora appserver on one physical host). I can see Uplink and downlink in appserver GUI - all looks working fine.

I need to send downlink manually via mosquitto_pub command.
I found several threads already on similar topics, but I think my issue is simpler, I’m missing something.

https://forum.loraserver.io/t/sending-data-to-lora-node-with-mqtt/1196/9
https://github.com/brocaar/lora-app-server/issues/73.

I am publishing as:

mosquitto_pub -t “application/1/#” -m “hello world” -u {loraserver mqtt username} -P {loraserver mqtt pwd}

also tried particular node:

mosquitto_pub -t “application/1/device/333934376c356214/tx” -u {loraserver mqtt username} -P {loraserver mqtt pwd}

publish output:

Client mosqpub/25000-vps590769 sending CONNECT
Client mosqpub/25000-vps590769 received CONNACK
Client mosqpub/25000-vps590769 sending PUBLISH (d0, q0, r1, m1, ‘application/1/device/333934376c356214/tx’, … (2 bytes))
Client mosqpub/25000-vps590769 sending DISCONNECT

and then listening on:

mosquitto_sub -v -t “application/+/device/+/+” -u {loraserver mqtt username} -P {loraserver mqtt pwd} --debug

subscribe output below, but nothing else.

Client mosqsub/29322-vps590769 sending CONNECT
Client mosqsub/29322-vps590769 received CONNACK
Client mosqsub/29322-vps590769 sending SUBSCRIBE (Mid: 1, Topic: application/1/#, QoS: 0)
Client mosqsub/29322-vps590769 received SUBACK

I’m watching the journalctl in paralel for Bridge, loraserver and lora app server, but all I see is the normal messages sent by the node uplink/downlink.

mosquitto client seems to work fine also, as I can subscribe for the gateway topics and I can see the packets arriving from the node.

mosquitto_sub -t “gateway/#” -v -u {loraserver mqtt username} -P {loraserver mqtt pwd}

I would appreciate if anyone can point at the problem, I can send the logs is necessary.

thanks in advance,
Sergi


Downlink with MQTT
Downlinks using MQTT
#2

Gents, no one? I would appreciate some hints


#3

Are you subscribing prior to publishing? Your message says “and then”, which implies you publish and then connect to subscribe.


#4

Thanks bconway,
No, actually I am subscribing first and then trying publishing…


#5

Hi Guys,

I’m sorry i am limited to send you an unique picture but i would like to explain my problem as best possible. You can click and zoom the picture.

Capture7

Thanks for you help

Adrien


#6

When i try with the following file :

Capture8

I get the frame in the Live Device Data Topic but it’s an error.

I get the error : “value must be an array”

There is the same error indicated in the lora-app-server logs.

My JSON File seems OK so is there any bug in parsing Json Data into lora-app-server application ?

I have the 2.6.0 version.

Thank you guys.


Downlink problems
#7

Example:

mosquitto_pub -t "application/1/device/0101010101010101/tx" -f /tmp/test.json

The content of /tmp/test.json is:

{
    "confirmed": true,
    "fPort": 10,
    "data": "AQID"
}

(AQID == 010203 in HEX encoding).


#8

Hi Brocaar,

Thank’s for your help !

I tried your json example but i always receive no data on my RN2483.
All my settings for RX1 and RX2 seems to be good.
I receive an ack packet on the live device data view from my RN2483 :


I begin to suspect my gateway, which is a Dragino LG01 with only 1 channel. It can work with this hardware (LG01)? On my RN2483, i set only one channel 861000000 which is the used by LG01, the uplinks are ok.

Thank’s


#9

I don’t have experience with single-channel gateways, but I know many people run into issues with these kind of gateways. Why not buy one of the available SX1301 based Raspberry Pi shields? That might save yourself some trouble :slight_smile:


#10

Thanks for the example brocaar. My gateway is not with me at the moment, will try that soon


#11

a quick test meanwhile:

running below on loraserver. subscribing to application topic (tried also particular application/node like "
“application/1/device/0101010101010101/tx”). subscribed ok:

root@vps:~# mosquitto_sub -t “application” -v -u “loraserver_as” -P “********” --debug
Client mosqsub/31026-vps590769 sending CONNECT
Client mosqsub/31026-vps590769 received CONNACK
Client mosqsub/31026-vps590769 sending SUBSCRIBE (Mid: 1, Topic: application, QoS: 0)
Client mosqsub/31026-vps590769 received SUBACK
Subscribed (mid: 1): 0
Client mosqsub/31026-vps590769 sending PINGREQ
Client mosqsub/31026-vps590769 received PINGRESP

Then publishing on same level. contents of mqtt file is same as in your previous post. Do not see any warnings while publishing. But I don’t get anything in subscription (separate terminal window)

root@vps:/home/lora# mosquitto_pub -t “application” -f mqtt.json -u “loraserver_as” -P “********” --debug
Client mosqpub/31027-vps590769 sending CONNECT
Client mosqpub/31027-vps590769 received CONNACK
Client mosqpub/31027-vps590769 sending PUBLISH (d0, q0, r0, m1, ‘application’, … (66 bytes))
Client mosqpub/31027-vps590769 sending DISCONNECT

thanks


#13

Hello everyone,

Short update on my initial topic, I did a clean install of all Lora modules from scratch and now it is working fine.

I am publishing a json file (mentioned in this thread earlier, thx for the example btw) to application topic. content of the file are:

{
"confirmed": true,
"fPort": 10,
"data": "AQID"
}

Publish command

lora@vps:~$ mosquitto_pub -t “application” -f mqtt.json --debug
Client mosqpub/18036-vps sending CONNECT
Client mosqpub/18036-vps received CONNACK
Client mosqpub/18036-vps sending PUBLISH (d0, q0, r0, m1, ‘application’, … (66 bytes))
Client mosqpub/18036-vps sending DISCONNECT
lora@vps:~$

Topic subscription.

Lora@vps:~$ mosquitto_sub -t “application” -v --debug
Client mosqsub/18028-vps sending CONNECT
Client mosqsub/18028-vps received CONNACK
Client mosqsub/18028-vps sending SUBSCRIBE (Mid: 1, Topic: application, QoS: 0)
Client mosqsub/18028-vps received SUBACK
Subscribed (mid: 1): 0
Client mosqsub/18028-vps received PUBLISH (d0, q0, r0, m0, ‘application’, … (66 bytes))
application {
"confirmed": true,
"fPort": 10,
"data": "AQID"
}
Client mosqsub/18028-vps sending PINGREQ
Client mosqsub/18028-vps received PINGRESP

Looks there was something brokeნ during my config tuning.
thanks all for your responses.


#15

Hi everyone
I am trying to send downlinks to a class C node. Are there other fields needed in the json file to do this?
Thanks


#16

No, you are “just” scheduling a downlink. It is up to LoRa Server to decide if Class-A / B or C is used for the actual transmission.