Class SwitchBotBLE

SwitchBotBLE class to interact with SwitchBot devices.

Hierarchy

  • EventEmitter
    • SwitchBotBLE

Constructors

Properties

noble: any
onadvertisement?: onadvertisement
ondiscover?: ondiscover
ready: Promise<void>

Methods

  • Emits a log event with the specified log level and message.

    Parameters

    • level: string

      The severity level of the log (e.g., 'info', 'warn', 'error').

    • message: string

      The log message to be emitted.

    Returns Promise<void>

  • Starts scanning for SwitchBot devices.

    Parameters

    • Optionalparams: Params = {}

      Optional parameters.

    Returns Promise<void>

    • Resolves when scanning starts successfully.
  • Stops scanning for SwitchBot devices.

    Returns Promise<void>

    • Resolves when scanning stops successfully.
  • Validates the parameters.

    Parameters

    • params: Params

      The parameters to validate.

    • schema: Record<string, unknown>

      The schema to validate against.

    Returns Promise<void>

    • Resolves if parameters are valid, otherwise throws an error.
  • Waits for the specified time.

    Parameters

    • msec: number

      The time to wait in milliseconds.

    Returns Promise<void>

    • Resolves after the specified time.