Welcome to node-tripp-lite 👋
node-tripp-lite
allows you to minitor and controls Tripp-Lite UPSs via USB. It uses thenode-hid
library for communications and is compatible with both Windows and Linux nodejs versions.
Install
npm install node-tripp-lite
Linux installation
This library uses node-hid for USB communication. In order to install on linux, you'll need to install libusb and libudev
sudo apt-get updatesudo npm install libusb-1.0.0 libusb-dev libuv-dev
Usage
const UPS = ;const ups = ; // Turn on master relayups // Turn off the load on relay 2ups // Power cycle relay 1 with a 60 second wait timeups ups// Example output (abberviated):// {// batteryLow: false,// deviceName: 'TRIPP LITE SMART1000RM1',// inverterOn: false,// loadRelaysPowered: [ true, true ],// masterRelayPowered: true,// nominalVac: 120,// nominalVdc: 24,// powerRating: 1000,// switchableLoads: 2,// voltageAc: 115,// voltageAcMax: 117,// voltageAcMin: 113,// voltageDc: 13.6,// ...// }
API
Classes
Typedefs
- DeviceDescriptor :
Object
HID Descriptor for the device.
- UPSState :
Object
State of a Tripp-Lite UPS
UPS
Kind: global class
- UPS
- instance
- .getStatus() ⇒
Promise.<UPSState>
- .writeSettings(flags)
- .resetVoltageRange()
- .powerCycleRelay(relay, delayTime)
- .powerCycleMasterRelay(delayTime)
- .selfTest()
- .reboot()
- .writeUnitId(unitId)
- .writePreDelay(delayTime)
- .relayOn(relay)
- .relayOff(relay)
- .masterRelayOn()
- .masterRelayOff()
- .disableWatchdog()
- .enableWatchdog(delay)
- "change"
- "initialized"
- "connected"
- "disconnected"
- .getStatus() ⇒
- static
- instance
Promise.<UPSState>
ups.getStatus() ⇒ Returns a promise that will resolve to a UPSState
Object
Kind: instance method of UPS
Returns: Promise.<UPSState>
- - Object containing the state of the UPS
Example
ups;
ups.writeSettings(flags)
Write system settings to the UPS. Any settings not included to will be left the same.
Kind: instance method of UPS
Param | Type | Description |
---|---|---|
flags | object |
An object containing the settings to write. |
flags.autostartAfterShutdown | boolean |
Automatically restart the system after a shutdown |
flags.autostartAfterDelayedWakeup | boolean |
Automatically restart the system after a delayed wakeup |
flags.autostartAfterDelayedWakeup | boolean |
Automatically restart the system after low voltage cutoff. |
flags.autostartAfterOverload | boolean |
Automatically restart the system after overload. |
flags.autostartAfterOverTemp | boolean |
Automatically restart the system after an over temp situation. |
flags.enableBiweeklyAutoSelfTest | boolean |
Enable 14 day self tests. |
Example
ups
ups.resetVoltageRange()
Resets the min and max voltage registers
Kind: instance method of UPS
Example
ups;
ups.powerCycleRelay(relay, delayTime)
Power cycle a specific relay on the ups
Kind: instance method of UPS
Param | Type | Description |
---|---|---|
relay | number |
Relay index (0=master) |
delayTime | number |
Delay time in ms before turning power back on |
Example
// Power cycle load 1 relay, waiting 20 seconds before restartingups
ups.powerCycleMasterRelay(delayTime)
Power cycle the master relay
Kind: instance method of UPS
Param | Type | Description |
---|---|---|
delayTime | number |
Delay time in ms before turning power back on |
Example
// Power cycle master relay, waiting 60 seconds before restartingups
ups.selfTest()
Trigger a self-test
Kind: instance method of UPS
Example
ups;
ups.reboot()
Reboot the UPS
Kind: instance method of UPS
Example
ups;
ups.writeUnitId(unitId)
Write the unit ID to the UPS
Kind: instance method of UPS
Param | Type | Description |
---|---|---|
unitId | number |
16bit unit number |
Example
// Set the unit id to 42ups;
ups.writePreDelay(delayTime)
Write the pre-delay (used before shutdown and relay control functions)
Kind: instance method of UPS
Param | Type | Description |
---|---|---|
delayTime | number |
delay time in seconds |
Example
// Set the preDelaytime to 60 secondsups
ups.relayOn(relay)
Turns a relay on
Kind: instance method of UPS
Param | Type | Description |
---|---|---|
relay | number |
relay index (0=master) |
Example
// Turn load 2 relay onups;
ups.relayOff(relay)
Turns a relay off
Kind: instance method of UPS
Param | Type | Description |
---|---|---|
relay | number |
relay index (0=master) |
Example
// Turn load 1 relay offups;
ups.masterRelayOn()
Turns master relay on
Kind: instance method of UPS
Example
ups;
ups.masterRelayOff()
Turns master relay off
Kind: instance method of UPS
Example
ups;
ups.disableWatchdog()
Disables the watchdog feature
Kind: instance method of UPS
Example
ups;
ups.enableWatchdog(delay)
Enables the watchdog feature
Kind: instance method of UPS
Param | Type | Description |
---|---|---|
delay | number |
Delay time in seconds (must be >1); |
Example
// Turn on the watchdog feature, setting the delay to 30 secondsups
"change"
Emitted when any device property changes
Kind: event emitted by UPS
Properties
Name | Type | Description |
---|---|---|
property | string |
Name of the property that has changed |
value | boolean | string | number | array |
The new value of the property |
oldValue | boolean | string | number | array |
The old value of the property |
state | object |
The complete state |
Example
ups
"initialized"
Emitted when data for all properties has been received after a device is connected.
Kind: event emitted by UPS
Example
ups
"connected"
A device has been connected
Kind: event emitted by UPS
Example
ups
"disconnected"
A device has been disconnected
Kind: event emitted by UPS
Example
ups
Array.<DeviceDescriptor>
UPS.list() ⇒ Get a list of tripp-lite UPSs connected. The product ID can be used in the constructor function to connect to a specific device
Kind: static method of UPS
Returns: Array.<DeviceDescriptor>
- - Array of available devices
Example
console;//Example return value// {// vendorId: 2478,// productId: 1,// path: '\\\\?\\hid#vid_09ae&pid_0001#6&1e92950d&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}',// manufacturer: 'TRIPP LITE',// product: 'TRIPP LITE SMART1000RM1U ',// release: 1,// interface: -1,// usagePage: 65440,// usage: 1// }
Object
DeviceDescriptor : HID Descriptor for the device.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
vendorId | number |
Device vendor Id |
productId | number |
Used to select a specicific device in the constructor |
path | string |
HID path for the device |
product | string |
Product name |
manufacturer | string |
Device manufacturor |
interface | number |
|
usagePage | number |
|
usage | number |
Object
UPSState : State of a Tripp-Lite UPS
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
autostartAfterDelayedWakeup | boolean |
|
autostartAfterLowVoltageCutoff | boolean |
|
autostartAfterOverload | boolean |
|
autostartAfterOverTemp | boolean |
|
autostartAfterShutdown | boolean |
|
batteryCapacityPercentage | number |
Battery capacity in percentage |
batteryCharge | number |
|
batteryLow | boolean |
|
deviceName | string |
Device model name |
enableBiweeklyAutoSelfTest | boolean |
|
faults: | string |
'noFault', |
firmware | string |
Firmware version |
frequency | number |
AC Power frequencey |
frequencyMode | number |
AC Frequencey mode |
idle | boolean |
|
inverterOn | boolean |
|
loadLevel | number |
Output load level in percentage |
loadRelaysPowered | array |
Array of boolean values indicating the state of the load relays. The number of relays included is determinted by the value of switchableLoads. |
masterRelayPowered | boolean |
|
nominalVac | number |
Nominal battery Voltage of the device |
nominalVdc | number |
Nominal battery voltage of the device |
powerRating | number |
Power rating in VA. |
selfTestRunning | boolean |
|
selfTestState | string |
Self test state |
standby | boolean |
|
switchableLoads | number |
number of relays that can be switched, excluding the master. |
temperature | number |
not currently working correctly |
transformerTap | string |
Transformer tap state |
unitId | number |
|
usbFirmware | string |
USB firmware version |
voltageAc | number |
Current input AC voltage |
voltageAcMax | number |
Hightest detected AC voltage |
voltageAcMin | number |
Lowest detected AC voltage |
voltageDc | number |
Current DC voltage |
watchdogDelay | number |
|
watchdogEnabled | boolean |
Author
👤 Ruby Rubenstahl
- Github: @rubyrubenstahl
🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check issues
page.
Show your support
Give a ⭐️ if this project helped you!
This README was generated with ❤️ by readme-md-generator