Device class for an OnOffPluginUnit Device

Hierarchy (view full)

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

  • 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