-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Software Service which will
- Translate Sensative AB Puck, Box, Square, and Lifefinder data.
- Manage GNSS almanac and assistance position updates for the devices over LoRaWan.
- Solve positions
- Manage device time in LoraWan networks which lack this feature
- Format the device data
- Forward the device data to the wanted destination.
MIT License, see license file.
- Clone the repository
- At the top level, run
yarn install
If you wish to run the program with the AWS Cloud solver follow the below steps
- At the top level run
yarn add aws-sdk
- Locate the
constants.json
file and fill out the required fields, e.g:
{
"AWS": {
"VERSION": "<SDK VERSION>", Format:
"ACCESS_KEY_ID": "<YOUR ACCESS KEY ID>",
"SECRET_ACCESS_KEY": "<YOUR SECRET ACCESS KEY>",
"REGION": "<YOUR REGION, EU NORTH IS NOT SUPPORTED>"
}
}
-v Run in verbose mode, will generate extra log printouts (no argument)
-f <filename> Select device identity file (can be substituted with -w for some integrations)
-w Wildcard all devices available on the server matching a Sensative DevEUI
-i <integration> Select integration (see integrations folder for list of available integrations)
-k <api key> Enter the API key for semtech loracloud location services (required for GNSS and WIFI solve)
-d <decorator> Select decorator (see decorators folder for list of available decorators). If omitted the full translated object with all bookkeeping data will be used.
-O <publisher> Select publisher (see publishers folder for list of available publishers). If omitted the publishing will be only to the console.
-z <solver> Select a GNSS almanac and solution provider. Defaults to loracloud.
Where is raw device data fetched and where do we send downlinks?
-a <n> Provide the application id (an integer number) in which the device ids are valid
-s mqtts://<chirpstack server url> Select the URL of the chirpstack server in use
node vsm-mqtt-client.js -v -f chirpstack-devices.list -i chirpstack3 -a 12 -s mqtts://chirpstack.company.com -k AQEAf8i6p8...
Note - this integration is not completed since downlinks are not yet implemented which means that the rules will not have effect (and hence devices are not properly updated with almanacs, device time relies on the device).
node vsm-mqtt-client.js -v -f chirpstack-devices.list -i chirpstack3 -a appname -s mqtts://chirpstack.company.com -k AQEAf8i6p8...
A general note: At the time of writing this I do not get device time support from Helium. This means that the device needs to get device time from another source at least once before several of the GNSS assisted functions work. One way to do this is through NFC, another is through roaming to other networks that have device time.
- s mqtts://<mqtt broker URL> Select the URL of the broker
- u <username> User name on the broker (possibly ignored)
- p <password> Password on the broker for the selected user (possibly ignored)
It is assumed that the device EUI is used as identifier. This means that your MQTT integration topics need be updated to use device_eui instead of device_id (which is the default).
-
Uplink topic:
helium/vsm/rx/{{device_eui}}
-
Downlink topic:
helium/vsm/tx/{{device_eui}}
Point the console to the same mqtt broker.
While experimenting with this it was clear that the helium console did not work with HiveMQ cloud,
node vsm-mqtt-client.js -v -w -i helium -s mqtt://test.mosquitto.org:1883 -k AQEAf8i... -u username -p pass
Run with all devices, using helium as lora server (set up to push data to test.mosquitto.org)
The decorator can be selected or developed to filter or transform the data so it fits the application.
Publishers have the role of making the decorated translated data available to downstream applications.
The console publisher (default) is selected with the -O console
command line option. It will print a formatted version of the decorated object to the command line.
The mqtt publisher (mqtt) is selected with the -O mqtt
command line option.
The MQTT publisher will require two additional command line arguments
-S <mqtt broker url> Select the URL for the target MQTT broker
-T <topic format> Decide the topic format for the published data.
The topic format is used to format how the mqtt publishing is done. Basically it will be done literally as is, the only exception is that the text deveui will be replaced with the deveui of the device in lowercase OR the text DEVEUI will be replaced with the device deveui in UPPERCASE.
Run select devices with data from helium, publish only latest values to mqtt
node vsm-mqtt-client.js -f helium-devices.list -i helium -s mqtt://test.mosquitto.org:1883 -k AQEAf8i6p... -u test -p pass -d minimal -O mqtt -S mqtt://test.mosquitto.org:1883 -T interpreted/deveui/data
Run with data from helium, all devices, print full data to console
node vsm-mqtt-client.js -w -i helium -s mqtt://test.mosquitto.org:1883 -k AQEAf8i6... -u test -p pass
This code is designed to listen to a lorawan network server publishing the raw uplinks from a VSM device. It will translate it correctly and can additionally control the device with necessary downlinks to keep it up-to-date with regards to assistance positions. Once new data is available it will be re-published using a publisher.
The main file which ties together the below components and contains the main logic.
Contains the currently supported integrations. Each integration can have their own options.
Contains the currently supported decorators. A decorator transforms the actual representation of the data into something palatable by the user, e.g. it can change names of fields or filter out information of no interest to the user (there is plenty of bookkeeping information in the translated object).
Contains the currently supported publishers. A publisher will publish the data from the integration, translated and decorated. The publishers include an mqtt publisher and a console publisher.
Contains the solver implementations. The default is loracloud but provide -z argument to select none or some of the other solvers. Currently loracloud is the default solver, but aws and none is options. With none selected no position solving is enabled.
Provides object storage and error storage. This is required in order to save the state of the sensors between uplinks.
Utility functions, in particular object merging
Client code to the lora cloud. You will have to provide your own API key [-k option] in order to use the loracloud solver functionality.
Client code to the aws implementation of lora cloud. You will have to provide your own AWS Access Key Id and Secret Access Key in order to use the AWS solver functionality. As of now AWS does not support full almanac download
Rules for updating the device with downlinks depending on the device state.
- A http push would be a nice extension to the publishing mechanism.
- Add a structured way to add different storage modes than file system
- Add support for skipping the list of devices, instead use MQTT wildcards and filter on the deveui range
The device data translator is a separate open source repository. It contains the functionality for decoding all of the products and versions released by Sensative. It is recommended to frequently update this as new products and versions are published frequently.