synlink-pdu

1.1.2 • Public • Published

NodeJS SynLink PDU API Wrapper

The SynLink PDU API Wrapper for NodeJS provides convenient access to the SynLInk HTTP API from applications written in server-side JavaScript.

Documentation

See the SynLink API Documentation

Requirements

Node 8, 10 or higher

Installation

Install the package with:

npm install synlink-pdu --save
# or
yarn add synlink-pdu

Usage

Each request requires a pduConfiguration object:

How to generate a PAT (Personal Access Token)

const SynLinkPDU = require("synlink-pdu");
const pduConfiguration = {
  ip: "http://192.168.1.100",
  pat: "mr0dGGdFKKyBzbIgBlA"
};

SynLinkPDU.get_outlets(pduConfiguration, (error, data) => {
  if (error) {
    // error occurred:
    console.log(error);
  } else {
    console.log(data);
  }
})

Get Device Information

Device API Information

SynLinkPDU.get_device(pduConfiguration, (error, data) => {
  if (error) {
    // error occurred:
    console.log(error);
  } else {
    console.log(data);
  }
})

Get Outlet Information

Outlet API Information

SynLinkPDU.get_outlets(pduConfiguration, (error, data) => {
  if (error) {
    // error occurred:
    console.log(error);
  } else {
    console.log(data);
  }
})

Get Circuit/Bank Information

Bank API Information

SynLinkPDU.get_banks(pduConfiguration, (error, data) => {
  if (error) {
    // error occurred:
    console.log(error);
  } else {
    console.log(data);
  }
})

Get Inlet Information

Inlet API Information

SynLinkPDU.get_inlets(pduConfiguration, (error, data) => {
  if (error) {
    // error occurred:
    console.log(error);
  } else {
    console.log(data);
  }
})

Modify Outlet Information

Modify Outlet API Information

SynLinkPDU.set_outlets(pduConfiguration, {
  id: "1-2001399", // can be outlet ID or outlet index
  state: "ON"
},
(error, data) => {
  if (error) {
    // error occurred:
    console.log(error);
  } else {
    console.log(data);
  }
})

Package Sidebar

Install

npm i synlink-pdu

Weekly Downloads

10

Version

1.1.2

License

MIT

Unpacked Size

6.02 kB

Total Files

4

Last publish

Collaborators

  • synaccess-llc