npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

strips-lora-translator-open-source

v1.0.8

Published

Open source translator for Sensative Strips (LoRaWan sensors)

Downloads

7

Readme

  1. INTRODUCTION This is a small open source project serving the purpose of interacting with Sensative AB Strips Lora sensor products. It examplifies using a secure REST API (using node.js) for translating data from the Sensative LoRa Strips (www.sensative.com). It can serve as reference for custom translation work, or it can be used off-the-shelf as a microservice serving translations in your infrastructure. Additionally the code includes metadata for composing downlinks or translating them.

See LICENSE.txt for license and copyright information (MIT open source license).

For TTN users we recommend https://gitlab.com/sensative/strips-lora-translator-ttn/ TTN decoder, which is a simplified version of this project adapted to TTN.

The code comes in the following files:

  • raw-translate.js : Legacy version of the Strips translator. Reference design.
  • strips-translate.js : Data-driven version which also can decode downlinks.
  • cli.sh Command line tool to run either of the above, using the inclusion mechanism described below
  • serve.sh : Described in example below
  1. SYSTEM REQUIREMENTS: It is assumed you have node.js installed, and that you are using bash shell. Using it as npm/yarn package is also possible, see installation below. It has been developed only on Mac OSX with node 13.8.0.

  2. INSTALLATION:

Several possibilities exist:

For running as microservice, as is with example code as with serve.sh

  1. Clone this repository
  2. Obtain a certificate and key and put in in a cert folder within the repository
  3. Either launch this using the serve.sh file or using command line or other method, pass PORT as environment parameter.

or

Include this in your application by adding this dependency

yarn add strips-lora-translator-open-source

Then in your javascript file (example for command line use):

const translator = require('strips-lora-translator-open-source');
translator.commandLine(); // Example, you can also review this file to see how to directly access its functions.

Or for inclusion in a web application

import {decodeLoraStripsUplink, decodeLoraStripsDownlink} from 'strips-lora-translator-open-source/strips-translate';
  1. EXAMPLE MICROSERVICE USAGE:

make requests to host:{PORT}/translate?p={LORA PORT}&d={HEXADECIMAL LORA PAYLOAD}

If the data is correct it will return a JSON encoded object representing the data sent to/from from the LoRa Strip.

4.1 API KEYS (OPTIONAL):

Additionally, should you wish you can add rudimentary API key handling to manage who can make calls to this API. The API keys are intended to be secret but not severely secret since this only prevents decoding (the HTTPS layer is responsible for data security). In this case, add a folder apikeys in the installation directory. Should it be there and be non-empty, all of the file names in there will serve as API keys (which can be added or removed if a particular key holder is added or barred). Do not use the same key for different key holders.

In this case, a new parameter k is read, and matched against the file names in the apikeys folder.

Example: host:{PORT}/translate?p={LORA PORT}&d={HEXADECIMAL LORA PAYLOAD}&k={key, e.g. a base64 encoded hash}

4.2 EXAMPLE:

Using a self-generated certificate, an apikeys folder containing a file examplekey2 and PORT being set to 38111.

URL: https://localhost:38111/translate?p=1&d=ffff1201&k=examplekey2 RESULT: {"historySeqNr":65535,"prevHistSeqNr":65535,"presence":{"value":true}}