@goiot/goiot

1.0.7 • Public • Published

Introduction

This package is used for integration with the Go-IoT DINGO-Stack.

UNIX-Socket

The DINGO-Stack provides a UNIX-Socket for inter process communication.
This package provides these functions for the UNIX-Socket communication:

sendToUnixSocket()

This function takes a JSON object as parameter and writes it to the UNIX-Socket.

setDebugMode()

This package will log messages to the console by default. If this behavior is not desired, then call this function with a Boolean false as parameter.

Example

Install this package into your project by calling npm install @goiot/goiot

Then in-code, use like this:

const goiot = require('@goiot/goiot');

// Send object to UNIX-Socket
goiot.sendToUnixSocket(jsonObject);

// Turn off console messages
goiot.setDebugMode(false);

JSON-format

This is the JSON format, that the objects, that are sent to the UNIX-Socket, must adhere to - notice that some of the properties are optional:
{
    "protocol": "CoAP", // Optional "wMBus", "Conectrics", "CoAP", "OCF", etc.
    "type": "tempHumidityLight", // Unique name of sensor-type within "protocol"
// Example from wMBus is "LAS_SMOKE_DETECTOR"
// where "LAS stands for vendor "Lansen".
// Set this name wisely and vendor-unique
    "timestamp": 1561096180, // Optional (Epoch time)
    "sensorId": "3b8e", // 64 bit hexadecimal unsigned integer
    "nativeId": "", // optional. Example for wMBus is "LAS.00019160.2A.03"
    "sequenceNumber": 142,
    "maxHops": 0, // Optional maximum number of allowed network hops (0 = unlimited)
    "numHops": 1, // Optional number of network hops that the message took
    "rssi": -64, // Optional signal strength (wMBus, enOcean, etc.).
    "payload": { // Sensor specific value-pairs
        "battery": 2.8,
        "temperature": 25.71,
        "temperatureUnit": "C",
        "humidity": 50.25,
        "bucketedLux": 0
} }

Readme

Keywords

none

Package Sidebar

Install

npm i @goiot/goiot

Weekly Downloads

8

Version

1.0.7

License

ISC

Unpacked Size

6.77 kB

Total Files

3

Last publish

Collaborators

  • danjal