rainmaker-client

0.0.8 • Public • Published

rainmaker-client

A NodeJs Package for interfacing Espressif Rainmaker IoT.

Install

npm install rainmaker-client

Usage

import RainMaker from "rainmaker-client";
const client = new RainMaker("username", "password");

const SUCCESS = 200;

async function isAuth() {
  const { status, result } = await client.authenticate();
  if (status == SUCCESS) {
    console.log(result);
  } else {
    console.log(result);
  }
}
isAuth();

Authenticate

authenticate method is used to get accesstoken for Authnticated APIs. Pass true as param to extend session using refreshtoken instead of password.

Stored refreshtoken can be retrieved by :

const token = client.refreshtoken;

User Nodes

getUserNodes returns a list of nodes associated to the user. Pass argument true to get details information for the nodes.

User Group List or Group Details

Get User Group

getUserGroupDetails returns a list of groups associated to the user or details about specific group.

It accepts three arguments

  1. nodeList (default false): Pass true to get list of nodes in the group.
  2. groupID: pass Group ID to get specific details of a particular group.
  3. nodeDetails (default false): to get node details associated to that group. Must provide a group ID.

Add User Group

createUserGroup creates a new user group with the option of adding nodes and description.

It accepts three arguments

  1. groupName: Name of the group.
  2. nodeList (optional): Array of Node IDs.
  3. description (optional): Add description to user group.

Delete User Group

deleteUserGroup deletes a user group.

It accepts only one argument

  1. groupID: User Group ID to deletye.

Time Series Data

getTimeSeriesData returns time series data for a specific node. Currently it only supports aggregate = raw.

Demo

This package is being developed to create a webApp dashboard for ESP Rainmaker IoT solution. Checkout the link below -

Quick links

Package Sidebar

Install

npm i rainmaker-client

Weekly Downloads

6

Version

0.0.8

License

MIT

Unpacked Size

12.9 kB

Total Files

6

Last publish

Collaborators

  • endlessparadigm