v1.0.0 — First stable release
Breaking Changes
setVariable()andrunCommand()now return typed objects (CommandResult/TrackedResult) instead of stringsSHUTDOWNevent removed fromIMonitorEvents
New Features
Command Tracking System
Monitor long-running UPS operations with confidence. Enable tracking to get a unique ID for each command, then poll for completion status. Perfect for operations like shutdown.return or load.off.delay where you need to know when the action actually completes.
await client.setTracking(true);
const result = await client.runCommand('myups', 'shutdown.return', '60', {
followTracking: true, // Auto-poll until completion
trackingTimeout: 60000
});
// result.status === 'SUCCESS' when doneEnhanced UPS Management
New methods give you direct access to UPS metadata and control:
getUPSDescription(): Retrieve the human-readable description configured inups.confforceShutdown(): Trigger an emergency shutdown (requires master permissions)runCommand()with parameters: Pass arguments to instant commands likeload.off.delay 120
Smart Monitor Events
The Monitor now emits granular events for every status change, including "NOT" events when conditions clear. Know exactly when your UPS goes on battery (ONBATT), when it's back online (ONLINE), and when the battery is no longer low (NOTLB). Plus communication events (COMMBAD, NOCOMM) to detect when you lose contact with the UPS.
Auto-Reconnect with Session Restoration
Connection drops are inevitable. The client now automatically reconnects with exponential backoff and jitter to avoid thundering herd problems. Even better, it restores your entire session: TLS encryption, authentication, and UPS logins are all re-established automatically.
const client = new NUTClient('192.168.1.100', 3493, {
autoReconnect: true,
maxReconnectAttempts: 10,
username: 'admin',
password: 'secret'
});
client.on('reconnected', () => console.log('Back online!'));NUTClient.create() Factory
Simplify your initialization with a single call that connects and authenticates in one step. Credentials are securely cleared from memory after use.
const client = await NUTClient.create('192.168.1.100', 3493, {
username: 'admin',
password: 'secret',
autoReconnect: true
});See Migration Guide for upgrade details.