Base class for all devices. This class should be extended by all devices.

Hierarchy (view full)

Constructors

Properties

commandHandler: NamedHandler<any> = ...

One or multiple DeviceTypeDefinitions of the endpoint

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>

  • 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

  • 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

  • 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