GithubHelp home page GithubHelp logo

ttn-payload-decoder's Introduction

TTN Payload Decoder

TTN payload decoding script for SenseCAP LoRaWAN messages This script is used for decoding the LoRaWAN messages sent from the SenseCAP nodes. After decoding, users' applications will get more friendly and readable messages from TTN data API.

How to Use

1. Prerequisites

We assume that you already setup your gateway and SenseCAP nodes correctly, and the SenseCAP nodes can send messages to your TTN application. You can already observe the data transmisstion through TTN console.

image

2. Configure the Payload Decoder

  • Please navigate to the Payload Formats tab of your application to which your SenseCAP nodes send data.
  • Select Custom for Payload Format
  • Copy and paste the whole contents of decoder.js to the decoder textarea.

    If you are using the latest version of TTN v3, you may encounter an error that exceeds the character limit. In this case, you will need to use decoder_new-v3-uglifyjs.js instead.

  • Click save payload functions

image

3. Check the Decoded Messages

You may test the decoding script with sample payload first. To do this, just copy 01 01 10 98 53 00 00 01 02 10 A8 7A 00 00 AF 51 into the Payload text input, and click Test button. If succeeded, you will see a successfully parsed JSON structure below.

image

Then let's check out the magic of the script. We navigate to the Data tab, and you can expand any uploaded message to check the Fields in the payload. These fields are just populated by the script.

image

If you're subscribing the messages with TTN's MQTT Data API, you will also get parsed JSON payload fields.

Client mosq-TCSlhYcKaRCn3cIePE received PUBLISH (d0, q0, r0, m0, 'lorawan868/devices/2cf7f12010700041/up', ... (719 bytes))
lorawan868/devices/2cf7f12010700041/up {"app_id":"lorawan868","dev_id":"2cf7f12010700041","hardware_serial":"2CF7F12010700041","port":2,"counter":1119,"confirmed":true,"payload_raw":"AQEQYG0AAAECEOj9AACWSA==","payload_fields":{"err":0,"messages":[{"measurementId":4097,"measurementValue":28,"type":"report_telemetry"},{"measurementId":4098,"measurementValue":65,"type":"report_telemetry"}],"payload":"010110606D0000010210E8FD00009648","valid":true},"metadata":{"time":"2020-03-13T09:09:45.834032725Z","frequency":867.3,"modulation":"LORA","data_rate":"SF7BW125","airtime":66816000,"coding_rate":"4/5","gateways":[{"gtw_id":"eui-2cf7f11014300001","timestamp":1779605971,"time":"2020-03-13T09:09:45.672666033Z","channel":4,"rssi":-66,"snr":8.8,"rf_chain":0}]}}

Reference

How many message types and what's the structure of each message type?

We will document the latest message types in the comment header of the script. Please check out here.

ttn-payload-decoder's People

Contributors

jancee avatar killingjacky avatar msuender avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.