Skip to content
forked from skarcha/node-nut

NodeJS client for NUT (Network UPS Tools)

License

Notifications You must be signed in to change notification settings

dersimn/node-nut

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

NodeJS client for NUT (Network UPS Tools)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%