Abstract Base class for OnOff devices

Hierarchy (view full)

  • Device<this> & {
        _executeHandler<K>(action: K, ...args: Parameters<OnOffBaseDeviceCommands[K]>): Promise<void>;
        addCommandHandler<K>(action: K, handler: OnOffBaseDeviceCommands[K]): void;
        removeCommandHandler<K>(action: K, handler: OnOffBaseDeviceCommands[K]): void;
    }

Constructors

Properties

commandHandler: NamedHandler<any> = ...

One or multiple DeviceTypeDefinitions of the endpoint

isLighting: boolean = false

Define if Lighting feature is set

name: string = ""
number: undefined | EndpointNumber
uniqueStorageKey: undefined | string

Accessors

Methods

  • Protected

    Execute a command handler. Should only be used internally, but cannot be declared as protected officially because needed public for derived classes.

    Parameters

    • command: never

      Command name to execute the handler for

    • Rest...args: any[]

      Arguments to be passed to the handler

    Returns Promise<any>

  • Type Parameters

    • K extends keyof OnOffBaseDeviceCommands

    Parameters

    • action: K
    • Rest...args: Parameters<OnOffBaseDeviceCommands[K]>

    Returns Promise<void>

  • Method to add command handlers to the device. The base class do not expose any commands!

    Parameters

    • command: never

      Command name to add a handler for

    • handler: HandlerFunction

      Handler function to be executed when the command is received

    Returns void

  • Type Parameters

    • K extends keyof OnOffBaseDeviceCommands

    Parameters

    • action: K
    • handler: OnOffBaseDeviceCommands[K]

    Returns void

  • Parameters

    • label: string
    • value: string

    Returns void

  • Adds a listener for the OnOff attribute This is an example of a convenient device class API to control the device without need to access clusters

    Parameters

    • listener: ((newValue: boolean, oldValue: boolean) => void)

      Listener function to be called when the attribute changes

        • (newValue, oldValue): void
        • Parameters

          • newValue: boolean
          • oldValue: boolean

          Returns void

    Returns void

  • Parameters

    • label: string
    • value: string

    Returns void

  • Returns undefined | string

  • Method to remove command handlers from the device. The base class do not expose any commands!

    Parameters

    • command: never

      Command name to remove the handler from

    • handler: HandlerFunction

      Handler function to be removed

    Returns void

  • Type Parameters

    • K extends keyof OnOffBaseDeviceCommands

    Parameters

    • action: K
    • handler: OnOffBaseDeviceCommands[K]

    Returns void

  • Set the reachability of the device exposed via the bridge. If this is a device inside a composed device the reachability needs to be set there.

    Parameters

    • reachable: boolean

      true if reachable, false otherwise

    Returns void

  • Turns the device on or off This is an example f a convenient device class API to control the device without need to access clusters

    Parameters

    • onOff: boolean

      true to turn on, false to turn off

    Returns void

  • Parameters

    • callback: (() => void)
        • (): void
        • Returns void

    Returns void