Node-NUT is a NodeJS module that implements a NUT (Network UPS Tools) client.
v2 introduces new method names and Promises for certain functions. Please refer to the API below.
Kind: global class
- Nut
- new Nut([port], [host])
- .connected :
boolean
- .connect() ⇒
Promise
- .disconnect()
- .getUpsList([callback]) ⇒
Promise.<object>
- .getUpsVars(ups, [callback]) ⇒
Promise.<object>
- .getUpsCommands(ups, [callback]) ⇒
Promise.<object>
- .getRwVars(ups, [callback]) ⇒
Promise.<object>
- .getEnumsForVar(ups, name, [callback]) ⇒
Promise.<object>
- .getRangesForVar(ups, name, [callback]) ⇒
Promise.<object>
- .getVarType(ups, name, [callback]) ⇒
Promise.<object>
- .getVarDescription(ups, name, [callback]) ⇒
Promise.<object>
- .getCommandDescription(ups, command, [callback]) ⇒
Promise.<object>
- .nutSetRwVar(ups, name, value, [callback]) ⇒
Promise.<object>
- .runUpsCommand(ups, command, [callback]) ⇒
Promise.<object>
- .setUsername(username, [callback]) ⇒
Promise.<object>
- .setPassword(password, [callback]) ⇒
Promise.<object>
- .master(ups, [callback]) ⇒
Promise.<object>
- .fsd(ups, [callback]) ⇒
Promise.<object>
- .help([callback]) ⇒
Promise.<object>
- .ver([callback]) ⇒
Promise.<object>
- .netVer([callback]) ⇒
Promise.<object>
- .listClients(ups, [callback]) ⇒
Promise.<object>
Create an instance of Nut to use with the provided upsd instance at host:port
Param | Type |
---|---|
[port] | number |
[host] | string |
Gets current connection state
Kind: instance property of Nut
Connect to upsd instance.
Kind: instance method of Nut
Returns: Promise
- Connection established.
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
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 |
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 |
Kind: instance method of Nut
Param | Type | Description |
---|---|---|
ups | string |
UPS identifier |
[callback] | function |
Provide either a callback function or use the returned promise |
Kind: instance method of Nut
Param | Type | Description |
---|---|---|
ups | string |
UPS identifier |
[callback] | function |
Provide either a callback function or use the returned promise |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Send HELP
command.
Kind: instance method of Nut
Param | Type | Description |
---|---|---|
[callback] | function |
Provide either a callback function or use the returned promise |
Send VER
command.
Kind: instance method of Nut
Param | Type | Description |
---|---|---|
[callback] | function |
Provide either a callback function or use the returned promise |
Send NETVER
command.
Kind: instance method of Nut
Param | Type | Description |
---|---|---|
[callback] | function |
Provide either a callback function or use the returned promise |
Kind: instance method of Nut
Param | Type | Description |
---|---|---|
ups | string |
UPS identifier |
[callback] | function |
Provide either a callback function or use the returned promise |
Protocol: http://networkupstools.org/docs/developer-guide.chunked/ar01s09.html