Nut - v1.0.0
    Preparing search index...

    Class NUTClient

    Hierarchy

    Index
    defaultMaxListeners: number
    • get connected(): boolean

      Check if the client is currently connected to the NUT server.

      Returns boolean

      true if connected, false otherwise

    • Type Parameters

      Parameters

      Returns this

    • Allow to authenticate user on the UPS

      Parameters

      • username: string

        {string}

      • password: string

        {string}

      Returns Promise<void>

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

      Returns void

    • Type Parameters

      Parameters

      Returns boolean

    • Type Parameters

      Returns U[]

    • Force a shutdown on the UPS (set the FSD flag).

      Parameters

      • ups: string

        The name of the UPS

      Returns Promise<string>

      The server response

      Requires master or FSD permission. Use with caution.

    • get the description of a command

      Parameters

      • ups: string
      • command: string

      Returns Promise<string>

    • Check if this client is master for the UPS

      Parameters

      • ups: string

      Returns Promise<boolean>

    • Returns number

    • get number of clients logged (using LOGIN command)

      Parameters

      • ups: string

      Returns Promise<number>

    • Get the status of a previously tracked write command by its UUID.

      Parameters

      • uuid: string

        The tracking UUID returned by a write command

      Returns Promise<string>

      'PENDING', 'SUCCESS', or 'ERR'

      Requires NUT 2.8.0+ (protocol v1.3) on the server.

    • allow to select an UPS, and get an UPS object

      Parameters

      • name: string

        {string} name of the ups to search

      Returns Promise<UPS | undefined>

    • Get the description of a UPS (from ups.conf desc= field).

      Parameters

      • ups: string

        The name of the UPS

      Returns Promise<string>

      The UPS description string

    • get the type of variable ... Defined by the NUT driver, default to NUMBER

      Parameters

      Returns Promise<
          { type: "RW"
          | "ENUM"
          | "STRING"
          | "RANGE"
          | "NUMBER" } & Record<string, unknown>,
      >

    • List the logged clients on the UPS

      Parameters

      • ups: string

      Returns Promise<string[]>

    • list the available commands on the UPS

      Parameters

      • ups: string

      Returns Promise<string[]>

    • Parameters

      Returns number

    • List all available UPS devices.

      Returns Promise<UPS[]>

      Array of UPS objects with parsed name and description.

    • List writeable variables for a UPS.

      Parameters

      • ups: string

      Returns Promise<Record<string, string>>

      Object mapping variable names to their current values

      Unlike RawNUTClient which returns raw strings, this method parses the response into a key-value object

    • Parameters

      • ups: string

        {string} the name of the UPS

      Returns Promise<string>

      You probably shouldn't send this command unless you are upsmon, or a upsmon replacement.

    • will log out from the server

      Returns Promise<string>

    • Set this client as master for the UPS

      Parameters

      • ups: string

      Returns Promise<string>

      You probably shouldn't send this command unless you are upsmon, or a upsmon replacement.

    • get network protocol version

      Returns Promise<string>

    • Type Parameters

      Parameters

      Returns this

    • Type Parameters

      Parameters

      Returns this

    • Type Parameters

      Parameters

      Returns this

    • Type Parameters

      Parameters

      Returns this

    • Type Parameters

      Parameters

      Returns this

    • Parameters

      • Optionalevent: keyof NUTClientEvents

      Returns this

    • Type Parameters

      Parameters

      Returns this

    • allow to send custom command

      Parameters

      • cmd: string[]

        {string[]} the command to send

      • Optionaltimeout: number

        {number} timeout for this command

      Returns Promise<string>

    • Parameters

      • n: number

      Returns this

    • Enable or disable command tracking for idempotent write operations.

      When tracking is enabled, write commands (SET VAR, INSTCMD) return OK TRACKING <uuid> instead of OK. The UUID can be polled via getTracking to check the command outcome.

      Parameters

      • enabled: boolean

        true to enable tracking, false to disable

      Returns Promise<string>

      Requires NUT 2.8.0+ (protocol v1.3) on the server.

    • allow to upgrade the connection with TLS

      Parameters

      • OptionaltlsOptions: Omit<ConnectionOptions, "socket" | "host" | "port">

      Returns Promise<void>

      to check the arguments allowed

    • get server version

      Returns Promise<string>

    • Static factory method that creates a NUTClient and optionally authenticates when credentials are provided in options. Credentials are cleared from stored options after successful authentication to reduce the risk of credential leaks.

      Parameters

      • host: string

        hostname or IP address

      • Optionalport: number

        port number (default 3493)

      • Optionaloptions: INUTClientOptions

        client options including optional credentials

      Returns Promise<NUTClient>