Class Bridge

Bridge is a special type of HomeKit Accessory that hosts other Accessories "behind" it. This way you can simply publish() the Bridge (with a single HAPServer on a single port) and all bridged Accessories will be hosted automatically, instead of needed to publish() every single Accessory as a separate server.

Hierarchy (view full)

Constructors

Properties

_isBridge: boolean = false
aid: Nullable<number> = null
bridge?: Accessory
bridged: boolean = false
bridgedAccessories: Accessory[] = []
category: Categories = Categories.OTHER
displayName: string
lastKnownUsername?: string
reachable: boolean = true
services: Service[] = []
shouldPurgeUnusedIDs: boolean = true
UUID: string

Methods

  • This method is used to set up a new Controller for this accessory. See Controller for a more detailed explanation what a Controller is and what it is capable of.

    The controller can be passed as an instance of the class or as a constructor (without any necessary parameters) for a new Controller. Only one Controller of a given ControllerIdentifier can be configured for a given Accessory.

    When called, it will be checked if there are any services and persistent data the Controller (for the given ControllerIdentifier) can be restored from. Otherwise, the Controller will be created with new services.

    Parameters

    Returns void

  • Removes this Accessory from the local network Accessory object will no longer valid after invoking this method Trying to invoke publish() on the object will result undefined behavior

    Returns Promise<void>

  • Publishes this accessory on the local network for iOS clients to communicate with.

    • info.username - formatted as a MAC address, like CC:22:3D:E3:CE:F6, of this accessory. Must be globally unique from all Accessories on your local network.
    • info.pincode - the 8-digit pin code for clients to use when pairing this Accessory. Must be formatted as a string like 031-45-154.
    • info.category - one of the values of the Accessory.Category enum, like Accessory.Category.SWITCH. This is a hint to iOS clients about what "type" of Accessory this represents, so that for instance an appropriate icon can be drawn for the user while adding a new Accessory.

    Parameters

    • info: PublishInfo

      Required info for publishing.

    • OptionalallowInsecureRequest: boolean

      Will allow unencrypted and unauthenticated access to the http server

    Returns Promise<void>

  • Manually purge the unused ids if you like, comes handy when you have disabled auto purge, so you can do it manually

    Returns void

  • This method will remove a given Controller from this accessory. The controller object will be restored to its initial state. This also means that any event handlers setup for the controller will be removed.

    Parameters

    Returns void