Sending data to lora node with mqtt


#4

Under Live LoRaWAN frame logs PANEL … can you see the downlink frame… under RX/TX parameters ???
… and what keys do you see under downlink>txInfo ???


#5

no packet receive at all at the panel of live lorawan frame logs of the device

only uplink packets are shown at the panel of the live lorawan frame log of the gateway


#6

Question #1: Can I assume the gateway has transmitted the message i generated when I see the following mqtt message published by the gateway?

application/2/node/0004a30b001b5bd8/tx {"reference":"abcdxx1234","confirmed":true,"fPort":1,"data":"SGVsbG8="}
gateway/b827ebfffe958375/tx {"token":46475,"txInfo":{"mac":"b827ebfffe958375","immediately":false,"timestamp":2458150251,"frequency":922900000,"power":23,"dataRate":{"modulation":"LORA","spreadFactor":7,"bandwidth":125},"codeRate":"4/5","iPol":null,"board":0,"antenna":0},"phyPayload":"oNcZdQeClQEIAQHJi3cD5g8pqkU="}

Question #2: Can I considered the lora node acknowledge the receive of the message transmitted by the gateway with the following mqtt message published?

application/2/node/0004a30b001b5bd8/ack {"applicationID":"2","applicationName":"streetlight","deviceName":"sl_100","devEUI":"0004a30b001b5bd8","reference":"abcdxx1234","acknowledged":false,"fCnt":405}


#7

Question #1: Can I assume the gateway has transmitted the message i generated when I see the following mqtt message published by the gateway?

No, it only indicates that the message was sent to the gateway, not by the gateway. When using the latest packet-forwarder, you will see an gateway/b827ebfffe958375/ack message, this indicates that the message was acknowledged for transmission (which could be in the future).

Question #2: Can I considered the lora node acknowledge the receive of the message transmitted by the gateway with the following mqtt message published?

When you receive a message on application/2/node/0004a30b001b5bd8/ack it means a confirmed downlink message was acknowledged (edit) by the device.


#8

the downlink message was acknowledged by the lora node?


#9

…if it can help…

You could open 4 terminals session…and execute these commands to see your Downlink TX live…

  1. journalctl -u loraserver -f
  2. journalctl -u lora-app-server -f
  3. journalctl -f -n 100 -u lora-gateway-bridge -f
  4. mosquitto_sub -v -t “gateway/+/tx” -u {user} -P {pasword} -h localhost -p 1883
  5. click on your nodered to execute the flow
  6. …fun begin…gather all informations and/or error messages in each terminal

you could also try to get all these info from LOGS… but this is another story…


Problem with sending downlink via MQTT
#10

Hi guys,

I am currently testing some devices on our LoraServer setup. More specifically, I am testing an pulse meter by SensingLabs. The device is working just fine and I can successfully receive messages from it. However I need to reset to 0 the current index of the device and, in order to do so, I have to send a downlink with the following bytes to reset it.

020400000000

Based on what I have read, in order to send this to the device I have to encode it in base64 (AgQAAAAA) and send it via an MQTT client right?

So, I am using MQTT.fx and an I am trying to publish que following message:

{
“reference”: “reset”,
“confirmed”: true,
“fPort”: 2,
“data”: “AgQAAAAA”
}

I checked the users guide of the device and the fPort to downlink is “2" and I have tried both confirmed and unconfirmed downlinks. I can’t even see the downlinks in the frame logs and I am supposed to receive an uplink confirming the reset. Also tried to enable Class-B and Class-C options on device profiles.

Any suggestions?


#11

Hi Kim_Chuan_Lim,
I am trying to create a similar application ( node.js mqtt client application) , hiwerver i have to been facing a lot of problem connecting to the mqtt server. I found out that is was not possible to connect to the mqtt server directly from browser. I would like to know how u solved the problem. DId you create another socket connection to mqtt that servery your application ?


#12

first, make sure your nodejs mqtt client has no problem to subscribe to any topic published by loraserver or lora-app-server before you test the mqtt publish?

i’m using https://www.npmjs.com/package/mqtt and running from console (not browser).


#13

I am facing a issue similar to this topic

I able to send downlink data using the api ( device queue) but the same thing is not possible via mqtt
my mqtt topic:
application/1/device/0102030405060708/tx

here i can see message received

but in lora-app-server or loraserver log nothing is printed and the message is also not added to queue.


#14

this work for me with nodejs

var mqtt = require(‘mqtt’)
var client = mqtt.connect(‘mqtt://localhost’) //change this to your MQTT broker ip address

var pm = JSON.stringify({
“reference”: “abcd1234”, // reference which will be used on ack or error (this can be a random string)
“confirmed”: true, // whether the payload must be sent as confirmed data down or not
“fPort”: 10, // FPort to use (must be > 0)
“data”: Buffer.from(“Hello”).toString(‘base64’), // base64 encoded data (plaintext, will be encrypted by LoRa Server)
});

client.publish("application/1/device/0102030405060708/tx",pm);

#15

my issue is the I am able to publish the data via mqtt but the lora-app-server logs does not show any thing like mqtt received… the lora-app-server is not responding to any mqtt message with tx
. But it is responding to rx, join, and ack messages.

@brocaar any clue about solving the issue


#16

I able to send downlink data using mqtt. downlink data is coming to live lorawan frame logs, and to my gateway but my mbed Lora node didn’t receive the downlink data.


#17

hi i want to know if you have solved the problem? I want to connect to the mqtt server directly from browser


#18

Hi,
I am getting problem, when I am transmitting downlink from (nodered+MQTT) to the end device is not getting at end device. but when one uplink packet received automatically downlink be received at client(end device). i am not able to find where is the problem?
in my observations

  1. In the automatically send downlink packet phypayload contians ACK: true
    adr:true
    adrAckReq:false
    ack :true
    fPending :false
    classB :false

  2. Downlink packet which is sending by me from nodered + MQTT phypayload contains
    adr:true
    adrAckReq :false
    ack :false
    fPending :false
    classB :false

please suggest me where is the problem(in my Endnode or Server) & tell me answer how can i rectify this problem

Thanks in advance
Regards,
Ashok


#19

Please refer to sending documentation at https://www.loraserver.io/lora-app-server/integrate/data/


#20

Hi Grendy_Eki_Aliandy,
Thanks for your reply,
please tell me where i have to set those payload parameters attached in below screen shot


Thanks in advance.
Regards
Ashok


#21

https://www.loraserver.io/lora-app-server/integrate/data/
is old link
The new link is
https://www.loraserver.io/lora-app-server/integrate/sending-receiving/mqtt/

  • in place of node now device is used in the mqtt topic structure

#22

I got problem like you. now, i still can’t solved it. if you can please tell me please.


#23

issue got resolved after restarting the lora-app-server instance and device re activation