Back to Homebridge

Interface PlatformAccessory<T>

docs/interfaces/PlatformAccessory.html

1.11.47.5 KB
Original Source
  • PlatformAccessory

Interface PlatformAccessory<T>

Export Platform Accessory Types

interface PlatformAccessory<T extends UnknownContext = UnknownContext> {
_associatedHAPAccessory: Accessory;
_associatedPlatform?: string;
_associatedPlugin?: string;
category: Categories;
context: T;
displayName: string;
reachable: boolean;
services: Service[];
UUID: string;
addService(service: Service): Service;
addService<S extends typeof Service>(
serviceConstructor: S,
...constructorArgs: ConstructorArgs<S>,
): Service;
configureCameraSource(cameraSource: LegacyCameraSource): CameraController;
configureController(
controller: Controller<ControllerServiceMap> | ControllerConstructor,
): void;
emit(event: "identify"): boolean;
getService<T extends WithUUID<typeof Service>>(
name: string | T,
): Service | undefined;
getServiceById<T extends WithUUID<typeof Service>>(
uuid: string | T,
subType: string,
): Service | undefined;
getServiceByUUIDAndSubType<T extends WithUUID<typeof Service>>(
uuid: string | T,
subType: string,
): Service | undefined;
on(event: "identify", listener: () => void): this;
removeController(controller: Controller): void;
removeService(service: Service): void;
updateDisplayName(name: string): void;
updateReachability(reachable: boolean): void;
}

Type Parameters

Hierarchy

  • EventEmitter
    • PlatformAccessory

Index

Properties

_associatedHAPAccessory_associatedPlatform?_associatedPlugin?categorycontextdisplayNamereachableservicesUUID

Methods

addServiceconfigureCameraSourceconfigureControlleremitgetServicegetServiceByIdgetServiceByUUIDAndSubTypeonremoveControllerremoveServiceupdateDisplayNameupdateReachability

Properties

_associatedHAPAccessory

_associatedHAPAccessory: Accessory

Optional_associatedPlatform

_associatedPlatform?: string

Optional_associatedPlugin

_associatedPlugin?: string

category

category: Categories

context

context: T = ...

This is a way for Plugin developers to store custom data with their accessory

displayName

displayName: string

reachable

reachable: boolean = false

Deprecated

reachability has no effect and isn't supported anymore

services

services: Service[] = []

UUID

UUID: string

Methods

addService

addService(service: Service): Service

Parameters

  • service: Service

Returns Service

addService<S extends typeof Service>(
serviceConstructor: S,
...constructorArgs: ConstructorArgs<S>,
): Service

Type Parameters

  • S extends typeof Service

Parameters

  • serviceConstructor: S
  • ...constructorArgs: ConstructorArgs<S>

Returns Service

configureCameraSource

configureCameraSource(cameraSource: LegacyCameraSource): CameraController

Parameters

  • cameraSource: LegacyCameraSource

Returns CameraController

Deprecated

see Accessory.configureCameraSource

configureController

configureController(
controller: Controller<ControllerServiceMap> | ControllerConstructor,
): void

Configures a new controller for the given accessory. See Accessory.configureController.

Parameters

  • controller: Controller<ControllerServiceMap> | ControllerConstructor

Returns void

emit

emit(event: "identify"): boolean

Parameters

  • event: "identify"

Returns boolean

getService

getService<T extends WithUUID<typeof Service>>(
name: string | T,
): Service | undefined

Type Parameters

  • T extends WithUUID<typeof Service>

Parameters

  • name: string | T

Returns Service | undefined

getServiceById

getServiceById<T extends WithUUID<typeof Service>>(
uuid: string | T,
subType: string,
): Service | undefined

Type Parameters

  • T extends WithUUID<typeof Service>

Parameters

  • uuid: string | T
  • subType: string

Returns Service | undefined

getServiceByUUIDAndSubType

getServiceByUUIDAndSubType<T extends WithUUID<typeof Service>>(
uuid: string | T,
subType: string,
): Service | undefined

Type Parameters

  • T extends WithUUID<typeof Service>

Parameters

  • uuid: string | T
  • subType: string

Returns Service | undefined

Deprecated

use getServiceById directly

on

on(event: "identify", listener: () => void): this

Parameters

  • event: "identify"
  • listener: () => void

Returns this

removeController

removeController(controller: Controller): void

Removes a configured controller from the given accessory. See Accessory.removeController.

Parameters

  • controller: Controller

Returns void

removeService

removeService(service: Service): void

Parameters

  • service: Service

Returns void

updateDisplayName

updateDisplayName(name: string): void

Parameters

  • name: string

Returns void

updateReachability

updateReachability(reachable: boolean): void

Parameters

  • reachable: boolean

Returns void

Deprecated

reachability has no effect and isn't supported anymore

Settings

Member Visibility

  • Inherited

ThemeOSLightDark

On This Page

Properties _associatedHAPAccessory_associatedPlatform_associatedPlugincategorycontextdisplayNamereachableservicesUUID Methods addServiceconfigureCameraSourceconfigureControlleremitgetServicegetServiceByIdgetServiceByUUIDAndSubTypeonremoveControllerremoveServiceupdateDisplayNameupdateReachability