LoRa messages to MQTT server

Hello everyone,

I’m pretty new to LoRa and MQTT. I hope I have open the topic in the right section.
I have a Mikrotik Knot LR8 Gateway and 10 lora sensors connected to it. I can see the sensor data on Gateway and TTN without any problem.
What I want to do is to forward LoRa sensors payloads from Gateway to a MQTT server.

Some examples which sensor data is sending to a MQTT server can be found in Mikrotik documentation and on the internet, but they are using Bluetooth sensors.
For this, you need to write a script.

for example:
https://youtu.be/XKbfg-yTt2I
https://help.mikrotik.com/docs/pages/viewpage.action?pageId=63045633

I know I cannot use the same example for my LoRa sensors. Anyone have any ideas how can i do this?

Thanks..

Unfortunately, it is not possible to push LoRa payloads via MQTT.
LoRa payloads can only be sent to LoRa servers.

Any changes after 2 years? :slight_smile:

Check:

The primary design for the MikroTik gateway devices is to operate as LoRaWAN devices. To achieve this, simply configure/select a correct server in the LoRa interface settings. A few examples can be found in the setup section.

However, if you do not wish to use a LoRaWAN network/topology, and you wish to forward “raw LoRa” payloads to your own server, you have an option to do so. You can use MQTT or HTTP post to forward received payloads to your MQTT/HTTP server, but it will require additional scripting. The script will have to collect information (payloads) from the IoT>LoRa>Traffic tab, store those payloads as variables, structure MQTT/HTTP message out of the variables and post it.


A basic example (first step in the script) on how to convert traffic payloads into a varible called “traffic”:

[admin@MikroTik] > :global traffic;:set traffic [/iot lora traffic print as-value ];put $traffic .id=*4f;band=125 kHz;coderate=?/?;counter=890652548;crc=Error;datarate=SF 7;freqhz=868300;gwid=50313xxxxxx;ifcha in=1;mod=LoRa;msgtype=Proprietary;mver=RFU;rfchain=1;rssi=-116.00;rxcrc=3809;size=213;snr=-12.00;snrmax=-8.25;snrmin= -14.25;time=2024-11-08 14:39:45;type=Rx


In other words, you can now “print” the content from the IoT>Traffic tab and store it as “variables”, which you can send via MQTT.

Hi,

I purchased a Knot LR9 and upgraded to firmware v7.12.1. I am trying to convert lora raw data to MQTT messages and am unable to execute the above example script, as the keywork ‘Traffic’ is returning an error ‘bad command name’.

@MikroTik] > :global traffic;:set traffic [/iot lora traffic print as-value ];put $traffic
bad command name traffic (line 1 column 41)

I have been searching hard to find a way to gain access to Lora data for MQTT messaging.

Any further details on trying to achieve this?