synlink-pdu
v1.1.2
Published
SynLink HTTP(S) API Wrapper
Downloads
5
Maintainers
Readme
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
SynLinkPDU.get_device(pduConfiguration, (error, data) => {
if (error) {
// error occurred:
console.log(error);
} else {
console.log(data);
}
})
Get Outlet Information
SynLinkPDU.get_outlets(pduConfiguration, (error, data) => {
if (error) {
// error occurred:
console.log(error);
} else {
console.log(data);
}
})
Get Circuit/Bank Information
SynLinkPDU.get_banks(pduConfiguration, (error, data) => {
if (error) {
// error occurred:
console.log(error);
} else {
console.log(data);
}
})
Get Inlet Information
SynLinkPDU.get_inlets(pduConfiguration, (error, data) => {
if (error) {
// error occurred:
console.log(error);
} else {
console.log(data);
}
})
Modify Outlet 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);
}
})