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.
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”:
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.