How to Use Payload Codec on Linovision Gateway
Introduction
When Linovision gateway work as embedded network server, it supports to send data to third party server via MQTT/HTTPS and it will send every data as below JSON format:
This article will guide you how to custom uplink and downlink contents via Payload Codec feature.
Requirement
- Linovision LoRaWAN Gateway: IOT-G65/G67 with firmware version 60.0.0.41 and later
For other models or versions, please refer to How to Use Payload Codec on Linovision Gateway(old).
Configuration
Inbuilt Payload Codec
Linovision gateway has supported the inbuilt payload codec library to add Linovision decoders and encoders easily. It supports two obtaining types:
Online: when gateway is able to access the Internet, it will check the update and update the library automatically. You can also click Obtain to check the update.
Local Upload: upload decoder package locally.
When you add any device on Network Server > Device page, you can select the decoder and the decoded data will be shown on the packet details of Network > Packets page.
Custom Payload Codec
If you use other brand devices or the default decoder does not work with your application, please add a custom payload codec:
Uplink Content Customization
Take IOT-S500TH as example, here are 3 situations for uplink content customization.
1. Only upload decoded sensor data.
Copy IOT-S500TH decoder and paste it to Payload decoder function box.
Note: If you configure the sensor from other company, please contact their support to get the Decoder Script (Java Script), then ensure the script header is function Decode(fPort, bytes) when paste.
You can use Payload Codec Test feature to test the uplink result.
Uplink Result:
2. Upload specific attribute items and raw data.
Click here to know all attribute items in one package. Linovision gateways provide function LoRaOject to call every item you require. If you need to send dev EUI, RSSI, SNR and raw data, edit this example coder:
Uplink Result:
After adding, you can add this payload codec to a device and go to Network Server > Packets to check the uplink result on Packet Details.
3. Upload specific attribute items and decoded data.
Copy IOT-S500-TH decoder and paste it to Payload decoder function box, then add attribute items before return decoded statement:
Uplink Result:
Note: If you need to add all attribute items, add decoded.obj= LoRaObject; before return decoded statement.
After adding, you can add this payload codec to a device and go to Network Server > Packets to check the uplink result on Packet Details.