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

@applica-software-guru/drax-sdk

v1.0.6

Published

This pakage this package allows interfacing to the Drax IoT platform (https://draxcloud.com/) To use this plugin you need to create a project on the platform. After project creation you must use API_KEY and API_SECRET of project to: - publish state on no

Downloads

3

Readme

drax-sdk

This package allows interfacing to the Drax IoT platform (https://draxcloud.com/) To use this plugin you need to create a project on the platform. After project creation you must use API_KEY and API_SECRET of project to:

  • publish state on node;
  • listen the node configuration;

Installation

To install the package you need to run the following command:

$ npm install @applica-software-guru/drax-sdk

Usage

Before use methods of sdk you need to do create a configuration file (config.json) with this structure:

{
    "draxPublicKey": "DRAX_PUB_KEY",
    "project":{
        "id": "PROJECT_ID",
        "apiKey": "PROJECT_API_KEY",
        "apiSecret": "PROJECT_API_SECRET"
    },
    "keys": [
        {
            "nodeId": "NODE_ID",
            "privateKey": "NODE_PRIVATE_KEY"
            "publicKey": "NODE_PUBLIC_KEY"
        }

    ]
}

DRAX_PUB_KEY is the cloud public key for ECDH algorithm. Default is: "bb099d6dce1a953c7c5d2380815ee02ea191b39206000000ceefb3c222b480459556ce440379cef89db0ccfc04000000" PROJECT_ID, PROJECT_API_KEY, PROJECT_API_SECRET is the id of project you get after Project creation on Drax. "keys" is an array of private keys associated with nodes created on drax. After node creation, Drax return NODE_PUBLIC_KEY and NODE_PRIVATE_KEY. It needs to be stored in a Keystore.

Example

const { Drax } = require("@applica-software-guru/drax-sdk");
const { Keystore } = require("@applica-software-guru/drax-sdk/keystore");
const config = require("./config.json");
const { HTSensor } = require("./listeners/htsensor");
const { Rele } = require("./listeners/rele");
const { Trv } = require("./listeners/trv");
new Keystore().instance().addConfig(config);

var params = {
  host: null,
  port: null,
  vhost: null,
  config,
};

var trv = new Trv();
var rele = new Rele();
var htsensor = new HTSensor();

var listeners = [trv, rele, htsensor];

var drax = new Drax(params);
drax
  .start()
  .then(() => {
    var state = { dato: "Hello World!" };
    drax.setState(3393, "homematicip:gateway:test", state, false);

    drax.addConfigurationListener("configurations/homematicip", listeners);
  })
  .catch((e) => {});

To create Drax object you need to load the correct parameters. The properties of the parameters are the following:

| Parameter | Description | Default | | :-------- | :---------------------------: | -------------------: | | host | Is the address of AMQP broker | amqp://35.205.187.28 | | port | Port of AMQP broker | 5672 | | vhost | vhost of AMQP broker | "/" | | config | configuration file | |

Future improvements

The next release would have setConfiguration and StateLister.