Back to Homebridge

Interface PlatformAccessory<T>

docs/interfaces/PlatformAccessory.html

2.0.25.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;
emit: (event: "identify") => boolean;
on: (event: "identify", listener: () => void) => this;
services: Service[];
UUID: string;
addService(service: Service): Service;
addService<S extends typeof Service>(
serviceConstructor: S,
...constructorArgs: ConstructorArgs<S>,
): Service;
configureController(
controller: Controller<ControllerServiceMap> | ControllerConstructor,
): void;
getService<T extends WithUUID<typeof Service>>(
name: string | T,
): Service | undefined;
getServiceById<T extends WithUUID<typeof Service>>(
uuid: string | T,
subType: string,
): Service | undefined;
removeController(controller: Controller): void;
removeService(service: Service): void;
updateDisplayName(name: string): void;
}

Type Parameters

Hierarchy

  • EventEmitter
    • PlatformAccessory

Index

Properties

_associatedHAPAccessory_associatedPlatform?_associatedPlugin?categorycontextdisplayNameemitonservicesUUID

Methods

addServiceconfigureControllergetServicegetServiceByIdremoveControllerremoveServiceupdateDisplayName

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

emit

emit: (event: "identify") => boolean

on

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

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

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

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

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

Settings

Member Visibility

  • Inherited

ThemeOSLightDark

On This Page

Properties _associatedHAPAccessory_associatedPlatform_associatedPlugincategorycontextdisplayNameemitonservicesUUID Methods addServiceconfigureControllergetServicegetServiceByIdremoveControllerremoveServiceupdateDisplayName