Nut - v1.0.0
    Preparing search index...

    Class Monitor

    Allow to monitor events on the UPS

    const client = new NUTClient('127.0.0.1', 3493);
    const monitor = new Monitor(client, 'myUps');
    monitor.on('ONBATT', () => {
    console.log('UPS "myUps" lost power and is now on battery');
    });
    await monitor.start()

    Hierarchy

    Index
    defaultMaxListeners: number
    • Type Parameters

      Parameters

      Returns this

    • Destroy the monitor and release all resources. After calling destroy(), the monitor cannot be reused.

      • Stops the heartbeat
      • Removes all event listeners
      • Cleans up internal state

      Safe to call multiple times (idempotent).

      Returns void

    • Type Parameters

      Returns U[]

    • Returns number

    • Check if the monitor has been destroyed.

      Returns boolean

    • Check if monitoring is currently paused.

      Returns boolean

    • Parameters

      Returns number

    • Type Parameters

      Parameters

      • type: U

      Returns IMonitorEvents[U][]

    • Type Parameters

      Parameters

      Returns this

    • Type Parameters

      Parameters

      Returns this

    • Type Parameters

      Parameters

      Returns this

    • Pause monitoring without stopping it. The heartbeat loop keeps running but events are not emitted while paused. When resumed, the next poll is treated as a fresh start (no spurious events).

      Returns void

    • Type Parameters

      Parameters

      Returns this

    • Type Parameters

      Parameters

      Returns this

    • Type Parameters

      Parameters

      • type: U

      Returns IMonitorEvents[U][]

    • Parameters

      • Optionalevent: keyof IMonitorEvents

      Returns this

    • Type Parameters

      Parameters

      Returns this

    • Resume monitoring after a pause. previousState is cleared so the next poll behaves like the first loop (no VARIABLE_CHANGED / status events are emitted for stale data).

      Returns void

    • Parameters

      • n: number

      Returns this