rainmaker-client v0.0.8
rainmaker-client
A NodeJs Package for interfacing Espressif Rainmaker IoT.
Install
npm install rainmaker-clientUsage
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
nodeList(defaultfalse): Passtrueto get list of nodes in the group.groupID: pass Group ID to get specific details of a particular group.nodeDetails(defaultfalse): 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
groupName: Name of the group.nodeList(optional): Array of Node IDs.description(optional): Add description to user group.
Delete User Group
deleteUserGroup deletes a user group.
It accepts only one argument
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 -