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

siot.net-nodejs-api

v1.0.5

Published

This module implements the siot.net gateway api specification.

Downloads

3

Readme

Siot.net Library

What's Siot.net?

Siot.net is an integration platform for the internet of things. The main purpose of this platform is that every user can easily connect smart devices together over a standardized interface. Once a thing (a smart device) is connected to the siot.net platform, there are some basic applications availabe, i.e. display sensor values on a dashboard, etc.

To connect a thing with sensors and actors to the siot.net platform, the user has to write a gateway which acts as the bridge between them. This way, there isn't any limitation which tings can be connected to the siot.net platform as long they have some interface which a custom developed siot.net gateway can use.

This NodeJS Module implements the siot.net specification to develop such gateways. Siot.net uses MQTT as under laying messaging protocol. The siot.net specification is basically a formal description which mqtt topics with which payload format a siot.net gateway has to use for full compatibility with the siot.net ecosystem.

Installation

npm install siot.net-nodejs-api --save

Debugging

The library uses the debug npm module with the tags siotgateway:http and siotgateway:mqtt

To see these debug output, set the environment variable DEBUG=siotgateway:*

Example for bash

DEBUG=siotgateway:* node siot_dummy_gateway.js

see also https://www.npmjs.com/package/debug for further examples.

Example Siot.net Gateway

In this example we instantiate a sensor and an actor and register them on the gateway. We also send some dummy sensor values and register a listener for messages for the actor.

var siot = require('siot.net-nodejs-api'),
    async = require('async');

var gateway = new siot.gateway({
    centerLicense: "xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx" // insert your license here
});

var sensor = new siot.sensor({
    uuid: "29d265c1-daf0-4a91-a1d9-45e48239728b",
    name: "SensorTest1",
    valueType: "text"
});

var actor = new siot.actor({
    uuid: "71e36799-25f5-4b7f-882f-041f5104add7",
    name: "ActorTest1",
    valueType: "text"
});

async.series([
        function (done) {
            gateway.registerDevice(sensor, done)
        },
        function (done) {
            gateway.registerDevice(actor, done)
        },
        function (done) {
            gateway.connect(done)
        },
        function (done) {
            sensor.sendSensorData("test", done)
        }
    ],
    function (err) {
        if (err) return console.error(err);

        actor.on('siot_data', function(message) {

            console.log('received data for actor:', message);

        });

        console.log("setup complete");
});

API Documentation

See file api_doc.md

Contributing

Please just raise a pull request on GitHub.

Copyright and license

Copyright 2016, Roger Jaggi and Pascal Bohni under the Apache 2.0 license.