Git Product home page Git Product logo

node-nut's Introduction

Node-NUT

Node-NUT is a NodeJS module that implements a NUT (Network UPS Tools) client.

Version compatibility information

v2 introduces new method names and Promises for certain functions. Please refer to the API below.

API

Nut

Kind: global class

new Nut([port], [host])

Create an instance of Nut to use with the provided upsd instance at host:port

Param Type
[port] number
[host] string

nut.connected : boolean

Gets current connection state

Kind: instance property of Nut

nut.connect() ⇒ Promise

Connect to upsd instance.

Kind: instance method of Nut
Returns: Promise - Connection established.

nut.disconnect()

Use to disconnect manually inbetween polling cycles when polling with very low frequencies. For e.g. upslog disconnects if the polling cycle is >30s.

Kind: instance method of Nut

nut.getUpsList([callback]) ⇒ Promise.<object>

Kind: instance method of Nut
Returns: Promise.<object> - Object containing key-value pairs of upsId -> description.

Param Type Description
[callback] function Provide either a callback function or use the returned promise

nut.getUpsVars(ups, [callback]) ⇒ Promise.<object>

Get variables for a certain UPS.

Kind: instance method of Nut
Returns: Promise.<object> - Object containing key-value list of availabla variables. For e.g. battery.charge.

Param Type Description
ups string UPS identifier
[callback] function Provide either a callback function or use the returned promise

nut.getUpsCommands(ups, [callback]) ⇒ Promise.<object>

Kind: instance method of Nut

Param Type Description
ups string UPS identifier
[callback] function Provide either a callback function or use the returned promise

nut.getRwVars(ups, [callback]) ⇒ Promise.<object>

Kind: instance method of Nut

Param Type Description
ups string UPS identifier
[callback] function Provide either a callback function or use the returned promise

nut.getEnumsForVar(ups, name, [callback]) ⇒ Promise.<object>

Kind: instance method of Nut

Param Type Description
ups string UPS identifier
name string Variable name
[callback] function Provide either a callback function or use the returned promise

nut.getRangesForVar(ups, name, [callback]) ⇒ Promise.<object>

Kind: instance method of Nut

Param Type Description
ups string UPS identifier
name string Variable name
[callback] function Provide either a callback function or use the returned promise

nut.getVarType(ups, name, [callback]) ⇒ Promise.<object>

Kind: instance method of Nut

Param Type Description
ups string UPS identifier
name string Variable name
[callback] function Provide either a callback function or use the returned promise

nut.getVarDescription(ups, name, [callback]) ⇒ Promise.<object>

Kind: instance method of Nut

Param Type Description
ups string UPS identifier
name string Variable name
[callback] function Provide either a callback function or use the returned promise

nut.getCommandDescription(ups, command, [callback]) ⇒ Promise.<object>

Kind: instance method of Nut

Param Type Description
ups string UPS identifier
command string Command name
[callback] function Provide either a callback function or use the returned promise

nut.nutSetRwVar(ups, name, value, [callback]) ⇒ Promise.<object>

Kind: instance method of Nut

Param Type Description
ups string UPS identifier
name string Variable name
value string Value to set
[callback] function Provide either a callback function or use the returned promise

nut.runUpsCommand(ups, command, [callback]) ⇒ Promise.<object>

Kind: instance method of Nut

Param Type Description
ups string UPS identifier
command string Command name
[callback] function Provide either a callback function or use the returned promise

nut.setUsername(username, [callback]) ⇒ Promise.<object>

Kind: instance method of Nut

Param Type Description
username string Login with provided username
[callback] function Provide either a callback function or use the returned promise

nut.setPassword(password, [callback]) ⇒ Promise.<object>

Kind: instance method of Nut

Param Type Description
password string Login with provided password
[callback] function Provide either a callback function or use the returned promise

nut.master(ups, [callback]) ⇒ Promise.<object>

Gain master privileges for this connection. You have to login with a username/password combination first.

Kind: instance method of Nut

Param Type Description
ups string UPS identifier
[callback] function Provide either a callback function or use the returned promise

nut.fsd(ups, [callback]) ⇒ Promise.<object>

Execute FSD (you must be master to do this)

Kind: instance method of Nut

Param Type Description
ups string UPS identifier
[callback] function Provide either a callback function or use the returned promise

nut.help([callback]) ⇒ Promise.<object>

Send HELP command.

Kind: instance method of Nut

Param Type Description
[callback] function Provide either a callback function or use the returned promise

nut.ver([callback]) ⇒ Promise.<object>

Send VER command.

Kind: instance method of Nut

Param Type Description
[callback] function Provide either a callback function or use the returned promise

nut.netVer([callback]) ⇒ Promise.<object>

Send NETVER command.

Kind: instance method of Nut

Param Type Description
[callback] function Provide either a callback function or use the returned promise

nut.listClients(ups, [callback]) ⇒ Promise.<object>

Kind: instance method of Nut

Param Type Description
ups string UPS identifier
[callback] function Provide either a callback function or use the returned promise

Links

Protocol: http://networkupstools.org/docs/developer-guide.chunked/ar01s09.html

node-nut's People

Contributors

apollon77 avatar dersimn avatar links2004 avatar skarcha avatar yeya avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.