hap-nodejs
- Version 1.1.0
- Published
- 2.35 MB
- 10 dependencies
- Apache-2.0 license
Install
npm i hap-nodejs
yarn add hap-nodejs
pnpm add hap-nodejs
Overview
HAP-NodeJS is a Node.js implementation of HomeKit Accessory Server.
Index
Functions
- clone()
- decode()
- decodeList()
- decodeWithLists()
- encode()
- epochMillisFromMillisSince2001_01_01()
- epochMillisFromMillisSince2001_01_01Buffer()
- HAPLibraryVersion()
- IsKnownHAPStatusError()
- isSerializableController()
- once()
- readUInt16()
- readUInt32()
- readUInt64LE()
- readVariableUIntLE()
- writeFloat32LE()
- writeUInt16()
- writeUInt32()
- writeVariableUIntLE()
Classes
Accessory
- addBridgedAccessories()
- addBridgedAccessory()
- addService()
- aid
- bridge
- bridged
- bridgedAccessories
- category
- cleanupAccessoryData()
- configureController()
- controllerStorage
- deserialize()
- destroy()
- disableUnusedIDPurge()
- displayName
- enableUnusedIDPurge()
- findCharacteristic()
- getAccessoryByAID()
- getPrimaryAccessory
- getService()
- getServiceById()
- lastKnownUsername
- publish()
- purgeUnusedIDs()
- reachable
- removeAllBridgedAccessories()
- removeBridgedAccessories()
- removeBridgedAccessory()
- removeController()
- removeService()
- serialize()
- services
- setupURI()
- shouldPurgeUnusedIDs
- unpublish()
- UUID
AccessoryInfo
- addPairedClient()
- assertValidUsername()
- category
- checkForCurrentConfigurationNumberIncrement()
- create()
- deviceIdPattern
- displayName
- getClientPublicKey()
- getConfigVersion()
- hasAdminPermissions()
- isPaired()
- listPairings()
- load()
- model
- paired
- pairedAdminClients
- pairedClients
- persistKey()
- pincode
- remove()
- removePairedClient()
- save()
- setupID
- signPk
- signSk
- updatePermission()
- username
AdaptiveLightingController
- configureServices()
- constructServices()
- controllerId()
- deserialize()
- disableAdaptiveLighting()
- getAdaptiveLightingBrightnessMultiplierRange()
- getAdaptiveLightingNotifyIntervalThreshold()
- getAdaptiveLightingStartTimeOfTransition()
- getAdaptiveLightingTimeOffset()
- getAdaptiveLightingTransitionCurve()
- getAdaptiveLightingUpdateInterval()
- getCurrentAdaptiveLightingTransitionPoint()
- handleControllerRemoved()
- handleFactoryReset()
- initWithServices()
- isAdaptiveLightingActive()
- serialize()
- setupStateChangeDelegate()
CameraController
- configureServices()
- constructServices()
- controllerId()
- deserialize()
- forceStopStreamingSession()
- generateSynchronisationSource()
- handleControllerRemoved()
- handleFactoryReset()
- handleSnapshotRequest()
- initWithServices()
- migrateFromDoorbell()
- motionService
- occupancyService
- recordingManagement
- retrieveEventTriggerOptions()
- serialize()
- setMicrophoneMuted()
- setMicrophoneVolume()
- setSpeakerMuted()
- setSpeakerVolume()
- setupStateChangeDelegate()
- streamManagements
Characteristic
- AccessCodeControlPoint
- AccessCodeSupportedConfiguration
- AccessControlLevel
- AccessoryFlags
- AccessoryIdentifier
- Active
- ActiveIdentifier
- ActivityInterval
- additionalAuthorizationHandler
- AdministratorOnlyAccess
- AirParticulateDensity
- AirParticulateSize
- AirPlayEnable
- AirQuality
- AppMatchingIdentifier
- AssetUpdateReadiness
- AudioFeedback
- BatteryLevel
- Brightness
- ButtonEvent
- CameraOperatingModeIndicator
- CarbonDioxideDetected
- CarbonDioxideLevel
- CarbonDioxidePeakLevel
- CarbonMonoxideDetected
- CarbonMonoxideLevel
- CarbonMonoxidePeakLevel
- CCAEnergyDetectThreshold
- CCASignalDetectThreshold
- CharacteristicValueActiveTransitionCount
- CharacteristicValueTransitionControl
- ChargingState
- ClosedCaptions
- ColorTemperature
- ConfigurationState
- ConfiguredName
- ContactSensorState
- CoolingThresholdTemperature
- CryptoHash
- CurrentAirPurifierState
- CurrentAmbientLightLevel
- CurrentDoorState
- CurrentFanState
- CurrentHeaterCoolerState
- CurrentHeatingCoolingState
- CurrentHorizontalTiltAngle
- CurrentHumidifierDehumidifierState
- CurrentMediaState
- CurrentPosition
- CurrentRelativeHumidity
- CurrentSlatState
- CurrentTemperature
- CurrentTiltAngle
- CurrentTransport
- CurrentVerticalTiltAngle
- CurrentVisibilityState
- DataStreamHAPTransport
- DataStreamHAPTransportInterrupt
- deserialize()
- DiagonalFieldOfView
- DigitalZoom
- displayName
- DisplayOrder
- EventRetransmissionMaximum
- EventSnapshotsActive
- EventTransmissionCounters
- FilterChangeIndication
- FilterLifeLevel
- FirmwareRevision
- FirmwareUpdateReadiness
- FirmwareUpdateStatus
- getDefaultValue()
- handleGetRequest()
- handleSetRequest()
- HardwareFinish
- HardwareRevision
- HeartBeat
- HeatingThresholdTemperature
- HoldPosition
- HomeKitCameraActive
- Hue
- Identifier
- Identify
- iid
- ImageMirroring
- ImageRotation
- InputDeviceType
- InputSourceType
- internalHAPRepresentation()
- InUse
- IsConfigured
- LeakDetected
- ListPairings
- LockControlPoint
- LockCurrentState
- LockLastKnownAction
- LockManagementAutoSecurityTimeout
- LockPhysicalControls
- LockTargetState
- Logs
- MACRetransmissionMaximum
- MACTransmissionCounters
- ManagedNetworkEnable
- ManuallyDisabled
- Manufacturer
- MaximumTransmitPower
- MetricsBufferFullState
- Model
- MotionDetected
- MultifunctionButton
- Mute
- Name
- NetworkAccessViolationControl
- NetworkClientProfileControl
- NetworkClientStatusControl
- NFCAccessControlPoint
- NFCAccessSupportedConfiguration
- NightVision
- NitrogenDioxideDensity
- ObstructionDetected
- OccupancyDetected
- On
- onGet()
- onSet()
- OperatingStateResponse
- OpticalZoom
- OutletInUse
- OzoneDensity
- PairingFeatures
- PairSetup
- PairVerify
- PasswordSetting
- PeriodicSnapshotsActive
- PictureMode
- Ping
- PM10Density
- PM2_5Density
- PositionState
- PowerModeSelection
- ProductData
- ProgrammableSwitchEvent
- ProgrammableSwitchOutputState
- ProgramMode
- props
- ReceivedSignalStrengthIndication
- ReceiverSensitivity
- RecordingAudioActive
- RelativeHumidityDehumidifierThreshold
- RelativeHumidityHumidifierThreshold
- RelayControlPoint
- RelayEnabled
- RelayState
- RemainingDuration
- RemoteKey
- removeAllListeners()
- removeOnGet()
- removeOnSet()
- replaceBy()
- ResetFilterIndication
- RotationDirection
- RotationSpeed
- RouterStatus
- Saturation
- SecuritySystemAlarmType
- SecuritySystemCurrentState
- SecuritySystemTargetState
- SelectedAudioStreamConfiguration
- SelectedCameraRecordingConfiguration
- SelectedDiagnosticsModes
- SelectedRTPStreamConfiguration
- SelectedSleepConfiguration
- sendEventNotification()
- serialize()
- SerialNumber
- ServiceLabelIndex
- ServiceLabelNamespace
- SetDuration
- setProps()
- setupAdditionalAuthorization()
- SetupDataStreamTransport
- SetupEndpoints
- SetupTransferTransport
- setValue()
- SignalToNoiseRatio
- SiriEnable
- SiriEndpointSessionStatus
- SiriEngineVersion
- SiriInputType
- SiriLightOnUse
- SiriListening
- SiriTouchToUse
- SlatType
- SleepDiscoveryMode
- SleepInterval
- SmokeDetected
- SoftwareRevision
- StagedFirmwareVersion
- StatusActive
- statusCode
- StatusFault
- StatusJammed
- StatusLowBattery
- StatusTampered
- StreamingStatus
- subscribe()
- SulphurDioxideDensity
- SupportedAssetTypes
- SupportedAudioRecordingConfiguration
- SupportedAudioStreamConfiguration
- SupportedCameraRecordingConfiguration
- SupportedCharacteristicValueTransitionConfiguration
- SupportedDataStreamTransportConfiguration
- SupportedDiagnosticsModes
- SupportedDiagnosticsSnapshot
- SupportedFirmwareUpdateConfiguration
- SupportedMetrics
- SupportedRouterConfiguration
- SupportedRTPConfiguration
- SupportedSleepConfiguration
- SupportedTransferTransportConfiguration
- SupportedVideoRecordingConfiguration
- SupportedVideoStreamConfiguration
- SwingMode
- TapType
- TargetAirPurifierState
- TargetControlList
- TargetControlSupportedConfiguration
- TargetDoorState
- TargetFanState
- TargetHeaterCoolerState
- TargetHeatingCoolingState
- TargetHorizontalTiltAngle
- TargetHumidifierDehumidifierState
- TargetMediaState
- TargetPosition
- TargetRelativeHumidity
- TargetTemperature
- TargetTiltAngle
- TargetVerticalTiltAngle
- TargetVisibilityState
- TemperatureDisplayUnits
- ThirdPartyCameraActive
- ThreadControlPoint
- ThreadNodeCapabilities
- ThreadOpenThreadVersion
- ThreadStatus
- toHAP()
- Token
- TransmitPower
- TunnelConnectionTimeout
- TunneledAccessoryAdvertising
- TunneledAccessoryConnected
- TunneledAccessoryStateNumber
- unsubscribe()
- updateValue()
- UUID
- validValuesIterator()
- value
- ValveType
- Version
- VideoAnalysisActive
- VOCDensity
- Volume
- VolumeControlType
- VolumeSelector
- WakeConfiguration
- WANConfigurationList
- WANStatusList
- WaterLevel
- WiFiCapabilities
- WiFiConfigurationControl
- WiFiSatelliteStatus
DataStreamReader
- decompressData()
- finished()
- readData()
- readData_Length16LE()
- readData_Length32LE()
- readData_Length64LE()
- readData_Length8()
- readData_terminated()
- readerIndex
- readFalse()
- readFloat32LE()
- readFloat64LE()
- readInt16LE()
- readInt32LE()
- readInt64LE()
- readInt8()
- readIntRange()
- readNegOne()
- readSecondsSince2001_01_01()
- readTag()
- readTrue()
- readUTF8()
- readUTF8_Length16LE()
- readUTF8_Length32LE()
- readUTF8_Length64LE()
- readUTF8_Length8()
- readUTF8_NULL_terminated()
- readUUID()
HAPConnection
- addListener()
- clearRegisteredEvents()
- close()
- closeConnectionAsOfUnpair()
- connectionAuthenticated()
- disableEventNotifications()
- enableEventNotifications()
- encryption
- getLocalAddress()
- getRegisteredEvents()
- hasEventNotifications()
- isAuthenticated()
- lastSocketOperation
- localAddress
- networkInterface
- off()
- remoteAddress
- remotePort
- removeListener()
- sendEvent()
- server
- sessionID
- srpServer
- timedWritePid
- timedWriteTimeout
- username
RemoteController
- activeIdentifier
- configureServices()
- constructServices()
- constructSupportedAudioConfiguration()
- constructSupportedConfiguration()
- controllerId()
- deserialize()
- eventHandler
- getTargetIdentifierByName()
- handleControllerRemoved()
- handleFactoryReset()
- initWithServices()
- isActive()
- isConfigured()
- pushAndReleaseButton()
- pushButton()
- releaseButton()
- requestHandler
- serialize()
- setActiveIdentifier()
- setupStateChangeDelegate()
- targetConfigurations
RTPStreamManagement
- audioProxy
- deserialize()
- destroy()
- disableAudioProxy
- forceStop()
- getService()
- handleFactoryReset()
- requireProxy
- selectedConfiguration
- serialize()
- service
- sessionIdentifier
- setupEndpointsResponse
- setupStateChangeDelegate()
- streamStatus
- supportedAudioStreamConfiguration
- supportedCryptoSuites
- supportedRTPConfiguration
- supportedVideoStreamConfiguration
- videoOnly
- videoProxy
Service
- AccessCode
- AccessControl
- AccessoryInformation
- AccessoryMetrics
- AccessoryRuntimeInformation
- addCharacteristic()
- addLinkedService()
- addOptionalCharacteristic()
- AirPurifier
- AirQualitySensor
- AssetUpdate
- Assistant
- AudioStreamManagement
- Battery
- CameraOperatingMode
- CameraRecordingManagement
- CameraRTPStreamManagement
- CarbonDioxideSensor
- CarbonMonoxideSensor
- characteristics
- CloudRelay
- ContactSensor
- DataStreamTransportManagement
- deserialize()
- Diagnostics
- displayName
- Door
- Doorbell
- Fan
- Fanv2
- Faucet
- FilterMaintenance
- FirmwareUpdate
- GarageDoorOpener
- getCharacteristic()
- getCharacteristicByIID()
- getServiceId()
- HeaterCooler
- HumidifierDehumidifier
- HumiditySensor
- iid
- InputSource
- internalHAPRepresentation()
- IrrigationSystem
- isHiddenService
- isPrimaryService
- LeakSensor
- Lightbulb
- LightSensor
- linkedServices
- LockManagement
- LockMechanism
- Microphone
- MotionSensor
- name
- NFCAccess
- OccupancySensor
- optionalCharacteristics
- Outlet
- Pairing
- PowerManagement
- ProtocolInformation
- removeCharacteristic()
- removeLinkedService()
- replaceCharacteristicsFromService()
- SecuritySystem
- serialize()
- ServiceLabel
- setCharacteristic()
- setHiddenService()
- setPrimaryService()
- Siri
- SiriEndpoint
- Slats
- SmartSpeaker
- SmokeSensor
- Speaker
- StatefulProgrammableSwitch
- StatelessProgrammableSwitch
- subtype
- Switch
- TapManagement
- TargetControl
- TargetControlManagement
- Television
- TelevisionSpeaker
- TemperatureSensor
- testCharacteristic()
- Thermostat
- ThreadTransport
- toHAP()
- TransferTransportManagement
- Tunnel
- updateCharacteristic()
- UUID
- Valve
- WiFiRouter
- WiFiSatellite
- WiFiTransport
- Window
- WindowCovering
Interfaces
Enums
Categories
- AIR_CONDITIONER
- AIR_DEHUMIDIFIER
- AIR_HEATER
- AIR_HUMIDIFIER
- AIR_PURIFIER
- AIRPORT
- ALARM_SYSTEM
- APPLE_TV
- AUDIO_RECEIVER
- BRIDGE
- CAMERA
- DOOR
- DOOR_LOCK
- FAN
- FAUCET
- GARAGE_DOOR_OPENER
- HOMEPOD
- IP_CAMERA
- LIGHTBULB
- OTHER
- OUTLET
- PROGRAMMABLE_SWITCH
- RANGE_EXTENDER
- ROUTER
- SECURITY_SYSTEM
- SENSOR
- SHOWER_HEAD
- SPEAKER
- SPRINKLER
- SWITCH
- TARGET_CONTROLLER
- TELEVISION
- THERMOSTAT
- TV_SET_TOP_BOX
- TV_STREAMING_STICK
- VIDEO_DOORBELL
- WINDOW
- WINDOW_COVERING
DataFormatTags
- ARRAY_LENGTH_START
- ARRAY_LENGTH_STOP
- ARRAY_TERMINATED
- COMPRESSION_START
- COMPRESSION_STOP
- DATA_LENGTH_START
- DATA_LENGTH_STOP
- DATA_LENGTH16LE
- DATA_LENGTH32LE
- DATA_LENGTH64LE
- DATA_LENGTH8
- DATA_TERMINATED
- DATE
- DICTIONARY_LENGTH_START
- DICTIONARY_LENGTH_STOP
- DICTIONARY_TERMINATED
- FALSE
- FLOAT32LE
- FLOAT64LE
- INT16LE
- INT32LE
- INT64LE
- INT8
- INTEGER_MINUS_ONE
- INTEGER_RANGE_START_0
- INTEGER_RANGE_STOP_39
- INVALID
- NULL
- TERMINATOR
- TRUE
- UTF8_LENGTH_START
- UTF8_LENGTH_STOP
- UTF8_LENGTH16LE
- UTF8_LENGTH32LE
- UTF8_LENGTH64LE
- UTF8_LENGTH8
- UTF8_NULL_TERMINATED
- UUID
Type Aliases
- AccessoriesCallback
- AccessoryCharacteristicChange
- AdditionalAuthorizationHandler
- AddPairingCallback
- AudioCodecConfiguration
- AudioCodecParameters
- AudioFrame
- AudioInfo
- AudioRecordingCodec
- AudioRecordingOptions
- AudioStreamingCodec
- AudioStreamingOptions
- ButtonConfiguration
- CameraStreamingOptions
- CharacteristicChange
- CharacteristicContext
- CharacteristicGetCallback
- CharacteristicGetHandler
- CharacteristicReadData
- CharacteristicSetCallback
- CharacteristicSetHandler
- CharacteristicValue
- CharacteristicWriteData
- ConstructorArgs
- ControllerIdentifier
- ControllerType
- DataStreamMessage
- ErrorHandler
- EventHandler
- EventName
- FrameHandler
- GlobalEventHandler
- GlobalRequestHandler
- HAPHttpError
- HAPPincode
- HAPUsername
- HDSFrame
- IdentificationCallback
- IdentifyCallback
- InterfaceName
- IPAddress
- IPv4Address
- IPv6Address
- ListPairingsCallback
- MacAddress
- NodeCallback
- Nullable
- PairCallback
- PairingsCallback
- PartialAllowingNull
- PartialCharacteristicReadData
- PartialCharacteristicWriteData
- PreparedDataStreamSession
- PrepareSessionCallback
- PrepareStreamCallback
- PrepareStreamRequest
- PrepareStreamResponse
- PrepareWriteRequest
- PrimitiveTypes
- ReadCharacteristicsCallback
- ReconfiguredVideoInfo
- ReconfigureStreamRequest
- RemovePairingCallback
- RequestHandler
- Resolution
- ResourceRequestCallback
- ResponseHandler
- RTPTime
- SerializedServiceMap
- ServiceCharacteristicChange
- ServiceId
- SessionIdentifier
- SnapshotRequest
- SnapshotRequestCallback
- Source
- StartStreamRequest
- StateChangeDelegate
- StopStreamRequest
- StreamingRequest
- StreamRequestCallback
- StreamSessionIdentifier
- SupportedButtonConfiguration
- SupportedConfiguration
- TargetConfiguration
- TLVEncodable
- VideoInfo
- VideoStreamingOptions
- VoidCallback
- WithUUID
- WriteCharacteristicsCallback
Namespaces
LegacyTypes
- ACCESSORY_INFORMATION_STYPE
- ADMIN_ONLY_ACCESS_CTYPE
- ALARM_CURRENT_STATE_CTYPE
- ALARM_STYPE
- ALARM_SYSTEM_TCTYPE
- ALARM_TARGET_STATE_CTYPE
- AUDIO_FEEDBACK_CTYPE
- BATTERY_LEVEL_CTYPE
- BRIGHTNESS_CTYPE
- CONTACT_SENSOR_STATE_CTYPE
- CONTACT_SENSOR_STYPE
- COOLING_THRESHOLD_CTYPE
- CURRENT_DOOR_STATE_CTYPE
- CURRENT_LOCK_MECHANISM_STATE_CTYPE
- CURRENT_RELATIVE_HUMIDITY_CTYPE
- CURRENT_TEMPERATURE_CTYPE
- CURRENTHEATINGCOOLING_CTYPE
- DOOR_LOCK_TCTYPE
- DOOR_TCTYPE
- FAN_STYPE
- FAN_TCTYPE
- FIRMWARE_REVISION_CTYPE
- GARAGE_DOOR_OPENER_STYPE
- GARAGE_DOOR_OPENER_TCTYPE
- HEATING_THRESHOLD_CTYPE
- HUE_CTYPE
- HUMIDITY_SENSOR_STYPE
- IDENTIFY_CTYPE
- LIGHTBULB_STYPE
- LIGHTBULB_TCTYPE
- LOCK_MANAGEMENT_AUTO_SECURE_TIMEOUT_CTYPE
- LOCK_MANAGEMENT_CONTROL_POINT_CTYPE
- LOCK_MANAGEMENT_STYPE
- LOCK_MECHANISM_LAST_KNOWN_ACTION_CTYPE
- LOCK_MECHANISM_STYPE
- LOGS_CTYPE
- MANUFACTURER_CTYPE
- MODEL_CTYPE
- MOTION_DETECTED_CTYPE
- MOTION_SENSOR_STYPE
- NAME_CTYPE
- OBSTRUCTION_DETECTED_CTYPE
- OCCUPANCY_DETECTED_CTYPE
- OCCUPANCY_SENSOR_STYPE
- OTHER_TCTYPE
- OUTLET_IN_USE_CTYPE
- OUTLET_STYPE
- OUTLET_TCTYPE
- POWER_STATE_CTYPE
- PROGRAMMABLE_SWITCH_OUTPUT_STATE_CTYPE
- PROGRAMMABLE_SWITCH_SWITCH_EVENT_CTYPE
- PROGRAMMABLE_SWITCH_TCTYPE
- ROTATION_DIRECTION_CTYPE
- ROTATION_SPEED_CTYPE
- SATURATION_CTYPE
- SENSOR_TCTYPE
- SERIAL_NUMBER_CTYPE
- STATUS_FAULT_CTYPE
- STATUS_LOW_BATTERY_CTYPE
- SWITCH_STYPE
- SWITCH_TCTYPE
- TARGET_DOORSTATE_CTYPE
- TARGET_LOCK_MECHANISM_STATE_CTYPE
- TARGET_RELATIVE_HUMIDITY_CTYPE
- TARGET_TEMPERATURE_CTYPE
- TARGETHEATINGCOOLING_CTYPE
- TEMPERATURE_SENSOR_STYPE
- TEMPERATURE_UNITS_CTYPE
- THERMOSTAT_STYPE
- THERMOSTAT_TCTYPE
- VERSION_CTYPE
- WINDOW_COVERING_CURRENT_POSITION_CTYPE
- WINDOW_COVERING_OPERATION_STATE_CTYPE
- WINDOW_COVERING_STYPE
- WINDOW_COVERING_TARGET_POSITION_CTYPE
- WINDOW_COVERING_TCTYPE
- WINDOW_TCTYPE
Functions
function clone
clone: <T extends object, U>(object: T, extend?: U) => T & U;
A simple clone function that also allows you to pass an "extend" object whose properties will be added to the cloned copy of the original object passed. Utils
function decode
decode: (buffer: Buffer) => Record<number, Buffer>;
This method is the legacy way of decoding tlv data. It will not properly decode multiple list of the same id. Should the decoder encounter multiple instances of the same id, it will just concatenate the buffer data.
Parameter buffer
TLV8 data
Note: Please use decodeWithLists which properly decodes list elements.
TLV8
function decodeList
decodeList: (data: Buffer, entryStartId: number) => Record<number, Buffer>[];
This method can be used to parse a TLV8 encoded list that was concatenated.
If you are thinking about using this method, try to refactor the code to use decodeWithLists instead of decode. The single reason of this method's existence are the shortcomings decode, as it concatenates multiple tlv8 list entries into a single Buffer. This method can be used to undo that, by specifying the concatenated buffer and the tlv id of the element that should mark the beginning of a new tlv8 list entry.
Parameter data
The concatenated tlv8 list entries (probably output of decode).
Parameter entryStartId
The tlv id that marks the beginning of a new tlv8 entry.
TLV8
function decodeWithLists
decodeWithLists: (buffer: Buffer) => Record<number, Buffer | Buffer[]>;
Decode a buffer coding TLV8 encoded entries.
This method decodes multiple entries split by a TLV delimiter properly into Buffer arrays. It properly reassembles tlv entries if they were split across multiple entries due to exceeding the max tlv entry size of 255 bytes.
Parameter buffer
The Buffer containing TLV8 encoded data.
TLV8
function encode
encode: ( type: number, data: TLVEncodable | TLVEncodable[], ...args: any[]) => Buffer;
TLV8
function epochMillisFromMillisSince2001_01_01
epochMillisFromMillisSince2001_01_01: (millis: number) => number;
Utils
function epochMillisFromMillisSince2001_01_01Buffer
epochMillisFromMillisSince2001_01_01Buffer: (millis: Buffer) => number;
Utils
function HAPLibraryVersion
HAPLibraryVersion: () => string;
This method can be used to retrieve the current running library version of the HAP-NodeJS framework.
Returns
The SemVer version string.
Utils
function IsKnownHAPStatusError
IsKnownHAPStatusError: (status: HAPStatus) => boolean;
Determines if the given status code is a known HAPStatus error code.
HAP Accessory Server
function isSerializableController
isSerializableController: ( controller: Controller) => controller is SerializableController<ControllerServiceMap, any>;
Parameter controller
Controller API
function once
once: <T extends Function>(func: T) => T;
Function wrapper to ensure a function/callback is only called once.
Utils
function readUInt16
readUInt16: (buffer: Buffer) => number;
readUInt16LE
TLV8
function readUInt32
readUInt32: (buffer: Buffer) => number;
readUInt32LE
TLV8
function readUInt64LE
readUInt64LE: (buffer: Buffer, offset?: number) => number;
TLV8
function readVariableUIntLE
readVariableUIntLE: (buffer: Buffer) => number;
Reads variable size unsigned integer writeVariableUIntLE.
Parameter buffer
The buffer to read from. It must have exactly the size of the given integer. TLV8
function writeFloat32LE
writeFloat32LE: (value: number) => Buffer;
TLV8
function writeUInt16
writeUInt16: (value: number) => Buffer;
writeUInt16LE
TLV8
function writeUInt32
writeUInt32: (value: number) => Buffer;
writeUint32LE
TLV8
function writeVariableUIntLE
writeVariableUIntLE: (number: number) => Buffer;
Writes variable size unsigned integer. Either: -
UInt8
-UInt16LE
-UInt32LE
Parameter number
TLV8
Classes
class AccessControlManagement
class AccessControlManagement extends EventEmitter {}
Television
constructor
constructor(password?: boolean);
Instantiates a new AccessControlManagement.
Parameter password
if set to true the service will listen for password settings
constructor
constructor(password?: boolean, service?: AccessControl);
Instantiates a new AccessControlManagement.
Parameter password
if set to true the service will listen for password settings
Parameter service
supply your own instance to sideload the AccessControl service
method destroy
destroy: () => void;
This destroys the AccessControlManagement. It unregisters all GET or SET handler it has associated with the given AccessControl service. It removes all event handlers which were registered to this object.
method getAccessLevel
getAccessLevel: () => AccessLevel;
Returns
the current AccessLevel configured for the Home
method getPassword
getPassword: () => string | undefined;
Returns
the current password configured for the Home or
undefined
if no password is required.
method getService
getService: () => AccessControl;
Returns
the AccessControl service
class Accessory
class Accessory extends EventEmitter {}
Accessory is a virtual HomeKit device. It can publish an associated HAP server for iOS devices to communicate with - or it can run behind another "Bridge" Accessory server.
Bridged Accessories in this implementation must have a UUID that is unique among all other Accessories that are hosted by the Bridge. This UUID must be "stable" and unchanging, even when the server is restarted. This is required so that the Bridge can provide consistent "Accessory IDs" (aid) and "Instance IDs" (iid) for all Accessories, Services, and Characteristics for iOS clients to reference later.
Accessory
constructor
constructor(displayName: string, UUID: string);
property aid
aid: number;
property bridge
bridge?: Accessory;
property bridged
bridged: boolean;
property bridgedAccessories
bridgedAccessories: Accessory[];
property category
category: Categories;
property controllerStorage
controllerStorage: ControllerStorage;
Private API.
property displayName
displayName: string;
property getPrimaryAccessory
getPrimaryAccessory: () => Accessory;
Returns the bridging accessory if this accessory is bridged. Otherwise, returns itself.
Returns
the primary accessory
property lastKnownUsername
lastKnownUsername?: string;
property reachable
reachable: boolean;
property services
services: Service[];
property shouldPurgeUnusedIDs
shouldPurgeUnusedIDs: boolean;
property UUID
UUID: string;
method addBridgedAccessories
addBridgedAccessories: (accessories: Accessory[]) => void;
method addBridgedAccessory
addBridgedAccessory: (accessory: Accessory, deferUpdate?: boolean) => Accessory;
method addService
addService: { (service: Service): Service; <S extends typeof Service>( serviceConstructor: S, ...constructorArgs: ConstructorArgs<S> ): Service;};
Add the given service instance to the Accessory.
Parameter service
A Service instance.
Returns
Returns the service instance passed to the method call.
Adds a given service by calling the provided Service constructor with the provided constructor arguments.
Parameter serviceConstructor
A Service service constructor (e.g. Service.Switch).
Parameter constructorArgs
The arguments passed to the given constructor.
Returns
Returns the constructed service instance.
method cleanupAccessoryData
static cleanupAccessoryData: (username: MacAddress) => void;
method configureController
configureController: ( controllerConstructor: Controller | ControllerConstructor) => void;
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.
Parameter controllerConstructor
The Controller instance or constructor to the Controller with no required arguments.
method deserialize
static deserialize: (json: SerializedAccessory) => Accessory;
method destroy
destroy: () => Promise<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
method disableUnusedIDPurge
disableUnusedIDPurge: () => void;
method enableUnusedIDPurge
enableUnusedIDPurge: () => void;
method findCharacteristic
protected findCharacteristic: ( aid: number, iid: number) => Characteristic | undefined;
method getAccessoryByAID
protected getAccessoryByAID: (aid: number) => Accessory | undefined;
method getService
getService: <T extends WithUUID<typeof Service>>( name: string | T) => Service | undefined;
method getServiceById
getServiceById: <T extends WithUUID<typeof Service>>( uuid: string | T, subType: string) => Service | undefined;
method publish
publish: (info: PublishInfo, allowInsecureRequest?: boolean) => Promise<void>;
Publishes this accessory on the local network for iOS clients to communicate with. -
info.username
- formatted as a MAC address, likeCC: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 like031-45-154
. -info.category
- one of the values of theAccessory.Category
enum, likeAccessory.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.Parameter info
Required info for publishing.
Parameter allowInsecureRequest
Will allow unencrypted and unauthenticated access to the http server
method purgeUnusedIDs
purgeUnusedIDs: () => void;
Manually purge the unused ids if you like, comes handy when you have disabled auto purge, so you can do it manually
method removeAllBridgedAccessories
removeAllBridgedAccessories: () => void;
method removeBridgedAccessories
removeBridgedAccessories: (accessories: Accessory[]) => void;
method removeBridgedAccessory
removeBridgedAccessory: (accessory: Accessory, deferUpdate?: boolean) => void;
method removeController
removeController: (controller: Controller) => 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.
Parameter controller
The controller which should be removed from the accessory.
method removeService
removeService: (service: Service) => void;
method serialize
static serialize: (accessory: Accessory) => SerializedAccessory;
method setupURI
setupURI: () => string;
method unpublish
unpublish: () => Promise<void>;
class AccessoryInfo
class AccessoryInfo {}
AccessoryInfo is a model class containing a subset of Accessory data relevant to the internal HAP server, such as encryption keys and username. It is persisted to disk. Model
property category
category: Categories;
property deviceIdPattern
static readonly deviceIdPattern: RegExp;
property displayName
displayName: string;
property model
model: string;
property paired
paired: () => boolean;
property pairedAdminClients
pairedAdminClients: number;
property pairedClients
pairedClients: Record<string, PairingInformation>;
property pincode
pincode: string;
property setupID
setupID: string;
property signPk
signPk: Buffer;
property signSk
signSk: Buffer;
property username
username: string;
method addPairedClient
addPairedClient: ( username: HAPUsername, publicKey: Buffer, permission: PermissionTypes) => void;
Add a paired client to memory.
Parameter username
Parameter publicKey
Parameter permission
method assertValidUsername
static assertValidUsername: (username: MacAddress) => void;
method checkForCurrentConfigurationNumberIncrement
checkForCurrentConfigurationNumberIncrement: ( configuration: AccessoryJsonObject[], checkFirmwareIncrement?: boolean) => boolean;
Checks based on the current accessory configuration if the current configuration number needs to be incremented. Additionally, if desired, it checks if the firmware version was incremented (aka the HAP-NodeJS) version did grow.
Parameter configuration
The current accessory configuration.
Parameter checkFirmwareIncrement
Returns
True if the current configuration number was incremented and thus a new TXT must be advertised.
method create
static create: (username: MacAddress) => AccessoryInfo;
method getClientPublicKey
getClientPublicKey: (username: HAPUsername) => Buffer | undefined;
method getConfigVersion
getConfigVersion: () => number;
method hasAdminPermissions
hasAdminPermissions: (username: HAPUsername) => boolean;
method isPaired
isPaired: (username: HAPUsername) => boolean;
Check if username is paired
Parameter username
method listPairings
listPairings: () => PairingInformation[];
method load
static load: (username: MacAddress) => AccessoryInfo | null;
method persistKey
static persistKey: (username: MacAddress) => string;
method remove
static remove: (username: MacAddress) => void;
method removePairedClient
removePairedClient: (connection: HAPConnection, username: HAPUsername) => void;
Remove a paired client from memory.
Parameter connection
the session of the connection initiated the removal of the pairing
Parameter username
method save
save: () => void;
method updatePermission
updatePermission: (username: HAPUsername, permission: PermissionTypes) => void;
class AdaptiveLightingController
class AdaptiveLightingController extends EventEmitter implements SerializableController< ControllerServiceMap, SerializedAdaptiveLightingControllerState > {}
This class allows adding Adaptive Lighting support to Lightbulb services. The Lightbulb service MUST have the Characteristic.ColorTemperature characteristic AND the Characteristic.Brightness characteristic added. The light may also expose Characteristic.Hue and Characteristic.Saturation characteristics (though additional work is required to keep them in sync with the color temperature characteristic. see below)
How Adaptive Lighting works: When enabling AdaptiveLighting the iDevice will send a transition schedule for the next 24 hours. This schedule will be renewed all 24 hours by a HomeHub in your home (updating the schedule according to your current day/night situation). Once enabled the lightbulb will execute the provided transitions. The color temperature value set is always dependent on the current brightness value. Meaning brighter light will be colder and darker light will be warmer. HomeKit considers Adaptive Lighting to be disabled as soon a write happens to either the Hue/Saturation or the ColorTemperature characteristics. The AdaptiveLighting state must persist across reboots.
The AdaptiveLightingController can be operated in two modes: AdaptiveLightingControllerMode.AUTOMATIC and AdaptiveLightingControllerMode.MANUAL with AUTOMATIC being the default. The goal would be that the color transition is done DIRECTLY on the light itself, thus not creating any additional/heavy traffic on the network. So if your light hardware/API supports transitions please go the extra mile and use MANUAL mode.
Below is an overview what you need to or consider when enabling AdaptiveLighting (categorized by mode). The AdaptiveLightingControllerMode can be defined with the second constructor argument.
AUTOMATIC (Default mode):
This is the easiest mode to setup and needs less to no work form your side for AdaptiveLighting to work. The AdaptiveLightingController will go through setup procedure with HomeKit and automatically update the color temperature characteristic base on the current transition schedule. It is also adjusting the color temperature when a write to the brightness characteristic happens. Additionally, it will also handle turning off AdaptiveLighting, when it detects a write happening to the ColorTemperature, Hue or Saturation characteristic (though it can only detect writes coming from HomeKit and can't detect changes done to the physical devices directly! See below).
So what do you need to consider in automatic mode: - Brightness and ColorTemperature characteristics MUST be set up. Hue and Saturation may be added for color support. - Color temperature will be updated all 60 seconds by calling the SET handler of the ColorTemperature characteristic. So every transition behaves like a regular write to the ColorTemperature characteristic. - Every transition step is dependent on the current brightness value. Try to keep the internal cache updated as the controller won't call the GET handler every 60 seconds. (The cached brightness value is updated on SET/GET operations or by manually calling Characteristic.updateValue on the brightness characteristic). - Detecting changes on the lightbulb side: Any manual change to ColorTemperature or Hue/Saturation is considered as a signal to turn AdaptiveLighting off. In order to notify the AdaptiveLightingController of such an event happening OUTSIDE of HomeKit you must call disableAdaptiveLighting manually! - Be aware that even when the light is turned off the transition will continue to call the SET handler of the ColorTemperature characteristic. - When using Hue/Saturation: When using Hue/Saturation in combination with the ColorTemperature characteristic you need to update the respective other in a particular way depending on if being in "color mode" or "color temperature mode". When a write happens to Hue/Saturation characteristic in is advised to set the internal value of the ColorTemperature to the minimal (NOT RAISING an event). When a write happens to the ColorTemperature characteristic just MUST convert to a proper representation in hue and saturation values, with RAISING an event. As noted above you MUST NOT call the Characteristic.setValue method for this, as this will be considered a write to the characteristic and will turn off AdaptiveLighting. Instead, you should use Characteristic.updateValue for this. You can and SHOULD use the supplied utility method ColorUtils.colorTemperatureToHueAndSaturation for converting mired to hue and saturation values.
MANUAL mode:
Manual mode is recommended for any accessories which support transitions natively on the devices end. Like for example ZigBee lights which support sending transitions directly to the lightbulb which then get executed ON the lightbulb itself reducing unnecessary network traffic. Here is a quick overview what you have to consider to successfully implement AdaptiveLighting support. The AdaptiveLightingController will also in manual mode do all the setup procedure. It will also save the transition schedule to disk to keep AdaptiveLighting enabled across reboots. The "only" thing you have to do yourself is handling the actual transitions, check that event notifications are only sent in the defined interval threshold, adjust the color temperature when brightness is changed and signal that Adaptive Lighting should be disabled if ColorTemperature, Hue or Saturation is changed manually.
First step is to setup up an event handler for the AdaptiveLightingControllerEvents.UPDATE, which is called when AdaptiveLighting is enabled, the HomeHub updates the schedule for the next 24 hours or AdaptiveLighting is restored from disk on startup. In the event handler you can get the current schedule via AdaptiveLightingController.getAdaptiveLightingTransitionCurve, retrieve current intervals like AdaptiveLightingController.getAdaptiveLightingUpdateInterval or AdaptiveLightingController.getAdaptiveLightingNotifyIntervalThreshold and get the date in epoch millis when the current transition curve started using AdaptiveLightingController.getAdaptiveLightingStartTimeOfTransition. Additionally AdaptiveLightingController.getAdaptiveLightingBrightnessMultiplierRange can be used to get the valid range for the brightness value to calculate the brightness adjustment factor. The method AdaptiveLightingController.isAdaptiveLightingActive can be used to check if AdaptiveLighting is enabled. Besides, actually running the transition (see AdaptiveLightingTransitionCurveEntry) you must correctly update the color temperature when the brightness of the lightbulb changes (see AdaptiveLightingTransitionCurveEntry.brightnessAdjustmentFactor), and signal when AdaptiveLighting got disabled by calling AdaptiveLightingController.disableAdaptiveLighting when ColorTemperature, Hue or Saturation where changed manually. Lastly you should set up a event handler for the AdaptiveLightingControllerEvents.DISABLED event. In yet unknown circumstances HomeKit may also send a dedicated disable command via the control point characteristic. Be prepared to handle that.
Adaptive Lighting
constructor
constructor(service: Lightbulb, options?: AdaptiveLightingOptions);
Creates a new instance of the AdaptiveLightingController. Refer to the AdaptiveLightingController documentation on how to use it.
Parameter service
The lightbulb to which Adaptive Lighting support should be added.
Parameter options
Optional options to define the operating mode (automatic vs manual).
method configureServices
configureServices: () => void;
method constructServices
constructServices: () => ControllerServiceMap;
method controllerId
controllerId: () => ControllerIdentifier;
method deserialize
deserialize: (serialized: SerializedAdaptiveLightingControllerState) => void;
method disableAdaptiveLighting
disableAdaptiveLighting: () => void;
This method can be called to manually disable the current active Adaptive Lighting transition. When using AdaptiveLightingControllerMode.AUTOMATIC you won't need to call this method. In AdaptiveLightingControllerMode.MANUAL you must call this method when Adaptive Lighting should be disabled. This is the case when the user manually changes the value of Hue, Saturation or ColorTemperature characteristics (or if any of those values is changed by physical interaction with the lightbulb).
method getAdaptiveLightingBrightnessMultiplierRange
getAdaptiveLightingBrightnessMultiplierRange: () => BrightnessAdjustmentMultiplierRange;
method getAdaptiveLightingNotifyIntervalThreshold
getAdaptiveLightingNotifyIntervalThreshold: () => number;
Returns the minimum interval threshold (in milliseconds) a accessory may notify HomeKit controllers about a new color temperature value via event notifications (what happens when you call Characteristic.updateValue). Meaning the accessory should only send event notifications to subscribed HomeKit controllers at the specified interval.
Typically this evaluates to 600000 milliseconds (10 minutes).
method getAdaptiveLightingStartTimeOfTransition
getAdaptiveLightingStartTimeOfTransition: () => number;
Returns the time where the current transition curve was started in epoch time millis. A transition curves is active for 24 hours typically and is renewed every 24 hours by a HomeHub. Additionally see getAdaptiveLightingTimeOffset.
method getAdaptiveLightingTimeOffset
getAdaptiveLightingTimeOffset: () => number;
It is not necessarily given, that we have the same time (or rather the correct time) as the HomeKit controller who set up the transition schedule. Thus we record the delta between our current time and the the time send with the setup request. timeOffset is defined as Date.now() - getAdaptiveLightingStartTimeOfTransition();. So in the case were we actually have a correct local time, it most likely will be positive (due to network latency). But of course it can also be negative.
method getAdaptiveLightingTransitionCurve
getAdaptiveLightingTransitionCurve: () => AdaptiveLightingTransitionCurveEntry[];
method getAdaptiveLightingUpdateInterval
getAdaptiveLightingUpdateInterval: () => number;
This method returns the interval (in milliseconds) in which the light should update its internal color temperature (aka changes it physical color). A lightbulb should ideally change this also when turned of in oder to have a smooth transition when turning the light on.
Typically this evaluates to 60000 milliseconds (60 seconds).
method getCurrentAdaptiveLightingTransitionPoint
getCurrentAdaptiveLightingTransitionPoint: () => | AdaptiveLightingTransitionPoint | undefined;
Retrieve the AdaptiveLightingTransitionPoint for the current timestamp. Returns undefined if the current transition schedule reached its end.
method handleControllerRemoved
handleControllerRemoved: () => void;
method handleFactoryReset
handleFactoryReset: () => void;
method initWithServices
initWithServices: ( serviceMap: ControllerServiceMap) => void | ControllerServiceMap;
method isAdaptiveLightingActive
isAdaptiveLightingActive: () => boolean;
Returns if a Adaptive Lighting transition is currently active.
method serialize
serialize: () => SerializedAdaptiveLightingControllerState | undefined;
method setupStateChangeDelegate
setupStateChangeDelegate: (delegate?: StateChangeDelegate) => void;
class Bridge
class Bridge extends Accessory {}
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.
Accessory
constructor
constructor(displayName: string, UUID: string);
class CameraController
class CameraController extends EventEmitter implements SerializableController<CameraControllerServiceMap, CameraControllerState> {}
Everything needed to expose a HomeKit Camera.
Camera
constructor
constructor(options: CameraControllerOptions, legacyMode?: boolean);
property motionService
motionService?: MotionSensor;
property occupancyService
occupancyService?: OccupancySensor;
property recordingManagement
recordingManagement?: RecordingManagement;
The RecordingManagement which is responsible for handling HomeKit Secure Video. This property is only present if recording was configured.
property streamManagements
streamManagements: RTPStreamManagement[];
method configureServices
configureServices: () => void;
method constructServices
constructServices: () => CameraControllerServiceMap;
method controllerId
controllerId: () => ControllerIdentifier;
method deserialize
deserialize: (serialized: CameraControllerState) => void;
method forceStopStreamingSession
forceStopStreamingSession: (sessionId: SessionIdentifier) => void;
Call this method if you want to forcefully suspend an ongoing streaming session. This would be adequate if the rtp server or media encoding encountered an unexpected error.
Parameter sessionId
id of the current ongoing streaming session
method generateSynchronisationSource
static generateSynchronisationSource: () => number;
method handleControllerRemoved
handleControllerRemoved: () => void;
method handleFactoryReset
handleFactoryReset: () => void;
method handleSnapshotRequest
handleSnapshotRequest: ( height: number, width: number, accessoryName?: string, reason?: ResourceRequestReason) => Promise<Buffer>;
method initWithServices
initWithServices: ( serviceMap: CameraControllerServiceMap) => void | CameraControllerServiceMap;
method migrateFromDoorbell
protected migrateFromDoorbell: (serviceMap: ControllerServiceMap) => boolean;
method retrieveEventTriggerOptions
protected retrieveEventTriggerOptions: () => Set<EventTriggerOption>;
method serialize
serialize: () => CameraControllerState | undefined;
method setMicrophoneMuted
setMicrophoneMuted: (muted?: boolean) => void;
method setMicrophoneVolume
setMicrophoneVolume: (volume: number) => void;
method setSpeakerMuted
setSpeakerMuted: (muted?: boolean) => void;
method setSpeakerVolume
setSpeakerVolume: (volume: number) => void;
method setupStateChangeDelegate
setupStateChangeDelegate: (delegate?: StateChangeDelegate) => void;
class Characteristic
class Characteristic extends EventEmitter {}
Characteristic represents a particular typed variable that can be assigned to a Service. For instance, a "Hue" Characteristic might store a 'float' value of type 'arcdegrees'. You could add the Hue Characteristic to a Service in order to store that value. A particular Characteristic is distinguished from others by its UUID. HomeKit provides a set of known Characteristic UUIDs defined in HomeKit.ts along with a corresponding concrete subclass.
You can also define custom Characteristics by providing your own UUID. Custom Characteristics can be added to any native or custom Services, but Siri will likely not be able to work with these.
Characteristic
constructor
constructor(displayName: string, UUID: string, props: CharacteristicProps);
property AccessCodeControlPoint
static AccessCodeControlPoint: typeof AccessCodeControlPoint;
Characteristic Definitions
property AccessCodeSupportedConfiguration
static AccessCodeSupportedConfiguration: typeof AccessCodeSupportedConfiguration;
Characteristic Definitions
property AccessControlLevel
static AccessControlLevel: typeof AccessControlLevel;
Characteristic Definitions
property AccessoryFlags
static AccessoryFlags: typeof AccessoryFlags;
Characteristic Definitions
property AccessoryIdentifier
static AccessoryIdentifier: typeof AccessoryIdentifier;
Characteristic Definitions
property Active
static Active: typeof Active;
Characteristic Definitions
property ActiveIdentifier
static ActiveIdentifier: typeof ActiveIdentifier;
Characteristic Definitions
property ActivityInterval
static ActivityInterval: typeof ActivityInterval;
Characteristic Definitions
property additionalAuthorizationHandler
additionalAuthorizationHandler?: AdditionalAuthorizationHandler;
property AdministratorOnlyAccess
static AdministratorOnlyAccess: typeof AdministratorOnlyAccess;
Characteristic Definitions
property AirParticulateDensity
static AirParticulateDensity: typeof AirParticulateDensity;
Characteristic Definitions
property AirParticulateSize
static AirParticulateSize: typeof AirParticulateSize;
Characteristic Definitions
property AirPlayEnable
static AirPlayEnable: typeof AirPlayEnable;
Characteristic Definitions
property AirQuality
static AirQuality: typeof AirQuality;
Characteristic Definitions
property AppMatchingIdentifier
static AppMatchingIdentifier: typeof AppMatchingIdentifier;
Characteristic Definitions
property AssetUpdateReadiness
static AssetUpdateReadiness: typeof AssetUpdateReadiness;
Characteristic Definitions
property AudioFeedback
static AudioFeedback: typeof AudioFeedback;
Characteristic Definitions
property BatteryLevel
static BatteryLevel: typeof BatteryLevel;
Characteristic Definitions
property Brightness
static Brightness: typeof Brightness;
Characteristic Definitions
property ButtonEvent
static ButtonEvent: typeof ButtonEvent;
Characteristic Definitions
property CameraOperatingModeIndicator
static CameraOperatingModeIndicator: typeof CameraOperatingModeIndicator;
Characteristic Definitions
property CarbonDioxideDetected
static CarbonDioxideDetected: typeof CarbonDioxideDetected;
Characteristic Definitions
property CarbonDioxideLevel
static CarbonDioxideLevel: typeof CarbonDioxideLevel;
Characteristic Definitions
property CarbonDioxidePeakLevel
static CarbonDioxidePeakLevel: typeof CarbonDioxidePeakLevel;
Characteristic Definitions
property CarbonMonoxideDetected
static CarbonMonoxideDetected: typeof CarbonMonoxideDetected;
Characteristic Definitions
property CarbonMonoxideLevel
static CarbonMonoxideLevel: typeof CarbonMonoxideLevel;
Characteristic Definitions
property CarbonMonoxidePeakLevel
static CarbonMonoxidePeakLevel: typeof CarbonMonoxidePeakLevel;
Characteristic Definitions
property CCAEnergyDetectThreshold
static CCAEnergyDetectThreshold: typeof CCAEnergyDetectThreshold;
Characteristic Definitions
property CCASignalDetectThreshold
static CCASignalDetectThreshold: typeof CCASignalDetectThreshold;
Characteristic Definitions
property CharacteristicValueActiveTransitionCount
static CharacteristicValueActiveTransitionCount: typeof CharacteristicValueActiveTransitionCount;
Characteristic Definitions
property CharacteristicValueTransitionControl
static CharacteristicValueTransitionControl: typeof CharacteristicValueTransitionControl;
Characteristic Definitions
property ChargingState
static ChargingState: typeof ChargingState;
Characteristic Definitions
property ClosedCaptions
static ClosedCaptions: typeof ClosedCaptions;
Characteristic Definitions
property ColorTemperature
static ColorTemperature: typeof ColorTemperature;
Characteristic Definitions
property ConfigurationState
static ConfigurationState: typeof ConfigurationState;
Characteristic Definitions
property ConfiguredName
static ConfiguredName: typeof ConfiguredName;
Characteristic Definitions
property ContactSensorState
static ContactSensorState: typeof ContactSensorState;
Characteristic Definitions
property CoolingThresholdTemperature
static CoolingThresholdTemperature: typeof CoolingThresholdTemperature;
Characteristic Definitions
property CryptoHash
static CryptoHash: typeof CryptoHash;
Characteristic Definitions
property CurrentAirPurifierState
static CurrentAirPurifierState: typeof CurrentAirPurifierState;
Characteristic Definitions
property CurrentAmbientLightLevel
static CurrentAmbientLightLevel: typeof CurrentAmbientLightLevel;
Characteristic Definitions
property CurrentDoorState
static CurrentDoorState: typeof CurrentDoorState;
Characteristic Definitions
property CurrentFanState
static CurrentFanState: typeof CurrentFanState;
Characteristic Definitions
property CurrentHeaterCoolerState
static CurrentHeaterCoolerState: typeof CurrentHeaterCoolerState;
Characteristic Definitions
property CurrentHeatingCoolingState
static CurrentHeatingCoolingState: typeof CurrentHeatingCoolingState;
Characteristic Definitions
property CurrentHorizontalTiltAngle
static CurrentHorizontalTiltAngle: typeof CurrentHorizontalTiltAngle;
Characteristic Definitions
property CurrentHumidifierDehumidifierState
static CurrentHumidifierDehumidifierState: typeof CurrentHumidifierDehumidifierState;
Characteristic Definitions
property CurrentMediaState
static CurrentMediaState: typeof CurrentMediaState;
Characteristic Definitions
property CurrentPosition
static CurrentPosition: typeof CurrentPosition;
Characteristic Definitions
property CurrentRelativeHumidity
static CurrentRelativeHumidity: typeof CurrentRelativeHumidity;
Characteristic Definitions
property CurrentSlatState
static CurrentSlatState: typeof CurrentSlatState;
Characteristic Definitions
property CurrentTemperature
static CurrentTemperature: typeof CurrentTemperature;
Characteristic Definitions
property CurrentTiltAngle
static CurrentTiltAngle: typeof CurrentTiltAngle;
Characteristic Definitions
property CurrentTransport
static CurrentTransport: typeof CurrentTransport;
Characteristic Definitions
property CurrentVerticalTiltAngle
static CurrentVerticalTiltAngle: typeof CurrentVerticalTiltAngle;
Characteristic Definitions
property CurrentVisibilityState
static CurrentVisibilityState: typeof CurrentVisibilityState;
Characteristic Definitions
property DataStreamHAPTransport
static DataStreamHAPTransport: typeof DataStreamHAPTransport;
Characteristic Definitions
property DataStreamHAPTransportInterrupt
static DataStreamHAPTransportInterrupt: typeof DataStreamHAPTransportInterrupt;
Characteristic Definitions
property DiagonalFieldOfView
static DiagonalFieldOfView: typeof DiagonalFieldOfView;
Characteristic Definitions
property DigitalZoom
static DigitalZoom: typeof DigitalZoom;
Characteristic Definitions
property displayName
displayName: string;
property DisplayOrder
static DisplayOrder: typeof DisplayOrder;
Characteristic Definitions
property EventRetransmissionMaximum
static EventRetransmissionMaximum: typeof EventRetransmissionMaximum;
Characteristic Definitions
property EventSnapshotsActive
static EventSnapshotsActive: typeof EventSnapshotsActive;
Characteristic Definitions
property EventTransmissionCounters
static EventTransmissionCounters: typeof EventTransmissionCounters;
Characteristic Definitions
property FilterChangeIndication
static FilterChangeIndication: typeof FilterChangeIndication;
Characteristic Definitions
property FilterLifeLevel
static FilterLifeLevel: typeof FilterLifeLevel;
Characteristic Definitions
property FirmwareRevision
static FirmwareRevision: typeof FirmwareRevision;
Characteristic Definitions
property FirmwareUpdateReadiness
static FirmwareUpdateReadiness: typeof FirmwareUpdateReadiness;
Characteristic Definitions
property FirmwareUpdateStatus
static FirmwareUpdateStatus: typeof FirmwareUpdateStatus;
Characteristic Definitions
property HardwareFinish
static HardwareFinish: typeof HardwareFinish;
Characteristic Definitions
property HardwareRevision
static HardwareRevision: typeof HardwareRevision;
Characteristic Definitions
property HeartBeat
static HeartBeat: typeof HeartBeat;
Characteristic Definitions
property HeatingThresholdTemperature
static HeatingThresholdTemperature: typeof HeatingThresholdTemperature;
Characteristic Definitions
property HoldPosition
static HoldPosition: typeof HoldPosition;
Characteristic Definitions
property HomeKitCameraActive
static HomeKitCameraActive: typeof HomeKitCameraActive;
Characteristic Definitions
property Hue
static Hue: typeof Hue;
Characteristic Definitions
property Identifier
static Identifier: typeof Identifier;
Characteristic Definitions
property Identify
static Identify: typeof Identify;
Characteristic Definitions
property iid
iid: number;
property ImageMirroring
static ImageMirroring: typeof ImageMirroring;
Characteristic Definitions
property ImageRotation
static ImageRotation: typeof ImageRotation;
Characteristic Definitions
property InputDeviceType
static InputDeviceType: typeof InputDeviceType;
Characteristic Definitions
property InputSourceType
static InputSourceType: typeof InputSourceType;
Characteristic Definitions
property InUse
static InUse: typeof InUse;
Characteristic Definitions
property IsConfigured
static IsConfigured: typeof IsConfigured;
Characteristic Definitions
property LeakDetected
static LeakDetected: typeof LeakDetected;
Characteristic Definitions
property ListPairings
static ListPairings: typeof ListPairings;
Characteristic Definitions
property LockControlPoint
static LockControlPoint: typeof LockControlPoint;
Characteristic Definitions
property LockCurrentState
static LockCurrentState: typeof LockCurrentState;
Characteristic Definitions
property LockLastKnownAction
static LockLastKnownAction: typeof LockLastKnownAction;
Characteristic Definitions
property LockManagementAutoSecurityTimeout
static LockManagementAutoSecurityTimeout: typeof LockManagementAutoSecurityTimeout;
Characteristic Definitions
property LockPhysicalControls
static LockPhysicalControls: typeof LockPhysicalControls;
Characteristic Definitions
property LockTargetState
static LockTargetState: typeof LockTargetState;
Characteristic Definitions
property Logs
static Logs: typeof Logs;
Characteristic Definitions
property MACRetransmissionMaximum
static MACRetransmissionMaximum: typeof MACRetransmissionMaximum;
Characteristic Definitions
property MACTransmissionCounters
static MACTransmissionCounters: typeof MACTransmissionCounters;
Characteristic Definitions
property ManagedNetworkEnable
static ManagedNetworkEnable: typeof ManagedNetworkEnable;
Characteristic Definitions
property ManuallyDisabled
static ManuallyDisabled: typeof ManuallyDisabled;
Characteristic Definitions
property Manufacturer
static Manufacturer: typeof Manufacturer;
Characteristic Definitions
property MaximumTransmitPower
static MaximumTransmitPower: typeof MaximumTransmitPower;
Characteristic Definitions
property MetricsBufferFullState
static MetricsBufferFullState: typeof MetricsBufferFullState;
Characteristic Definitions
property Model
static Model: typeof Model;
Characteristic Definitions
property MotionDetected
static MotionDetected: typeof MotionDetected;
Characteristic Definitions
property MultifunctionButton
static MultifunctionButton: typeof MultifunctionButton;
Characteristic Definitions
property Mute
static Mute: typeof Mute;
Characteristic Definitions
property Name
static Name: typeof Name;
Characteristic Definitions
property NetworkAccessViolationControl
static NetworkAccessViolationControl: typeof NetworkAccessViolationControl;
Characteristic Definitions
property NetworkClientProfileControl
static NetworkClientProfileControl: typeof NetworkClientProfileControl;
Characteristic Definitions
property NetworkClientStatusControl
static NetworkClientStatusControl: typeof NetworkClientStatusControl;
Characteristic Definitions
property NFCAccessControlPoint
static NFCAccessControlPoint: typeof NFCAccessControlPoint;
Characteristic Definitions
property NFCAccessSupportedConfiguration
static NFCAccessSupportedConfiguration: typeof NFCAccessSupportedConfiguration;
Characteristic Definitions
property NightVision
static NightVision: typeof NightVision;
Characteristic Definitions
property NitrogenDioxideDensity
static NitrogenDioxideDensity: typeof NitrogenDioxideDensity;
Characteristic Definitions
property ObstructionDetected
static ObstructionDetected: typeof ObstructionDetected;
Characteristic Definitions
property OccupancyDetected
static OccupancyDetected: typeof OccupancyDetected;
Characteristic Definitions
property On
static On: typeof On;
Characteristic Definitions
property OperatingStateResponse
static OperatingStateResponse: typeof OperatingStateResponse;
Characteristic Definitions
property OpticalZoom
static OpticalZoom: typeof OpticalZoom;
Characteristic Definitions
property OutletInUse
static OutletInUse: typeof OutletInUse;
Characteristic Definitions
property OzoneDensity
static OzoneDensity: typeof OzoneDensity;
Characteristic Definitions
property PairingFeatures
static PairingFeatures: typeof PairingFeatures;
Characteristic Definitions
property PairSetup
static PairSetup: typeof PairSetup;
Characteristic Definitions
property PairVerify
static PairVerify: typeof PairVerify;
Characteristic Definitions
property PasswordSetting
static PasswordSetting: typeof PasswordSetting;
Characteristic Definitions
property PeriodicSnapshotsActive
static PeriodicSnapshotsActive: typeof PeriodicSnapshotsActive;
Characteristic Definitions
property PictureMode
static PictureMode: typeof PictureMode;
Characteristic Definitions
property Ping
static Ping: typeof Ping;
Characteristic Definitions
property PM10Density
static PM10Density: typeof PM10Density;
Characteristic Definitions
property PM2_5Density
static PM2_5Density: typeof PM2_5Density;
Characteristic Definitions
property PositionState
static PositionState: typeof PositionState;
Characteristic Definitions
property PowerModeSelection
static PowerModeSelection: typeof PowerModeSelection;
Characteristic Definitions
property ProductData
static ProductData: typeof ProductData;
Characteristic Definitions
property ProgrammableSwitchEvent
static ProgrammableSwitchEvent: typeof ProgrammableSwitchEvent;
Characteristic Definitions
property ProgrammableSwitchOutputState
static ProgrammableSwitchOutputState: typeof ProgrammableSwitchOutputState;
Characteristic Definitions
property ProgramMode
static ProgramMode: typeof ProgramMode;
Characteristic Definitions
property props
props: CharacteristicProps;
property ReceivedSignalStrengthIndication
static ReceivedSignalStrengthIndication: typeof ReceivedSignalStrengthIndication;
Characteristic Definitions
property ReceiverSensitivity
static ReceiverSensitivity: typeof ReceiverSensitivity;
Characteristic Definitions
property RecordingAudioActive
static RecordingAudioActive: typeof RecordingAudioActive;
Characteristic Definitions
property RelativeHumidityDehumidifierThreshold
static RelativeHumidityDehumidifierThreshold: typeof RelativeHumidityDehumidifierThreshold;
Characteristic Definitions
property RelativeHumidityHumidifierThreshold
static RelativeHumidityHumidifierThreshold: typeof RelativeHumidityHumidifierThreshold;
Characteristic Definitions
property RelayControlPoint
static RelayControlPoint: typeof RelayControlPoint;
Characteristic Definitions
property RelayEnabled
static RelayEnabled: typeof RelayEnabled;
Characteristic Definitions
property RelayState
static RelayState: typeof RelayState;
Characteristic Definitions
property RemainingDuration
static RemainingDuration: typeof RemainingDuration;
Characteristic Definitions
property RemoteKey
static RemoteKey: typeof RemoteKey;
Characteristic Definitions
property ResetFilterIndication
static ResetFilterIndication: typeof ResetFilterIndication;
Characteristic Definitions
property RotationDirection
static RotationDirection: typeof RotationDirection;
Characteristic Definitions
property RotationSpeed
static RotationSpeed: typeof RotationSpeed;
Characteristic Definitions
property RouterStatus
static RouterStatus: typeof RouterStatus;
Characteristic Definitions
property Saturation
static Saturation: typeof Saturation;
Characteristic Definitions
property SecuritySystemAlarmType
static SecuritySystemAlarmType: typeof SecuritySystemAlarmType;
Characteristic Definitions
property SecuritySystemCurrentState
static SecuritySystemCurrentState: typeof SecuritySystemCurrentState;
Characteristic Definitions
property SecuritySystemTargetState
static SecuritySystemTargetState: typeof SecuritySystemTargetState;
Characteristic Definitions
property SelectedAudioStreamConfiguration
static SelectedAudioStreamConfiguration: typeof SelectedAudioStreamConfiguration;
Characteristic Definitions
property SelectedCameraRecordingConfiguration
static SelectedCameraRecordingConfiguration: typeof SelectedCameraRecordingConfiguration;
Characteristic Definitions
property SelectedDiagnosticsModes
static SelectedDiagnosticsModes: typeof SelectedDiagnosticsModes;
Characteristic Definitions
property SelectedRTPStreamConfiguration
static SelectedRTPStreamConfiguration: typeof SelectedRTPStreamConfiguration;
Characteristic Definitions
property SelectedSleepConfiguration
static SelectedSleepConfiguration: typeof SelectedSleepConfiguration;
Characteristic Definitions
property SerialNumber
static SerialNumber: typeof SerialNumber;
Characteristic Definitions
property ServiceLabelIndex
static ServiceLabelIndex: typeof ServiceLabelIndex;
Characteristic Definitions
property ServiceLabelNamespace
static ServiceLabelNamespace: typeof ServiceLabelNamespace;
Characteristic Definitions
property SetDuration
static SetDuration: typeof SetDuration;
Characteristic Definitions
property SetupDataStreamTransport
static SetupDataStreamTransport: typeof SetupDataStreamTransport;
Characteristic Definitions
property SetupEndpoints
static SetupEndpoints: typeof SetupEndpoints;
Characteristic Definitions
property SetupTransferTransport
static SetupTransferTransport: typeof SetupTransferTransport;
Characteristic Definitions
property SignalToNoiseRatio
static SignalToNoiseRatio: typeof SignalToNoiseRatio;
Characteristic Definitions
property SiriEnable
static SiriEnable: typeof SiriEnable;
Characteristic Definitions
property SiriEndpointSessionStatus
static SiriEndpointSessionStatus: typeof SiriEndpointSessionStatus;
Characteristic Definitions
property SiriEngineVersion
static SiriEngineVersion: typeof SiriEngineVersion;
Characteristic Definitions
property SiriInputType
static SiriInputType: typeof SiriInputType;
Characteristic Definitions
property SiriLightOnUse
static SiriLightOnUse: typeof SiriLightOnUse;
Characteristic Definitions
property SiriListening
static SiriListening: typeof SiriListening;
Characteristic Definitions
property SiriTouchToUse
static SiriTouchToUse: typeof SiriTouchToUse;
Characteristic Definitions
property SlatType
static SlatType: typeof SlatType;
Characteristic Definitions
property SleepDiscoveryMode
static SleepDiscoveryMode: typeof SleepDiscoveryMode;
Characteristic Definitions
property SleepInterval
static SleepInterval: typeof SleepInterval;
Characteristic Definitions
property SmokeDetected
static SmokeDetected: typeof SmokeDetected;
Characteristic Definitions
property SoftwareRevision
static SoftwareRevision: typeof SoftwareRevision;
Characteristic Definitions
property StagedFirmwareVersion
static StagedFirmwareVersion: typeof StagedFirmwareVersion;
Characteristic Definitions
property StatusActive
static StatusActive: typeof StatusActive;
Characteristic Definitions
property statusCode
statusCode: HAPStatus;
property StatusFault
static StatusFault: typeof StatusFault;
Characteristic Definitions
property StatusJammed
static StatusJammed: typeof StatusJammed;
Characteristic Definitions
property StatusLowBattery
static StatusLowBattery: typeof StatusLowBattery;
Characteristic Definitions
property StatusTampered
static StatusTampered: typeof StatusTampered;
Characteristic Definitions
property StreamingStatus
static StreamingStatus: typeof StreamingStatus;
Characteristic Definitions
property SulphurDioxideDensity
static SulphurDioxideDensity: typeof SulphurDioxideDensity;
Characteristic Definitions
property SupportedAssetTypes
static SupportedAssetTypes: typeof SupportedAssetTypes;
Characteristic Definitions
property SupportedAudioRecordingConfiguration
static SupportedAudioRecordingConfiguration: typeof SupportedAudioRecordingConfiguration;
Characteristic Definitions
property SupportedAudioStreamConfiguration
static SupportedAudioStreamConfiguration: typeof SupportedAudioStreamConfiguration;
Characteristic Definitions
property SupportedCameraRecordingConfiguration
static SupportedCameraRecordingConfiguration: typeof SupportedCameraRecordingConfiguration;
Characteristic Definitions
property SupportedCharacteristicValueTransitionConfiguration
static SupportedCharacteristicValueTransitionConfiguration: typeof SupportedCharacteristicValueTransitionConfiguration;
Characteristic Definitions
property SupportedDataStreamTransportConfiguration
static SupportedDataStreamTransportConfiguration: typeof SupportedDataStreamTransportConfiguration;
Characteristic Definitions
property SupportedDiagnosticsModes
static SupportedDiagnosticsModes: typeof SupportedDiagnosticsModes;
Characteristic Definitions
property SupportedDiagnosticsSnapshot
static SupportedDiagnosticsSnapshot: typeof SupportedDiagnosticsSnapshot;
Characteristic Definitions
property SupportedFirmwareUpdateConfiguration
static SupportedFirmwareUpdateConfiguration: typeof SupportedFirmwareUpdateConfiguration;
Characteristic Definitions
property SupportedMetrics
static SupportedMetrics: typeof SupportedMetrics;
Characteristic Definitions
property SupportedRouterConfiguration
static SupportedRouterConfiguration: typeof SupportedRouterConfiguration;
Characteristic Definitions
property SupportedRTPConfiguration
static SupportedRTPConfiguration: typeof SupportedRTPConfiguration;
Characteristic Definitions
property SupportedSleepConfiguration
static SupportedSleepConfiguration: typeof SupportedSleepConfiguration;
Characteristic Definitions
property SupportedTransferTransportConfiguration
static SupportedTransferTransportConfiguration: typeof SupportedTransferTransportConfiguration;
Characteristic Definitions
property SupportedVideoRecordingConfiguration
static SupportedVideoRecordingConfiguration: typeof SupportedVideoRecordingConfiguration;
Characteristic Definitions
property SupportedVideoStreamConfiguration
static SupportedVideoStreamConfiguration: typeof SupportedVideoStreamConfiguration;
Characteristic Definitions
property SwingMode
static SwingMode: typeof SwingMode;
Characteristic Definitions
property TapType
static TapType: typeof TapType;
Characteristic Definitions
property TargetAirPurifierState
static TargetAirPurifierState: typeof TargetAirPurifierState;
Characteristic Definitions
property TargetControlList
static TargetControlList: typeof TargetControlList;
Characteristic Definitions
property TargetControlSupportedConfiguration
static TargetControlSupportedConfiguration: typeof TargetControlSupportedConfiguration;
Characteristic Definitions
property TargetDoorState
static TargetDoorState: typeof TargetDoorState;
Characteristic Definitions
property TargetFanState
static TargetFanState: typeof TargetFanState;
Characteristic Definitions
property TargetHeaterCoolerState
static TargetHeaterCoolerState: typeof TargetHeaterCoolerState;
Characteristic Definitions
property TargetHeatingCoolingState
static TargetHeatingCoolingState: typeof TargetHeatingCoolingState;
Characteristic Definitions
property TargetHorizontalTiltAngle
static TargetHorizontalTiltAngle: typeof TargetHorizontalTiltAngle;
Characteristic Definitions
property TargetHumidifierDehumidifierState
static TargetHumidifierDehumidifierState: typeof TargetHumidifierDehumidifierState;
Characteristic Definitions
property TargetMediaState
static TargetMediaState: typeof TargetMediaState;
Characteristic Definitions
property TargetPosition
static TargetPosition: typeof TargetPosition;
Characteristic Definitions
property TargetRelativeHumidity
static TargetRelativeHumidity: typeof TargetRelativeHumidity;
Characteristic Definitions
property TargetTemperature
static TargetTemperature: typeof TargetTemperature;
Characteristic Definitions
property TargetTiltAngle
static TargetTiltAngle: typeof TargetTiltAngle;
Characteristic Definitions
property TargetVerticalTiltAngle
static TargetVerticalTiltAngle: typeof TargetVerticalTiltAngle;
Characteristic Definitions
property TargetVisibilityState
static TargetVisibilityState: typeof TargetVisibilityState;
Characteristic Definitions
property TemperatureDisplayUnits
static TemperatureDisplayUnits: typeof TemperatureDisplayUnits;
Characteristic Definitions
property ThirdPartyCameraActive
static ThirdPartyCameraActive: typeof ThirdPartyCameraActive;
Characteristic Definitions
property ThreadControlPoint
static ThreadControlPoint: typeof ThreadControlPoint;
Characteristic Definitions
property ThreadNodeCapabilities
static ThreadNodeCapabilities: typeof ThreadNodeCapabilities;
Characteristic Definitions
property ThreadOpenThreadVersion
static ThreadOpenThreadVersion: typeof ThreadOpenThreadVersion;
Characteristic Definitions
property ThreadStatus
static ThreadStatus: typeof ThreadStatus;
Characteristic Definitions
property Token
static Token: typeof Token;
Characteristic Definitions
property TransmitPower
static TransmitPower: typeof TransmitPower;
Characteristic Definitions
property TunnelConnectionTimeout
static TunnelConnectionTimeout: typeof TunnelConnectionTimeout;
Characteristic Definitions
property TunneledAccessoryAdvertising
static TunneledAccessoryAdvertising: typeof TunneledAccessoryAdvertising;
Characteristic Definitions
property TunneledAccessoryConnected
static TunneledAccessoryConnected: typeof TunneledAccessoryConnected;
Characteristic Definitions
property TunneledAccessoryStateNumber
static TunneledAccessoryStateNumber: typeof TunneledAccessoryStateNumber;
Characteristic Definitions
property UUID
UUID: string;
property value
value: CharacteristicValue;
property ValveType
static ValveType: typeof ValveType;
Characteristic Definitions
property Version
static Version: typeof Version;
Characteristic Definitions
property VideoAnalysisActive
static VideoAnalysisActive: typeof VideoAnalysisActive;
Characteristic Definitions
property VOCDensity
static VOCDensity: typeof VOCDensity;
Characteristic Definitions
property Volume
static Volume: typeof Volume;
Characteristic Definitions
property VolumeControlType
static VolumeControlType: typeof VolumeControlType;
Characteristic Definitions
property VolumeSelector
static VolumeSelector: typeof VolumeSelector;
Characteristic Definitions
property WakeConfiguration
static WakeConfiguration: typeof WakeConfiguration;
Characteristic Definitions
property WANConfigurationList
static WANConfigurationList: typeof WANConfigurationList;
Characteristic Definitions
property WANStatusList
static WANStatusList: typeof WANStatusList;
Characteristic Definitions
property WaterLevel
static WaterLevel: typeof WaterLevel;
Characteristic Definitions
property WiFiCapabilities
static WiFiCapabilities: typeof WiFiCapabilities;
Characteristic Definitions
property WiFiConfigurationControl
static WiFiConfigurationControl: typeof WiFiConfigurationControl;
Characteristic Definitions
property WiFiSatelliteStatus
static WiFiSatelliteStatus: typeof WiFiSatelliteStatus;
Characteristic Definitions
method deserialize
static deserialize: (json: SerializedCharacteristic) => Characteristic;
Deserialize characteristic from json string.
Parameter json
Json string representing a characteristic. used to recreate characteristic from disk
method getDefaultValue
protected getDefaultValue: () => Nullable<CharacteristicValue>;
method handleGetRequest
handleGetRequest: ( connection?: HAPConnection, context?: CharacteristicContext) => Promise<Nullable<CharacteristicValue>>;
Called when a HAP requests wants to know the current value of the characteristic.
Parameter connection
The HAP connection from which the request originated from.
Parameter context
Deprecated parameter. There for backwards compatibility. Used by the Accessory to load the characteristic value
method handleSetRequest
handleSetRequest: ( value: CharacteristicValue, connection?: HAPConnection, context?: CharacteristicContext) => Promise<CharacteristicValue | void>;
Called when a HAP requests update the current value of the characteristic.
Parameter value
The updated value
Parameter connection
The connection from which the request originated from
Parameter context
Deprecated parameter. There for backwards compatibility.
Returns
Promise resolve to void in normal operation. When characteristic supports write-response, HAP requests a write-response and the set handler returns a write-response value, the respective write response value is resolved.
method internalHAPRepresentation
internalHAPRepresentation: () => CharacteristicJsonObject;
Returns a JSON representation of this characteristic without the value. used to generate the config hash
method onGet
onGet: (handler: CharacteristicGetHandler) => Characteristic;
Accepts a function that will be called to retrieve the current value of a Characteristic. The function must return a valid Characteristic value for the Characteristic type. May optionally return a promise.
Parameter handler
Example 1
Characteristic.onGet(async () => {return true;});
method onSet
onSet: (handler: CharacteristicSetHandler) => Characteristic;
Accepts a function that will be called when setting the value of a Characteristic. If the characteristic supports Perms.WRITE_RESPONSE and the request requests a write-response value, the returned value will be used. May optionally return a promise.
Parameter handler
Example 1
Characteristic.onSet(async (value: CharacteristicValue) => {console.log(value);});
method removeAllListeners
removeAllListeners: (event?: string | symbol) => this;
Parameter event
method removeOnGet
removeOnGet: () => Characteristic;
Removes the CharacteristicGetHandler handler which was configured using onGet.
method removeOnSet
removeOnSet: () => Characteristic;
Removes the CharacteristicSetHandler which was configured using onSet.
method replaceBy
replaceBy: (characteristic: Characteristic) => void;
Parameter characteristic
method sendEventNotification
sendEventNotification: ( value: CharacteristicValue, context?: CharacteristicContext) => Characteristic;
This method acts similarly to updateValue by setting the current value of the characteristic without calling any CharacteristicEventTypes.SET or onSet handlers. The difference is that this method forces an event notification sent (updateValue only sends one if the value changed). This is especially useful for characteristics like Characteristic.ButtonEvent or Characteristic.ProgrammableSwitchEvent.
Parameter value
The new value.
Parameter context
Passed to the CharacteristicEventTypes.CHANGE event handler.
method serialize
static serialize: (characteristic: Characteristic) => SerializedCharacteristic;
Serialize characteristic into json string.
Parameter characteristic
Characteristic object. used to store characteristic on disk
method setProps
setProps: (props: PartialAllowingNull<CharacteristicProps>) => Characteristic;
Updates the properties of this characteristic. Properties passed via the parameter will be set. Any parameter set to null will be deleted. See CharacteristicProps.
Parameter props
Partial properties object with the desired updates.
method setupAdditionalAuthorization
setupAdditionalAuthorization: (handler: AdditionalAuthorizationHandler) => void;
This method can be used to set up additional authorization for a characteristic. For one, it adds the Perms.ADDITIONAL_AUTHORIZATION permission to the characteristic (if it wasn't already) to signal support for additional authorization to HomeKit. Additionally, an AdditionalAuthorizationHandler is set up which is called before a write request is performed.
Additional Authorization Data can be added to SET request via a custom iOS App. Before hap-nodejs executes a write request it will call the AdditionalAuthorizationHandler with 'authData' supplied in the write request. The 'authData' is a base64 encoded string (or undefined if no authData was supplied). The AdditionalAuthorizationHandler must then return true or false to indicate if the write request is authorized and should be accepted.
Parameter handler
Handler called to check additional authorization data.
method setValue
setValue: { (value: CharacteristicValue): Characteristic; (error: HapStatusError | Error): Characteristic; (value: CharacteristicValue, context?: any): Characteristic;};
This updates the value by calling the CharacteristicEventTypes.SET event handler associated with the characteristic. This acts the same way as when a HomeKit controller sends a
/characteristics
request to update the characteristic. An event notification will be sent to all connected HomeKit controllers which are registered to receive event notifications for this characteristic.This method behaves like a updateValue call with the addition that the own CharacteristicEventTypes.SET event handler is called.
Parameter value
The new value.
Note: If you don't want the CharacteristicEventTypes.SET to be called, refer to updateValue.
Sets the state of the characteristic to an errored state.
If a onGet or CharacteristicEventTypes.GET handler is set up, the errored state will be ignored and the characteristic will always query the latest state by calling the provided handler.
If a generic error object is supplied, the characteristic tries to extract a HAPStatus code from the error message string. If not possible a generic HAPStatus.SERVICE_COMMUNICATION_FAILURE will be used. If the supplied error object is an instance of HapStatusError the corresponding status will be used.
This doesn't call any registered onSet or CharacteristicEventTypes.SET handlers.
Have a look at the guide for more information on how to present erroneous state to the user.
Parameter error
The error object
Note: Erroneous state is never **pushed** to the client side. Only, if the HomeKit client requests the current state of the Characteristic, the corresponding HapStatusError is returned. As described above, any onGet or CharacteristicEventTypes.GET handlers have precedence.
This updates the value by calling the CharacteristicEventTypes.SET event handler associated with the characteristic. This acts the same way as when a HomeKit controller sends a
/characteristics
request to update the characteristic. An event notification will be sent to all connected HomeKit controllers which are registered to receive event notifications for this characteristic.This method behaves like a updateValue call with the addition that the own CharacteristicEventTypes.SET event handler is called.
Parameter value
The new value.
Parameter context
Passed to the CharacteristicEventTypes.SET and CharacteristicEventTypes.CHANGE event handler.
Note: If you don't want the CharacteristicEventTypes.SET to be called, refer to updateValue.
method subscribe
subscribe: () => void;
Called once a HomeKit controller subscribes to events of this characteristic.
method toHAP
toHAP: ( connection: HAPConnection, contactGetHandlers?: boolean) => Promise<CharacteristicJsonObject>;
Returns a JSON representation of this characteristic suitable for delivering to HAP clients. used to generate response to /accessories query
method unsubscribe
unsubscribe: () => void;
Called once a HomeKit controller unsubscribe to events of this characteristic or a HomeKit controller which was subscribed to this characteristic disconnects.
method updateValue
updateValue: { ( value: Nullable<CharacteristicValue> | Error | HapStatusError ): Characteristic; (value: CharacteristicValue): Characteristic; (error: HapStatusError | Error): Characteristic; (value: CharacteristicValue, context?: any): Characteristic;};
This updates the value of the characteristic. If the value changed, an event notification will be sent to all connected HomeKit controllers which are registered to receive event notifications for this characteristic.
Parameter value
The new value or a
Error
or HapStatusError.Note: Refer to the respective overloads for CharacteristicValue or HapStatusError for respective documentation.
This updates the value of the characteristic. If the value changed, an event notification will be sent to all connected HomeKit controllers which are registered to receive event notifications for this characteristic.
Parameter value
The new value.
Sets the state of the characteristic to an errored state. If a onGet or CharacteristicEventTypes.GET handler is set up, the errored state will be ignored and the characteristic will always query the latest state by calling the provided handler.
If a generic error object is supplied, the characteristic tries to extract a HAPStatus code from the error message string. If not possible a generic HAPStatus.SERVICE_COMMUNICATION_FAILURE will be used. If the supplied error object is an instance of HapStatusError the corresponding status will be used.
Have a look at the guide for more information on how to present erroneous state to the user.
Parameter error
The error object
Note: Erroneous state is never **pushed** to the client side. Only, if the HomeKit client requests the current state of the Characteristic, the corresponding HapStatusError is returned. As described above, any onGet or CharacteristicEventTypes.GET handlers have precedence.
This updates the value of the characteristic. If the value changed, an event notification will be sent to all connected HomeKit controllers which are registered to receive event notifications for this characteristic.
Parameter value
The new value.
Parameter context
Passed to the CharacteristicEventTypes.CHANGE event handler.
method validValuesIterator
validValuesIterator: () => Iterable<number>;
This method can be used to gain an Iterator to loop over all valid values defined for this characteristic.
The range of valid values can be defined using three different ways via the CharacteristicProps object (set via the setProps method): * First method is to specifically list every valid value inside CharacteristicProps.validValues * Second you can specify a range via CharacteristicProps.minValue and CharacteristicProps.maxValue (with optionally defining CharacteristicProps.minStep) * And lastly you can specify a range via CharacteristicProps.validValueRanges * Implicitly a valid value range is predefined for characteristics with Format Formats.UINT8, Formats.UINT16, Formats.UINT32 and Formats.UINT64: starting by zero to their respective maximum number
The method will automatically detect which type of valid values definition is used and provide the correct Iterator for that case.
Note: This method is (obviously) only valid for numeric characteristics.
Example 1
// use the iterator to loop over every valid value...for (const value of characteristic.validValuesIterator()) {// Insert logic to run for every}// ... or collect them in an array for storage or manipulationconst validValues = Array.from(characteristic.validValuesIterator());
class ColorUtils
class ColorUtils {}
Utils
method colorTemperatureToHueAndSaturation
static colorTemperatureToHueAndSaturation: ( colorTemperature: number, roundResults?: boolean) => { saturation: number; hue: number };
Returns the Hue and Saturation representation of the given color temperature in mired.
Parameter colorTemperature
The color temperature in mired.
Parameter roundResults
The lookup table has a precision of .1 decimal places. The given characteristics only have a step value of 1. Thus, the method will round the results by default to an integer value. This can be turned off using this option.
Returns
An number array of length 2 with the first element being the saturation and the second argument being the hue.
class DataStreamConnection
class DataStreamConnection extends EventEmitter {}
DataStream connection which holds any necessary state information, encryption and decryption keys, manages protocol handlers and also handles sending and receiving of data stream frames.
HomeKit Data Streams (HDS)
constructor
constructor(socket: Socket);
property remoteAddress
readonly remoteAddress: string;
method addProtocolHandler
addProtocolHandler: ( protocol: string | Protocols, protocolHandler: DataStreamProtocolHandler) => boolean;
Registers a new protocol handler to handle incoming messages. The same protocol cannot be registered multiple times.
Parameter protocol
name of the protocol to register the handler for
Parameter protocolHandler
object to be registered as protocol handler
method close
close: () => void;
method decryptHDSFrame
decryptHDSFrame: (frame: HDSFrame, keyOverwrite?: Buffer) => boolean;
file-private API
method isConsideredClosed
isConsideredClosed: () => boolean;
method removeProtocolHandler
removeProtocolHandler: ( protocol: string | Protocols, protocolHandler: DataStreamProtocolHandler) => void;
Removes a protocol handler if it is registered.
Parameter protocol
name of the protocol to unregister the handler for
Parameter protocolHandler
object which will be unregistered
method sendEvent
sendEvent: ( protocol: string | Protocols, event: string | Topics, message?: Record<any, any>) => void;
Sends a new event message to the connected client.
Parameter protocol
name of the protocol
Parameter event
name of the event (also referred to as topic. See Topics for some known ones)
Parameter message
message dictionary which gets sent along the event
method sendRequest
sendRequest: ( protocol: string | Protocols, request: string | Topics, message: Record<any, any> | undefined, callback: ResponseHandler) => void;
Sends a new request message to the connected client.
Parameter protocol
name of the protocol
Parameter request
name of the request (also referred to as topic. See Topics for some known ones)
Parameter message
message dictionary which gets sent along the request
Parameter callback
handler which gets supplied with an error object if the response didn't arrive in time or the status and the message dictionary from the response
method sendResponse
sendResponse: ( protocol: string | Protocols, response: string | Topics, id: number, status?: HDSStatus, message?: Record<any, any>) => void;
Send a new response message to a received request message to the client.
Parameter protocol
name of the protocol
Parameter response
name of the response (also referred to as topic. See Topics for some known ones)
Parameter id
id from the request, to associate the response to the request
Parameter status
status indication if the request was successful. A status of zero indicates success.
Parameter message
message dictionary which gets sent along the response
class DataStreamManagement
class DataStreamManagement {}
HomeKit Data Streams (HDS)
constructor
constructor(service?: DataStreamTransportManagement);
method destroy
destroy: () => void;
method getService
getService: () => DataStreamTransportManagement;
Returns
the DataStreamTransportManagement service
method onEventMessage
onEventMessage: ( protocol: string | Protocols, event: string | Topics, handler: GlobalEventHandler) => this;
Registers a new event handler to handle incoming event messages. The handler is only called for a connection if for the give protocol no ProtocolHandler was registered on the connection level.
Parameter protocol
name of the protocol to register the handler for
Parameter event
name of the event (also referred to as topic. See Topics for some known ones)
Parameter handler
function to be called for every occurring event
method onRequestMessage
onRequestMessage: ( protocol: string | Protocols, request: string | Topics, handler: GlobalRequestHandler) => this;
Registers a new request handler to handle incoming request messages. The handler is only called for a connection if for the give protocol no ProtocolHandler was registered on the connection level.
Parameter protocol
name of the protocol to register the handler for
Parameter request
name of the request (also referred to as topic. See Topics for some known ones)
Parameter handler
function to be called for every occurring request
method onServerEvent
onServerEvent: ( event: DataStreamServerEvent, listener: (connection: DataStreamConnection) => void) => this;
Forwards any event listener for an DataStreamServer event to the DataStreamServer instance
Parameter event
the event to register for
Parameter listener
the event handler
method removeEventHandler
removeEventHandler: ( protocol: string | Protocols, event: string | Topics, handler: GlobalEventHandler) => this;
Removes a registered event handler.
Parameter protocol
name of the protocol to unregister the handler for
Parameter event
name of the event (also referred to as topic. See Topics for some known ones)
Parameter handler
registered event handler
method removeRequestHandler
removeRequestHandler: ( protocol: string | Protocols, request: string | Topics, handler: GlobalRequestHandler) => this;
Removes a registered request handler.
Parameter protocol
name of the protocol to unregister the handler for
Parameter request
name of the request (also referred to as topic. See Topics for some known ones)
Parameter handler
registered request handler
class DataStreamParser
class DataStreamParser {}
HomeKit Data Streams (HDS)
class DataStreamReader
class DataStreamReader {}
HomeKit Data Streams (HDS)
constructor
constructor(data: Buffer);
property readerIndex
readerIndex: number;
method decompressData
decompressData: (index: number) => any;
method finished
finished: () => void;
method readData
readData: (length: number) => Buffer;
method readData_Length16LE
readData_Length16LE: () => Buffer;
method readData_Length32LE
readData_Length32LE: () => Buffer;
method readData_Length64LE
readData_Length64LE: () => Buffer;
method readData_Length8
readData_Length8: () => Buffer;
method readData_terminated
readData_terminated: () => Buffer;
method readFalse
readFalse: () => false;
method readFloat32LE
readFloat32LE: () => number;
method readFloat64LE
readFloat64LE: () => number;
method readInt16LE
readInt16LE: () => number;
method readInt32LE
readInt32LE: () => number;
method readInt64LE
readInt64LE: () => number;
method readInt8
readInt8: () => number;
method readIntRange
readIntRange: (tag: number) => number;
method readNegOne
readNegOne: () => -1;
method readSecondsSince2001_01_01
readSecondsSince2001_01_01: () => number;
method readTag
readTag: () => number;
method readTrue
readTrue: () => true;
method readUTF8
readUTF8: (length: number) => string;
method readUTF8_Length16LE
readUTF8_Length16LE: () => string;
method readUTF8_Length32LE
readUTF8_Length32LE: () => string;
method readUTF8_Length64LE
readUTF8_Length64LE: () => string;
method readUTF8_Length8
readUTF8_Length8: () => string;
method readUTF8_NULL_terminated
readUTF8_NULL_terminated: () => string;
method readUUID
readUUID: () => string;
class DataStreamServer
class DataStreamServer extends EventEmitter {}
DataStreamServer which listens for incoming tcp connections and handles identification of new connections HomeKit Data Streams (HDS)
constructor
constructor();
property preparedSessions
preparedSessions: PreparedDataStreamSession[];
property version
static readonly version: string;
method destroy
destroy: () => void;
This method will fully stop the DataStreamServer
method onEventMessage
onEventMessage: ( protocol: string | Protocols, event: string | Topics, handler: GlobalEventHandler) => this;
Registers a new event handler to handle incoming event messages. The handler is only called for a connection if for the give protocol no ProtocolHandler was registered on the connection level.
Parameter protocol
name of the protocol to register the handler for
Parameter event
name of the event (also referred to as topic. See Topics for some known ones)
Parameter handler
function to be called for every occurring event
method onRequestMessage
onRequestMessage: ( protocol: string | Protocols, request: string | Topics, handler: GlobalRequestHandler) => this;
Registers a new request handler to handle incoming request messages. The handler is only called for a connection if for the give protocol no ProtocolHandler was registered on the connection level.
Parameter protocol
name of the protocol to register the handler for
Parameter request
name of the request (also referred to as topic. See Topics for some known ones)
Parameter handler
function to be called for every occurring request
method prepareSession
prepareSession: ( connection: HAPConnection, controllerKeySalt: Buffer, callback: PrepareSessionCallback) => void;
method removeEventHandler
removeEventHandler: ( protocol: string | Protocols, event: string | Topics, handler: GlobalEventHandler) => this;
Removes a registered event handler.
Parameter protocol
name of the protocol to unregister the handler for
Parameter event
name of the event (also referred to as topic. See Topics for some known ones)
Parameter handler
registered event handler
method removeRequestHandler
removeRequestHandler: ( protocol: string | Protocols, request: string | Topics, handler: GlobalRequestHandler) => this;
Removes a registered request handler.
Parameter protocol
name of the protocol to unregister the handler for
Parameter request
name of the request (also referred to as topic. See Topics for some known ones)
Parameter handler
registered request handler
class DataStreamWriter
class DataStreamWriter {}
HomeKit Data Streams (HDS)
constructor
constructor();
method getData
getData: () => Buffer;
method length
length: () => number;
method writeData
writeData: (data: Buffer) => void;
method writeFalse
writeFalse: () => void;
method writeFloat32LE
writeFloat32LE: (float32: Float32) => void;
method writeFloat64LE
writeFloat64LE: (float64: Float64) => void;
method writeInt16LE
writeInt16LE: (int16: Int16) => void;
method writeInt32LE
writeInt32LE: (int32: Int32) => void;
method writeInt64LE
writeInt64LE: (int64: Int64) => void;
method writeInt8
writeInt8: (int8: Int8) => void;
method writeNumber
writeNumber: (number: number) => void;
method writeSecondsSince2001_01_01
writeSecondsSince2001_01_01: (seconds: SecondsSince2001) => void;
method writeTag
writeTag: (tag: DataFormatTags) => void;
method writeTrue
writeTrue: () => void;
method writeUTF8
writeUTF8: (utf8: string) => void;
method writeUUID
writeUUID: (uuid_string: string) => void;
class DoorbellController
class DoorbellController extends CameraController {}
The
DoorbellController
to efficiently manage doorbell implementations with HAP-NodeJS.NOTICE: We subclass from the CameraController here and deliberately do not introduce/set an own/custom ControllerType for Doorbells, as Cameras and Doorbells are pretty much the same thing and would collide otherwise. As the possibility exists, both the CameraController and DoorbellController are written to support migration from one to another. Meaning a serialized CameraController can be initialized as a DoorbellController (on startup in initWithServices) and vice versa.
Doorbell
constructor
constructor(options: CameraControllerOptions & DoorbellOptions);
Initializes a new
DoorbellController
.Parameter options
The CameraControllerOptions and optional DoorbellOptions.
method configureServices
configureServices: () => void;
method constructServices
constructServices: () => CameraControllerServiceMap;
method handleControllerRemoved
handleControllerRemoved: () => void;
method initWithServices
initWithServices: ( serviceMap: CameraControllerServiceMap) => void | CameraControllerServiceMap;
method migrateFromDoorbell
protected migrateFromDoorbell: (serviceMap: ControllerServiceMap) => boolean;
method retrieveEventTriggerOptions
protected retrieveEventTriggerOptions: () => Set<EventTriggerOption>;
method ringDoorbell
ringDoorbell: () => void;
Call this method to signal a doorbell button press.
class EventedHTTPServer
class EventedHTTPServer extends EventEmitter {}
EventedHTTPServer provides an HTTP-like server that supports HAP "extensions" for security and events.
Implementation -------------- In order to implement the "custom HTTP" server required by the HAP protocol (see HAPServer.js) without completely reinventing the wheel, we create both a generic TCP socket server and a standard Node HTTP server. The TCP socket server acts as a proxy, allowing users of this class to transform data (for encryption) as necessary and passing through bytes directly to the HTTP server for processing. This way we get Node to do all the "heavy lifting" of HTTP like parsing headers and formatting responses.
Events are sent by simply waiting for current HTTP traffic to subside and then sending a custom response packet directly down the wire via the socket.
Each connection to the main TCP server gets its own internal HTTP server, so we can track ongoing requests/responses for safe event insertion.
HAP Accessory Server
constructor
constructor();
method address
address: () => AddressInfo;
method broadcastEvent
broadcastEvent: ( aid: number, iid: number, value: Nullable<CharacteristicValue>, originator?: HAPConnection, immediateDelivery?: boolean) => void;
Send an event notification for given characteristic and changed value to all connected clients. If
originator
is specified, the given HAPConnection will be excluded from the broadcast.Parameter aid
The accessory id of the updated characteristic.
Parameter iid
The instance id of the updated characteristic.
Parameter value
The newly set value of the characteristic.
Parameter originator
If specified, the connection will not get an event message.
Parameter immediateDelivery
The HAP spec requires some characteristics to be delivery immediately. Namely, for the Characteristic.ButtonEvent and the Characteristic.ProgrammableSwitchEvent characteristics.
method destroy
destroy: () => void;
method destroyExistingConnectionsAfterUnpair
static destroyExistingConnectionsAfterUnpair: ( initiator: HAPConnection, username: HAPUsername) => void;
This method is to be called when a given HAPConnection performs a request that should result in the disconnection of all other HAPConnection with the same HAPUsername.
The initiator MUST be in the middle of a http request were the response was not served yet. Otherwise, the initiator connection might reside in a state where it isn't disconnected and can't make any further requests.
Parameter initiator
The connection that requested to disconnect all connections of the same username.
Parameter username
The username for which all connections shall be closed.
method listen
listen: (targetPort: number, hostname?: string) => void;
method stop
stop: () => void;
class Float32
class Float32 extends ValueWrapper<number> {}
HomeKit Data Streams (HDS)
class Float64
class Float64 extends ValueWrapper<number> {}
HomeKit Data Streams (HDS)
class HAPConnection
class HAPConnection extends EventEmitter {}
Manages a single iOS-initiated HTTP connection during its lifetime. HAP Accessory Server
constructor
constructor(server: EventedHTTPServer, clientSocket: Socket);
property encryption
encryption?: HAPEncryption;
property lastSocketOperation
lastSocketOperation: number;
property localAddress
readonly localAddress: string;
property networkInterface
readonly networkInterface: string;
property remoteAddress
readonly remoteAddress: string;
property remotePort
readonly remotePort: number;
property server
readonly server: EventedHTTPServer;
file-private API
property sessionID
readonly sessionID: string;
property srpServer
srpServer?: SrpServer;
property timedWritePid
timedWritePid?: number;
property timedWriteTimeout
timedWriteTimeout?: NodeJS.Timeout;
property username
username?: string;
method addListener
addListener: ( event: string | symbol, listener: (...args: any[]) => void) => this;
method clearRegisteredEvents
clearRegisteredEvents: () => void;
method close
close: () => void;
method closeConnectionAsOfUnpair
closeConnectionAsOfUnpair: (initiator: HAPConnection) => void;
method connectionAuthenticated
connectionAuthenticated: (username: HAPUsername) => void;
This method is called once the connection has gone through pair-verify. As any HomeKit controller will initiate a pair-verify after the pair-setup procedure, this method gets not called on the initial pair-setup.
Once this method has been called, the connection is authenticated and encryption is turned on.
method disableEventNotifications
disableEventNotifications: (aid: number, iid: number) => void;
method enableEventNotifications
enableEventNotifications: (aid: number, iid: number) => void;
method getLocalAddress
getLocalAddress: (ipVersion: 'ipv4' | 'ipv6') => string;
method getRegisteredEvents
getRegisteredEvents: () => Set<EventName>;
method hasEventNotifications
hasEventNotifications: (aid: number, iid: number) => boolean;
method isAuthenticated
isAuthenticated: () => boolean;
method off
off: (event: string | symbol, listener: (...args: any[]) => void) => this;
method removeListener
removeListener: ( event: string | symbol, listener: (...args: any[]) => void) => this;
method sendEvent
sendEvent: ( aid: number, iid: number, value: Nullable<CharacteristicValue>, immediateDelivery?: boolean) => void;
class HAPEncryption
class HAPEncryption {}
Simple struct to hold vars needed to support HAP encryption.
Cryptography
constructor
constructor( clientPublicKey: Buffer, secretKey: Buffer, publicKey: Buffer, sharedSecret: Buffer, hkdfPairEncryptionKey: Buffer);
property accessoryToControllerCount
accessoryToControllerCount: number;
property accessoryToControllerKey
accessoryToControllerKey: Buffer;
property clientPublicKey
readonly clientPublicKey: Buffer;
property controllerToAccessoryCount
controllerToAccessoryCount: number;
property controllerToAccessoryKey
controllerToAccessoryKey: Buffer;
property hkdfPairEncryptionKey
readonly hkdfPairEncryptionKey: Buffer;
property incompleteFrame
incompleteFrame?: Buffer;
property publicKey
readonly publicKey: Buffer;
property secretKey
readonly secretKey: Buffer;
property sharedSecret
readonly sharedSecret: Buffer;
class HAPServer
class HAPServer extends EventEmitter {}
The actual HAP server that iOS devices talk to.
Notes ----- It turns out that the IP-based version of HomeKit's HAP protocol operates over a sort of pseudo-HTTP. Accessories are meant to host a TCP socket server that initially behaves exactly as an HTTP/1.1 server. So iOS devices will open up a long-lived connection to this server and begin issuing HTTP requests. So far, this conforms with HTTP/1.1 Keepalive. However, after the "pairing" process is complete, the connection is expected to be "upgraded" to support full-packet encryption of both HTTP headers and data. This encryption is NOT SSL. It is a customized ChaCha20+Poly1305 encryption layer.
Additionally, this "HTTP Server" supports sending "event" responses at any time without warning. The iOS device simply keeps the connection open after it's finished with HTTP request/response traffic, and while the connection is open, the server can elect to issue "EVENT/1.0 200 OK" HTTP-style responses. These are typically sent to inform the iOS device of a characteristic change for the accessory (like "Door was Unlocked").
See EventedHTTPServer for more detail on the implementation of this protocol.
HAP Accessory Server
constructor
constructor(accessoryInfo: AccessoryInfo);
property allowInsecureRequest
allowInsecureRequest: boolean;
method destroy
destroy: () => void;
method listen
listen: (port?: number, host?: string) => void;
method sendEventNotifications
sendEventNotifications: ( aid: number, iid: number, value: Nullable<CharacteristicValue>, originator?: HAPConnection, immediateDelivery?: boolean) => void;
Send an even notification for given characteristic and changed value to all connected clients. If
originator
is specified, the given HAPConnection will be excluded from the broadcast.Parameter aid
The accessory id of the updated characteristic.
Parameter iid
The instance id of the updated characteristic.
Parameter value
The newly set value of the characteristic.
Parameter originator
If specified, the connection will not get an event message.
Parameter immediateDelivery
The HAP spec requires some characteristics to be delivery immediately. Namely, for the Characteristic.ButtonEvent and the Characteristic.ProgrammableSwitchEvent characteristics.
method stop
stop: () => void;
class HapStatusError
class HapStatusError extends Error {}
Throws a HAP status error that is sent back to HomeKit.
Example 1
throw new HapStatusError(HAPStatus.OPERATION_TIMED_OUT);Utils
constructor
constructor(status: HAPStatus);
property hapStatus
hapStatus: HAPStatus;
class HAPStorage
class HAPStorage {}
Model
method setCustomStoragePath
static setCustomStoragePath: (path: string) => void;
method storage
static storage: () => LocalStorage;
class HDSConnectionError
class HDSConnectionError extends Error {}
HomeKit Data Streams (HDS)
constructor
constructor(message: string, type: HDSConnectionErrorType);
property type
readonly type: HDSConnectionErrorType;
class HDSProtocolError
class HDSProtocolError extends Error {}
An error indicating a protocol level HDS error. E.g. it may be used to encode a HDSStatus.PROTOCOL_SPECIFIC_ERROR in the Protocols.DATA_SEND protocol. HomeKit Data Streams (HDS)
constructor
constructor(reason: HDSProtocolSpecificErrorReason);
Initializes a new
HDSProtocolError
Parameter reason
The HDSProtocolSpecificErrorReason. Values MUST NOT be HDSProtocolSpecificErrorReason.NORMAL.
property reason
reason: HDSProtocolSpecificErrorReason;
class Int16
class Int16 extends ValueWrapper<number> {}
HomeKit Data Streams (HDS)
class Int32
class Int32 extends ValueWrapper<number> {}
HomeKit Data Streams (HDS)
class Int64
class Int64 extends ValueWrapper<number> {}
HomeKit Data Streams (HDS)
class Int8
class Int8 extends ValueWrapper<number> {}
HomeKit Data Streams (HDS)
class RecordingManagement
class RecordingManagement {}
Camera
constructor
constructor( options: CameraRecordingOptions, delegate: CameraRecordingDelegate, eventTriggerOptions: Set<EventTriggerOption>, services?: RecordingManagementServices);
property dataStreamManagement
readonly dataStreamManagement: DataStreamManagement;
property delegate
readonly delegate: CameraRecordingDelegate;
property operatingModeService
readonly operatingModeService: CameraOperatingMode;
property options
readonly options: CameraRecordingOptions;
property recordingManagementService
readonly recordingManagementService: CameraRecordingManagement;
property sensorServices
sensorServices: Service[];
Array of sensor services (e.g. Service.MotionSensor or Service.OccupancySensor). Any service in this array owns a Characteristic.StatusActive characteristic. The value of the Characteristic.HomeKitCameraActive is mirrored towards the Characteristic.StatusActive characteristic. The array is initialized my the caller shortly after calling the constructor.
method deserialize
deserialize: (serialized: RecordingManagementState) => void;
method destroy
destroy: () => void;
method handleFactoryReset
handleFactoryReset: () => void;
method serialize
serialize: () => RecordingManagementState | undefined;
method setupStateChangeDelegate
setupStateChangeDelegate: (delegate?: StateChangeDelegate) => void;
class RemoteController
class RemoteController extends EventEmitter implements SerializableController< RemoteControllerServiceMap, SerializedControllerState >, DataStreamProtocolHandler {}
Handles everything needed to implement a fully working HomeKit remote controller.
Apple TV Remote
constructor
constructor( audioProducerConstructor?: SiriAudioStreamProducerConstructor, producerOptions?: any);
Creates a new RemoteController. If siri voice input is supported the constructor to an SiriAudioStreamProducer needs to be supplied. Otherwise, a remote without voice support will be created.
For every audio session a new SiriAudioStreamProducer will be constructed.
Parameter audioProducerConstructor
constructor for a SiriAudioStreamProducer
Parameter producerOptions
if supplied this argument will be supplied as third argument of the SiriAudioStreamProducer constructor. This should be used to supply configurations to the stream producer.
property activeIdentifier
activeIdentifier: number;
property eventHandler
eventHandler?: Record<string, EventHandler>;
property requestHandler
requestHandler?: Record<string, RequestHandler>;
property targetConfigurations
targetConfigurations: Map<number, TargetConfiguration>;
method configureServices
configureServices: () => void;
method constructServices
constructServices: () => RemoteControllerServiceMap;
method constructSupportedAudioConfiguration
protected constructSupportedAudioConfiguration: () => SupportedAudioStreamConfiguration;
method constructSupportedConfiguration
protected constructSupportedConfiguration: () => SupportedConfiguration;
method controllerId
controllerId: () => ControllerIdentifier;
method deserialize
deserialize: (serialized: SerializedControllerState) => void;
method getTargetIdentifierByName
getTargetIdentifierByName: (name: string) => number | undefined;
Returns the targetIdentifier for a give device name
Parameter name
The name of the device.
Returns
The targetIdentifier of the device or undefined if not existent.
method handleControllerRemoved
handleControllerRemoved: () => void;
method handleFactoryReset
handleFactoryReset: () => void;
method initWithServices
initWithServices: ( serviceMap: RemoteControllerServiceMap) => void | RemoteControllerServiceMap;
method isActive
isActive: () => boolean;
Returns
if the current target is active, meaning the active device is listening for button events or audio sessions
method isConfigured
isConfigured: (targetIdentifier: number) => boolean;
Checks if the supplied targetIdentifier is configured.
Parameter targetIdentifier
The target identifier.
method pushAndReleaseButton
pushAndReleaseButton: (button: ButtonType, time?: number) => void;
Presses a supplied button for a given time.
Parameter button
button to be pressed and released
Parameter time
time in milliseconds (defaults to 200ms)
method pushButton
pushButton: (button: ButtonType) => void;
Sends a button event to press the supplied button.
Parameter button
button to be pressed
method releaseButton
releaseButton: (button: ButtonType) => void;
Sends a button event that the supplied button was released.
Parameter button
button which was released
method serialize
serialize: () => SerializedControllerState | undefined;
method setActiveIdentifier
setActiveIdentifier: (activeIdentifier: number) => void;
Set a new target as active target. A value of 0 indicates that no target is selected currently.
Parameter activeIdentifier
target identifier
method setupStateChangeDelegate
setupStateChangeDelegate: (delegate?: StateChangeDelegate) => void;
class RTPStreamManagement
class RTPStreamManagement {}
Camera
constructor
constructor( id: number, options: CameraStreamingOptions, delegate: CameraStreamingDelegate, service?: CameraRTPStreamManagement, disabledThroughOperatingMode?: () => boolean);
property audioProxy
audioProxy?: RTPProxy;
deprecated API
property disableAudioProxy
disableAudioProxy: boolean;
property requireProxy
requireProxy: boolean;
property selectedConfiguration
selectedConfiguration: string;
property service
readonly service: CameraRTPStreamManagement;
property sessionIdentifier
sessionIdentifier?: string;
property setupEndpointsResponse
setupEndpointsResponse: string;
property streamStatus
streamStatus: StreamingStatus;
private API
property supportedAudioStreamConfiguration
readonly supportedAudioStreamConfiguration: string;
property supportedCryptoSuites
supportedCryptoSuites: SRTPCryptoSuites[];
property supportedRTPConfiguration
readonly supportedRTPConfiguration: string;
property supportedVideoStreamConfiguration
readonly supportedVideoStreamConfiguration: string;
property videoOnly
videoOnly: boolean;
property videoProxy
videoProxy?: RTPProxy;
deprecated API
method deserialize
deserialize: (serialized: RTPStreamManagementState) => void;
method destroy
destroy: () => void;
method forceStop
forceStop: () => void;
method getService
getService: () => CameraRTPStreamManagement;
method handleFactoryReset
handleFactoryReset: () => void;
method serialize
serialize: () => RTPStreamManagementState | undefined;
method setupStateChangeDelegate
setupStateChangeDelegate: (delegate?: StateChangeDelegate) => void;
class SecondsSince2001
class SecondsSince2001 extends ValueWrapper<number> {}
HomeKit Data Streams (HDS)
class Service
class Service extends EventEmitter {}
Service represents a set of grouped values necessary to provide a logical function. For instance, a "Door Lock Mechanism" service might contain two values, one for the "desired lock state" and one for the "current lock state". A particular Service is distinguished from others by its "type", which is a UUID. HomeKit provides a set of known Service UUIDs defined in HomeKit.ts along with a corresponding concrete subclass that you can instantiate directly to set up the necessary values. These natively-supported Services are expected to contain a particular set of Characteristics.
Unlike Characteristics, where you cannot have two Characteristics with the same UUID in the same Service, you can actually have multiple Services with the same UUID in a single Accessory. For instance, imagine a Garage Door Opener with both a "security light" and a "backlight" for the display. Each light could be a "Lightbulb" Service with the same UUID. To account for this situation, we define an extra "subtype" property on Service, that can be a string or other string-convertible object that uniquely identifies the Service among its peers in an Accessory. For instance, you might have
service1.subtype = 'security_light'
for one andservice2.subtype = 'backlight'
for the other.You can also define custom Services by providing your own UUID for the type that you generate yourself. Custom Services can contain an arbitrary set of Characteristics, but Siri will likely not be able to work with these.
Service
constructor
constructor(displayName: string, UUID: string, subtype?: string);
property AccessCode
static AccessCode: typeof AccessCode;
Service Definitions
property AccessControl
static AccessControl: typeof AccessControl;
Service Definitions
property AccessoryInformation
static AccessoryInformation: typeof AccessoryInformation;
Service Definitions
property AccessoryMetrics
static AccessoryMetrics: typeof AccessoryMetrics;
Service Definitions
property AccessoryRuntimeInformation
static AccessoryRuntimeInformation: typeof AccessoryRuntimeInformation;
Service Definitions
property AirPurifier
static AirPurifier: typeof AirPurifier;
Service Definitions
property AirQualitySensor
static AirQualitySensor: typeof AirQualitySensor;
Service Definitions
property AssetUpdate
static AssetUpdate: typeof AssetUpdate;
Service Definitions
property Assistant
static Assistant: typeof Assistant;
Service Definitions
property AudioStreamManagement
static AudioStreamManagement: typeof AudioStreamManagement;
Service Definitions
property Battery
static Battery: typeof Battery;
Service Definitions
property CameraOperatingMode
static CameraOperatingMode: typeof CameraOperatingMode;
Service Definitions
property CameraRecordingManagement
static CameraRecordingManagement: typeof CameraRecordingManagement;
Service Definitions
property CameraRTPStreamManagement
static CameraRTPStreamManagement: typeof CameraRTPStreamManagement;
Service Definitions
property CarbonDioxideSensor
static CarbonDioxideSensor: typeof CarbonDioxideSensor;
Service Definitions
property CarbonMonoxideSensor
static CarbonMonoxideSensor: typeof CarbonMonoxideSensor;
Service Definitions
property characteristics
characteristics: Characteristic[];
property CloudRelay
static CloudRelay: typeof CloudRelay;
Service Definitions
property ContactSensor
static ContactSensor: typeof ContactSensor;
Service Definitions
property DataStreamTransportManagement
static DataStreamTransportManagement: typeof DataStreamTransportManagement;
Service Definitions
property Diagnostics
static Diagnostics: typeof Diagnostics;
Service Definitions
property displayName
displayName: string;
property Door
static Door: typeof Door;
Service Definitions
property Doorbell
static Doorbell: typeof Doorbell;
Service Definitions
property Fan
static Fan: typeof Fan;
Service Definitions
property Fanv2
static Fanv2: typeof Fanv2;
Service Definitions
property Faucet
static Faucet: typeof Faucet;
Service Definitions
property FilterMaintenance
static FilterMaintenance: typeof FilterMaintenance;
Service Definitions
property FirmwareUpdate
static FirmwareUpdate: typeof FirmwareUpdate;
Service Definitions
property GarageDoorOpener
static GarageDoorOpener: typeof GarageDoorOpener;
Service Definitions
property HeaterCooler
static HeaterCooler: typeof HeaterCooler;
Service Definitions
property HumidifierDehumidifier
static HumidifierDehumidifier: typeof HumidifierDehumidifier;
Service Definitions
property HumiditySensor
static HumiditySensor: typeof HumiditySensor;
Service Definitions
property iid
iid: number;
property InputSource
static InputSource: typeof InputSource;
Service Definitions
property IrrigationSystem
static IrrigationSystem: typeof IrrigationSystem;
Service Definitions
property isHiddenService
isHiddenService: boolean;
property isPrimaryService
isPrimaryService: boolean;
property LeakSensor
static LeakSensor: typeof LeakSensor;
Service Definitions
property Lightbulb
static Lightbulb: typeof Lightbulb;
Service Definitions
property LightSensor
static LightSensor: typeof LightSensor;
Service Definitions
property linkedServices
linkedServices: Service[];
property LockManagement
static LockManagement: typeof LockManagement;
Service Definitions
property LockMechanism
static LockMechanism: typeof LockMechanism;
Service Definitions
property Microphone
static Microphone: typeof Microphone;
Service Definitions
property MotionSensor
static MotionSensor: typeof MotionSensor;
Service Definitions
property name
name: string;
property NFCAccess
static NFCAccess: typeof NFCAccess;
Service Definitions
property OccupancySensor
static OccupancySensor: typeof OccupancySensor;
Service Definitions
property optionalCharacteristics
optionalCharacteristics: Characteristic[];
property Outlet
static Outlet: typeof Outlet;
Service Definitions
property Pairing
static Pairing: typeof Pairing;
Service Definitions
property PowerManagement
static PowerManagement: typeof PowerManagement;
Service Definitions
property ProtocolInformation
static ProtocolInformation: typeof ProtocolInformation;
Service Definitions
property SecuritySystem
static SecuritySystem: typeof SecuritySystem;
Service Definitions
property ServiceLabel
static ServiceLabel: typeof ServiceLabel;
Service Definitions
property Siri
static Siri: typeof Siri;
Service Definitions
property SiriEndpoint
static SiriEndpoint: typeof SiriEndpoint;
Service Definitions
property Slats
static Slats: typeof Slats;
Service Definitions
property SmartSpeaker
static SmartSpeaker: typeof SmartSpeaker;
Service Definitions
property SmokeSensor
static SmokeSensor: typeof SmokeSensor;
Service Definitions
property Speaker
static Speaker: typeof Speaker;
Service Definitions
property StatefulProgrammableSwitch
static StatefulProgrammableSwitch: typeof StatefulProgrammableSwitch;
Service Definitions
property StatelessProgrammableSwitch
static StatelessProgrammableSwitch: typeof StatelessProgrammableSwitch;
Service Definitions
property subtype
subtype?: string;
property Switch
static Switch: typeof Switch;
Service Definitions
property TapManagement
static TapManagement: typeof TapManagement;
Service Definitions
property TargetControl
static TargetControl: typeof TargetControl;
Service Definitions
property TargetControlManagement
static TargetControlManagement: typeof TargetControlManagement;
Service Definitions
property Television
static Television: typeof Television;
Service Definitions
property TelevisionSpeaker
static TelevisionSpeaker: typeof TelevisionSpeaker;
Service Definitions
property TemperatureSensor
static TemperatureSensor: typeof TemperatureSensor;
Service Definitions
property Thermostat
static Thermostat: typeof Thermostat;
Service Definitions
property ThreadTransport
static ThreadTransport: typeof ThreadTransport;
Service Definitions
property TransferTransportManagement
static TransferTransportManagement: typeof TransferTransportManagement;
Service Definitions
property Tunnel
static Tunnel: typeof Tunnel;
Service Definitions
property UUID
UUID: string;
property Valve
static Valve: typeof Valve;
Service Definitions
property WiFiRouter
static WiFiRouter: typeof WiFiRouter;
Service Definitions
property WiFiSatellite
static WiFiSatellite: typeof WiFiSatellite;
Service Definitions
property WiFiTransport
static WiFiTransport: typeof WiFiTransport;
Service Definitions
property Window
static Window: typeof Window;
Service Definitions
property WindowCovering
static WindowCovering: typeof WindowCovering;
Service Definitions
method addCharacteristic
addCharacteristic: { (input: Characteristic): Characteristic; ( input: new (...args: any[]) => Characteristic, ...constructorArgs: any[] ): Characteristic;};
method addLinkedService
addLinkedService: (service: Service) => void;
Adds a new link to the specified service. The service MUST be already added to the SAME accessory.
Parameter service
The service this service should link to
method addOptionalCharacteristic
addOptionalCharacteristic: ( characteristic: Characteristic | { new (): Characteristic }) => void;
method deserialize
static deserialize: (json: SerializedService) => Service;
method getCharacteristic
getCharacteristic: { (constructor: WithUUID<{ new (): Characteristic }>): Characteristic; (name: string | WithUUID<new () => Characteristic>): Characteristic;};
method getCharacteristicByIID
getCharacteristicByIID: (iid: number) => Characteristic | undefined;
method getServiceId
getServiceId: () => ServiceId;
Returns an id which uniquely identifies a service on the associated accessory. The serviceId is a concatenation of the UUID for the service (defined by HAP) and the subtype (could be empty) which is programmatically defined by the programmer.
Returns
the serviceId
method internalHAPRepresentation
internalHAPRepresentation: () => ServiceJsonObject;
Returns a JSON representation of this service without characteristic values. used to generate the config hash
method removeCharacteristic
removeCharacteristic: (characteristic: Characteristic) => void;
method removeLinkedService
removeLinkedService: (service: Service) => void;
Removes a link to the specified service which was previously added with addLinkedService
Parameter service
Previously linked service
method replaceCharacteristicsFromService
replaceCharacteristicsFromService: (service: Service) => void;
This method was created to copy all characteristics from another service to this. It's only adopting is currently in homebridge to merge the AccessoryInformation service. So some things may be explicitly tailored towards this use case.
It will not remove characteristics which are present currently but not added on the other characteristic. It will not replace the characteristic if the value is falsy (except of '0' or 'false')
Parameter service
used by homebridge
method serialize
static serialize: (service: Service) => SerializedService;
method setCharacteristic
setCharacteristic: { <T extends WithUUID<new () => Characteristic>>( name: string | T, value: CharacteristicValue ): Service; <T extends WithUUID<new () => Characteristic>>( name: string | T, error: HapStatusError | Error ): Service;};
This updates the value by calling the CharacteristicEventTypes.SET event handler associated with the characteristic. This acts the same way as when a HomeKit controller sends a
/characteristics
request to update the characteristic. An event notification will be sent to all connected HomeKit controllers which are registered to receive event notifications for this characteristic.This method behaves like a Characteristic.updateValue call with the addition that the own CharacteristicEventTypes.SET event handler is called.
Parameter name
The name or the constructor of the desired Characteristic.
Parameter value
The updated value.
Note: If you don't want the CharacteristicEventTypes.SET to be called, refer to updateCharacteristic.
Sets the state of the characteristic to an errored state.
If a Characteristic.onGet or CharacteristicEventTypes.GET handler is set up, the errored state will be ignored and the characteristic will always query the latest state by calling the provided handler.
If a generic error object is supplied, the characteristic tries to extract a HAPStatus code from the error message string. If not possible a generic HAPStatus.SERVICE_COMMUNICATION_FAILURE will be used. If the supplied error object is an instance of HapStatusError the corresponding status will be used.
This doesn't call any registered Characteristic.onSet or CharacteristicEventTypes.SET handlers.
Have a look at the guide for more information on how to present erroneous state to the user.
Parameter name
The name or the constructor of the desired Characteristic.
Parameter error
The error object
Note: Erroneous state is never **pushed** to the client side. Only, if the HomeKit client requests the current state of the Characteristic, the corresponding HapStatusError is returned. As described above, any Characteristic.onGet or CharacteristicEventTypes.GET handlers have preference.
method setHiddenService
setHiddenService: (isHidden?: boolean) => void;
Marks the service as hidden
Parameter isHidden
optional boolean (default true) if the service should be marked hidden
method setPrimaryService
setPrimaryService: (isPrimary?: boolean) => void;
Sets this service as the new primary service. Any currently active primary service will be reset to be not primary. This will happen immediately, if the service was already added to an accessory, or later when the service gets added to an accessory.
Parameter isPrimary
optional boolean (default true) if the service should be the primary service
method testCharacteristic
testCharacteristic: <T extends WithUUID<typeof Characteristic>>( name: string | T) => boolean;
method toHAP
toHAP: ( connection: HAPConnection, contactGetHandlers?: boolean) => Promise<ServiceJsonObject>;
Returns a JSON representation of this service suitable for delivering to HAP clients. used to generate response to /accessories query
method updateCharacteristic
updateCharacteristic: { <T extends WithUUID<new () => Characteristic>>( name: string | T, value: Nullable<CharacteristicValue> ): Service; <T extends WithUUID<new () => Characteristic>>( name: string | T, error: HapStatusError | Error ): Service;};
This updates the value of the characteristic. If the value changed, an event notification will be sent to all connected HomeKit controllers which are registered to receive event notifications for this characteristic.
Parameter name
The name or the constructor of the desired Characteristic.
Parameter value
The new value.
Sets the state of the characteristic to an errored state. If a Characteristic.onGet or CharacteristicEventTypes.GET handler is set up, the errored state will be ignored and the characteristic will always query the latest state by calling the provided handler.
If a generic error object is supplied, the characteristic tries to extract a HAPStatus code from the error message string. If not possible a generic HAPStatus.SERVICE_COMMUNICATION_FAILURE will be used. If the supplied error object is an instance of HapStatusError the corresponding status will be used.
Parameter name
The name or the constructor of the desired Characteristic.
Parameter error
The error object
Have a look at the guide for more information on how to present erroneous state to the user.
Note: Erroneous state is never **pushed** to the client side. Only, if the HomeKit client requests the current state of the Characteristic, the corresponding HapStatusError is returned. As described above, any Characteristic.onGet or CharacteristicEventTypes.GET handlers have precedence.
class SiriAudioSession
class SiriAudioSession extends EventEmitter {}
Represents an ongoing audio transmission Apple TV Remote
constructor
constructor( connection: DataStreamConnection, selectedAudioConfiguration: AudioCodecConfiguration, producerConstructor: SiriAudioStreamProducerConstructor, producerOptions?: any);
property connection
readonly connection: DataStreamConnection;
property endOfStream
endOfStream: boolean;
property state
state: SiriAudioSessionState;
file private API
property streamId
streamId?: number;
method handleDataSendAckEvent
handleDataSendAckEvent: (endOfStream: boolean) => void;
method handleDataSendCloseEvent
handleDataSendCloseEvent: (reason: HDSProtocolSpecificErrorReason) => void;
method isClosing
isClosing: () => boolean;
Returns
if the audio session is closing
method start
start: () => void;
Called when siri button is pressed
method stop
stop: () => void;
Called when siri button is released (or active identifier is changed to another device)
class UUID
class UUID extends ValueWrapper<string> {}
HomeKit Data Streams (HDS)
constructor
constructor(value: string);
class ValueWrapper
class ValueWrapper<T> {}
HomeKit Data Streams (HDS)
constructor
constructor(value: {});
property value
value: {};
method equals
equals: (obj: ValueWrapper<T>) => boolean;
Interfaces
interface AccessControlManagement
interface AccessControlManagement {}
Television
method emit
emit: { (event: 'update-control-level', accessLevel: AccessLevel): boolean; ( event: 'update-password', password: string, passwordRequired: boolean ): boolean;};
method on
on: { ( event: 'update-control-level', listener: (accessLevel: AccessLevel) => void ): this; ( event: 'update-password', listener: (password: string, passwordRequired: boolean) => void ): this;};
interface AccessoriesResponse
interface AccessoriesResponse {}
HAP Accessory Server
property accessories
accessories: AccessoryJsonObject[];
interface Accessory
interface Accessory {}
Accessory
method emit
emit: { (event: 'identify', paired: boolean, callback: VoidCallback): boolean; (event: 'listening', port: number, address: string): boolean; (event: 'advertised'): boolean; ( event: 'service-configurationChange', change: ServiceConfigurationChange ): boolean; ( event: 'service-characteristic-change', change: AccessoryCharacteristicChange ): boolean; (event: 'paired'): boolean; (event: 'unpaired'): boolean; (event: 'characteristic-warning', warning: CharacteristicWarning): boolean;};
method on
on: { ( event: 'identify', listener: (paired: boolean, callback: VoidCallback) => void ): this; ( event: 'listening', listener: (port: number, address: string) => void ): this; (event: 'advertised', listener: () => void): this; ( event: 'service-configurationChange', listener: (change: ServiceConfigurationChange) => void ): this; ( event: 'service-characteristic-change', listener: (change: AccessoryCharacteristicChange) => void ): this; (event: 'paired', listener: () => void): this; (event: 'unpaired', listener: () => void): this; ( event: 'characteristic-warning', listener: (warning: CharacteristicWarning) => void ): this;};
interface AccessoryJsonObject
interface AccessoryJsonObject {}
HAP Accessory Server
interface ActiveAdaptiveLightingTransition
interface ActiveAdaptiveLightingTransition {}
Adaptive Lighting
property brightnessAdjustmentRange
brightnessAdjustmentRange: BrightnessAdjustmentMultiplierRange;
property brightnessCharacteristicIID
brightnessCharacteristicIID: number;
property id3
id3?: string;
Hex string of 8 bytes. Some kind of id (?). Sometimes it isn't supplied. Don't know the use for that.
property iid
iid: number;
The instance id for the characteristic for which this transition applies to (aka the ColorTemperature characteristic).
property notifyIntervalThreshold
notifyIntervalThreshold: number;
Defines the interval in milliseconds on how often the accessory may send even notifications to subscribed HomeKit controllers (aka call Characteristic.updateValue. Typically this is 600000 aka 600 seconds aka 10 minutes or 300000 aka 300 seconds aka 5 minutes.
property timeMillisOffset
timeMillisOffset: number;
It is not necessarily given, that we have the same time (or rather the correct time) as the HomeKit controller who set up the transition schedule. Thus we record the delta between our current time and the the time sent with the setup request. timeMillisOffset is defined as Date.now() - transitionStartMillis;. So in the case were we actually have a correct local time, it most likely will be positive (due to network latency). But of course it can also be negative.
property transitionCurve
transitionCurve: AdaptiveLightingTransitionCurveEntry[];
property transitionId
transitionId: string;
Value is the same for ALL control write requests I have seen (even on other homes).
property transitionStartBuffer
transitionStartBuffer: string;
Start of transition in milliseconds from 2001-01-01 00:00:00; unsigned 64 bit LE integer as it is a 64 bit integer, we just store the buffer to not have the struggle to encode/decode 64 bit int in JavaScript
property transitionStartMillis
transitionStartMillis: number;
Start of the transition in epoch time millis (as sent from the HomeKit controller). Additionally see timeMillisOffset.
property updateInterval
updateInterval: number;
Interval in milliseconds specifies how often the accessory should update the color temperature (internally). Typically this is 60000 aka 60 seconds aka 1 minute. Note notifyIntervalThreshold
interface AdaptiveLightingController
interface AdaptiveLightingController {}
Adaptive Lighting
method emit
emit: { (event: 'update', update: AdaptiveLightingControllerUpdate): boolean; (event: 'disable'): boolean;};
method on
on: { ( event: 'update', listener: (update: AdaptiveLightingControllerUpdate) => void ): this; (event: 'disable', listener: () => void): this;};
See AdaptiveLightingControllerEvents.UPDATE Also see AdaptiveLightingControllerUpdate
Parameter event
Parameter listener
interface AdaptiveLightingControllerUpdate
interface AdaptiveLightingControllerUpdate {}
Adaptive Lighting see ActiveAdaptiveLightingTransition.
property brightnessAdjustmentRange
brightnessAdjustmentRange: BrightnessAdjustmentMultiplierRange;
property notifyIntervalThreshold
notifyIntervalThreshold: number;
property timeMillisOffset
timeMillisOffset: number;
property transitionCurve
transitionCurve: AdaptiveLightingTransitionCurveEntry[];
property transitionStartMillis
transitionStartMillis: number;
property updateInterval
updateInterval: number;
interface AdaptiveLightingOptions
interface AdaptiveLightingOptions {}
Adaptive Lighting
property controllerMode
controllerMode?: AdaptiveLightingControllerMode;
Defines how the controller will operate. You can choose between automatic and manual mode. See AdaptiveLightingControllerMode.
property customTemperatureAdjustment
customTemperatureAdjustment?: number;
Defines a custom temperature adjustment factor.
This can be used to define a linear deviation from the HomeKit Controller defined ColorTemperature schedule.
For example supplying a value of
-10
will reduce the ColorTemperature, which is calculated from the transition schedule, by 10 mired for every change.
interface AdaptiveLightingTransitionCurveEntry
interface AdaptiveLightingTransitionCurveEntry {}
Adaptive Lighting
property brightnessAdjustmentFactor
brightnessAdjustmentFactor: number;
The color temperature actually set to the color temperature characteristic is dependent on the current brightness value of the lightbulb. This means you will always need to query the current brightness when updating the color temperature for the next transition step. Additionally you will also need to correct the color temperature when the end user changes the brightness of the Lightbulb.
The brightnessAdjustmentFactor is always a negative floating point value.
To calculate the resulting color temperature you will need to do the following.
In short: temperature + brightnessAdjustmentFactor * currentBrightness
Complete example:
const temperature = ...; // next transition value, the above property// below query the current brightness while staying the the min/max brightness range (typically between 10-100 percent)const currentBrightness = Math.max(minBrightnessValue, Math.min(maxBrightnessValue, CHARACTERISTIC_BRIGHTNESS_VALUE));// as both temperature and brightnessAdjustmentFactor are floating point values it is advised to round to the next integerconst resultTemperature = Math.round(temperature + brightnessAdjustmentFactor * currentBrightness);
property duration
duration?: number;
The duration in milliseconds this exact temperature value stays the same. When we transition to to the temperature value represented by this entry, it stays for the specified duration on the exact same value (with respect to brightness adjustment) until we transition to the next entry (see transitionTime).
property temperature
temperature: number;
The color temperature in mired.
property transitionTime
transitionTime: number;
The time in milliseconds the color temperature should transition from the previous entry to this one. For example if we got the two values A and B, with A.temperature = 300 and B.temperature = 400 and for the current time we are at temperature value 300. Then we need to transition smoothly within the B.transitionTime to the B.temperature value. If this is the first entry in the Curve (this value is probably zero) and is the offset to the transitionStartMillis (the Date/Time were this transition curve was set up).
interface AdaptiveLightingTransitionPoint
interface AdaptiveLightingTransitionPoint {}
Adaptive Lighting
property lowerBound
lowerBound: AdaptiveLightingTransitionCurveEntry;
property lowerBoundTimeOffset
lowerBoundTimeOffset: number;
This is the time offset from the transition start to the lowerBound.
property transitionOffset
transitionOffset: number;
property upperBound
upperBound: AdaptiveLightingTransitionCurveEntry;
interface BrightnessAdjustmentMultiplierRange
interface BrightnessAdjustmentMultiplierRange {}
Adaptive Lighting
property maxBrightnessValue
maxBrightnessValue: number;
property minBrightnessValue
minBrightnessValue: number;
interface CameraController
interface CameraController {}
Camera
method emit
emit: { (event: 'microphone-change', muted: boolean, volume: number): boolean; (event: 'speaker-change', muted: boolean, volume: number): boolean;};
method on
on: { ( event: 'microphone-change', listener: (muted: boolean, volume: number) => void ): this; ( event: 'speaker-change', listener: (muted: boolean, volume: number) => void ): this;};
interface CameraControllerOptions
interface CameraControllerOptions {}
Camera
property cameraStreamCount
cameraStreamCount?: number;
Amount of parallel camera streams the accessory is capable of running. As of the official HAP specification non SecureVideo cameras have a minimum required amount of 2 (but 1 is also fine). Secure Video cameras just expose 1 stream.
Default value: 1
property delegate
delegate: CameraStreamingDelegate;
Delegate which handles the actual RTP/RTCP video/audio streaming and Snapshot requests.
property recording
recording?: { /** * Options regarding Recordings (Secure Video) */ options: CameraRecordingOptions; /** * Delegate which handles the audio/video recording data streaming on motion. */ delegate: CameraRecordingDelegate;};
When supplying this option, it will enable support for HomeKit Secure Video. This will create the Service.CameraRecordingManagement, Service.CameraOperatingMode and Service.DataStreamTransportManagement services.
NOTE: The controller only initializes the required characteristics for the Service.CameraOperatingMode. You may add optional characteristics, if required, by accessing the service directly
CameraController.recordingManagement.operatingModeService
.
property sensors
sensors?: { /** * Define if a {@link Service.MotionSensor} should be created/associated with the controller. * * You may access the created service via the {@link CameraController.motionService} property to configure listeners. * * ## HomeKit Secure Video: * * If supplied, this sensor will be used as a {@link EventTriggerOption.MOTION} trigger. * The characteristic {@link Characteristic.StatusActive} will be added, which is used to enable or disable the sensor. */ motion?: Service | boolean; /** * Define if a {@link Service.OccupancySensor} should be created/associated with the controller. * * You may access the created service via the {@link CameraController.occupancyService} property to configure listeners. * * ## HomeKit Secure Video: * * The characteristic {@link Characteristic.StatusActive} will be added, which is used to enable or disable the sensor. */ occupancy?: Service | boolean;};
This config section configures optional sensors for the camera. It e.g. may be used to set up a EventTriggerOption.MOTION trigger when configuring Secure Video.
You may either specify and provide the desired Services or specify their creation and maintenance using a
boolean
flag. In this case the controller will create and maintain the service for you. Otherwise, when you supply an already created instance of the Service, you are responsible yourself to manage the service (e.g. creating, restoring, adding to the accessory, ...).The services can be accessed through the documented property after the call to Accessory.configureController has returned.
property streamingOptions
streamingOptions: CameraStreamingOptions;
Options regarding video/audio streaming
interface CameraControllerServiceMap
interface CameraControllerServiceMap extends ControllerServiceMap {}
Camera
property cameraEventRecordingManagement
cameraEventRecordingManagement?: CameraRecordingManagement;
property cameraOperatingMode
cameraOperatingMode?: CameraOperatingMode;
property dataStreamTransportManagement
dataStreamTransportManagement?: DataStreamTransportManagement;
property doorbell
doorbell?: Doorbell;
property microphone
microphone?: Microphone;
property motionService
motionService?: MotionSensor;
property occupancyService
occupancyService?: OccupancySensor;
property speaker
speaker?: Speaker;
interface CameraControllerState
interface CameraControllerState {}
Camera
property recordingManagement
recordingManagement?: RecordingManagementState;
property streamManagements
streamManagements: RTPStreamManagementState[];
interface CameraRecordingConfiguration
interface CameraRecordingConfiguration {}
This type describes the SelectedCameraRecordingConfiguration (written by the device to Characteristic.SelectedCameraRecordingConfiguration).
Camera
property audioCodec
audioCodec: AudioRecordingCodec & { bitrate: number; samplerate: AudioRecordingSamplerate;};
The selected audio codec configuration.
property eventTriggerTypes
eventTriggerTypes: EventTriggerOption[];
List of the enabled EventTriggerOptions.
property mediaContainerConfiguration
mediaContainerConfiguration: MediaContainerConfiguration;
The selected MediaContainerConfiguration.
property prebufferLength
prebufferLength: number;
The size of the prebuffer in milliseconds. This value is less or equal of the value advertised in the Characteristic.SupportedCameraRecordingConfiguration.
property videoCodec
videoCodec: { type: VideoCodecType.H264; parameters: SelectedH264CodecParameters; resolution: Resolution;};
The selected video codec configuration.
interface CameraRecordingDelegate
interface CameraRecordingDelegate {}
A
CameraRecordingDelegate
is responsible for handling recordings of a HomeKit Secure Video camera.It is responsible for maintaining the prebuffer (see CameraRecordingOptions.prebufferLength, once recording was activated (see updateRecordingActive).
Before recording is considered enabled two things must happen: - Recording must be enabled by the user. Signaled through updateRecordingActive. - Recording configurations must be selected by a HomeKit controller through updateRecordingConfiguration.
A typical recording event scenario happens as follows: - The camera is in idle mode, maintaining the prebuffer (the duration of the prebuffer depends on the selected CameraRecordingConfiguration). - A recording event is triggered (e.g. motion or doorbell button press) and the camera signals it through the respective characteristics (e.g. Characteristic.MotionDetected or Characteristic.ProgrammableSwitchEvent). Further, the camera saves the content of the prebuffer and starts recording the video. The camera should continue to store the recording until it runs out of space. In any case the camera should preserve recordings which are nearest to the triggered event. A stored recording might be completely deleted if a stream request wasn't initiated for eight seconds. - A HomeKit Controller will open a new recording session to download the next recording. This results in a call to handleRecordingStreamRequest. - Once the recording event is finished the camera will reset the state accordingly (e.g. in the Service.MotionSensor or Service.Doorbell service). It will continue to send the remaining fragments of the currently ongoing recording stream request. - The camera will either reach the end of the recording (and signal this via RecordingPacket.isLast. Also see acknowledgeStream) or it will continue to stream til the HomeKit Controller closes the stream closeRecordingStream with reason HDSProtocolSpecificErrorReason.NORMAL. - The camera goes back into idle mode.
Camera
method acknowledgeStream
acknowledgeStream: (streamId: number) => void;
This method is called once the HomeKit Controller acknowledges the
endOfStream
. AendOfStream
is sent by the accessory by setting RecordingPacket.isLast totrue
in the last packet yielded by the handleRecordingStreamRequestAsyncGenerator
.Parameter streamId
The streamId of the acknowledged stream.
method closeRecordingStream
closeRecordingStream: ( streamId: number, reason: HDSProtocolSpecificErrorReason | undefined) => void;
This method is called to notify the delegate that a recording stream started via handleRecordingStreamRequest was closed.
The method is also called if an ongoing recording stream is closed gracefully (using HDSProtocolSpecificErrorReason.NORMAL). In either case, the delegate should stop supplying further fragments to the recording stream. The
AsyncGenerator
function must return without yielding any further RecordingPackets. HAP-NodeJS won't send out any fragments from this point onwards.Parameter streamId
The streamId for which the close event was sent.
Parameter reason
The reason with which the stream was closed. NOTE: This method is also called in case of a closed connection. This is encoded by setting the
reason
to undefined.
method handleRecordingStreamRequest
handleRecordingStreamRequest: ( streamId: number) => AsyncGenerator<RecordingPacket>;
This method is called to stream the next recording event. It is guaranteed that there is only ever one ongoing recording stream request at a time.
When this method is called return the currently ongoing (or next in case of a potentially queued) recording via a
AsyncGenerator
. Everyyield
of the generator represents a complete recordingpacket
. The first packet MUST always be the PacketDataType.MEDIA_INITIALIZATION packet. Any following packet will transport the actual mp4 fragments in PacketDataType.MEDIA_FRAGMENT packets, starting with the content of the prebuffer. Every PacketDataType.MEDIA_FRAGMENT starts with a key frame and must not be longer than the specified duration set via theCameraRecordingConfiguration.mediaContainerConfiguration.fragmentLength
**selected** by the HomeKit Controller in updateRecordingConfiguration.NOTE: You MUST respect the value of Characteristic.RecordingAudioActive characteristic of the Service.CameraOperatingMode service. When the characteristic is set to false you MUST NOT include audio in the mp4 fragments. You can access the characteristic via the
CameraController.recordingManagement.operatingModeService
property.You might throw an error in this method if encountering a non-recoverable state. You may throw a HDSProtocolError to manually define the HDSProtocolSpecificErrorReason for the
DATA_SEND
CLOSE
event.There are three ways an ongoing recording stream can be closed: - Closed by the Accessory: There are no further fragments to transmit. The delegate MUST signal this by setting RecordingPacket.isLast to
true
. Once the HomeKit Controller receives this last fragment it will call acknowledgeStream to notify the accessory about the successful transmission. - Closed by the HomeKit Controller (expectedly): After the event trigger has been reset, the accessory continues to stream fragments. At some point the HomeKit Controller will decide to shut down the stream by calling closeRecordingStream with a reason of HDSProtocolSpecificErrorReason.NORMAL. - Closed by the HomeKit Controller (unexpectedly): A HomeKit Controller might at any point decide to close a recording stream if it encounters erroneous state. This is signaled by a call to closeRecordingStream with the respective reason.Once a close of stream is signaled, the
AsyncGenerator
function must return gracefully.For more information about
AsyncGenerator
s you might have a look at: * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...ofNOTE: HAP-NodeJS guarantees that this method is only called with a valid selected CameraRecordingConfiguration.
NOTE: Don't rely on the streamId for unique identification. Two DataStreamConnections might share the same identifier space.
Parameter streamId
The streamId of the currently ongoing stream.
method updateRecordingActive
updateRecordingActive: (active: boolean) => void;
A call to this method notifies the
CameraRecordingDelegate
about a change to theCameraRecordingManagement.Active
characteristic. This characteristic controls if the camera should react to recording events.If recording is disabled the camera can stop maintaining its prebuffer. If recording is enabled the camera should start recording into its prebuffer.
A
CameraRecordingDelegate
should assume active to befalse
on startup. HAP-NodeJS will persist the state of theActive
characteristic across reboots and will call updateRecordingActive accordingly on startup, if recording was previously enabled.NOTE: HAP-NodeJS cannot guarantee that a CameraRecordingConfiguration is present when recording is activated (e.g. the selected configuration might be erased due to changes in the supplied CameraRecordingOptions, but the camera is still
active
; or we can't otherwise influence the order which a HomeKit Controller might call those characteristics). However, HAP-NodeJS guarantees that if there is a valid CameraRecordingConfiguration, updateRecordingConfiguration is called before updateRecordingActive (when enabling) to avoid any unnecessary and potentially expensive reconfigurations.Parameter active
Specifies if recording is active or not.
method updateRecordingConfiguration
updateRecordingConfiguration: ( configuration: CameraRecordingConfiguration | undefined) => void;
A call to this method signals that the selected (by the HomeKit Controller) recording configuration of the camera has changed.
On startup the delegate should assume
configuration = undefined
. HAP-NodeJS will persist the state of both across reboots and will call updateRecordingConfiguration on startup if there is a **selected configuration** present.NOTE: An update to the recording configuration might happen while there is still a running recording stream. The camera MUST continue to use the previous configuration for the currently running stream and only apply the updated configuration to the next stream.
Parameter configuration
The CameraRecordingConfiguration. Reconfigure your recording pipeline accordingly. The parameter might be
undefined
when the selected configuration became invalid. This typically ony happens e.g. due to a factory reset (when all pairings are removed). Disable the recording pipeline in such a case even if recording is still enabled for the camera.
interface CameraRecordingOptions
interface CameraRecordingOptions {}
Describes options passed to the RecordingManagement.
Camera
property audio
audio: AudioRecordingOptions;
property mediaContainerConfiguration
mediaContainerConfiguration: | MediaContainerConfiguration | MediaContainerConfiguration[];
List of supported media MediaContainerConfigurations (or a single one).
property overrideEventTriggerOptions
overrideEventTriggerOptions?: EventTriggerOption[];
This property can be used to override the automatic heuristic of the CameraController which derives the EventTriggerOptions from application state.
EventTriggerOptions are derived automatically as follows: * EventTriggerOption.MOTION is enabled when a Service.MotionSensor is configured (via CameraControllerOptions.sensors). * EventTriggerOption.DOORBELL is enabled when the DoorbellController is used.
Note: This property is **ADDITIVE**. Meaning if the CameraController decides to add a certain EventTriggerOption it will still do so. This option can only be used to add **additional** EventTriggerOptions!
property prebufferLength
prebufferLength: number;
The size of the prebuffer in milliseconds. It must be at least 4000 ms. A sensible value for this property is in the interval [4000, 8000].
In order to provide some context to recording event, it is a good user experience to also have the recording of a few seconds before the event occurs. This exactly is the prebuffer. A camera will constantly store the last x seconds (the
prebufferLength
) to provide more context to a given event.
property video
video: VideoRecordingOptions;
interface CameraStreamingDelegate
interface CameraStreamingDelegate {}
Camera
method handleSnapshotRequest
handleSnapshotRequest: ( request: SnapshotRequest, callback: SnapshotRequestCallback) => void;
This method is called when a HomeKit controller requests a snapshot image for the given camera. The handler must respect the desired image height and width given in the SnapshotRequest. The returned Buffer (via the callback) must be encoded in jpeg.
HAP-NodeJS will complain about slow running handlers after 5 seconds and terminate the request after 15 seconds.
Parameter request
Request containing image size.
Parameter callback
Callback supplied with the resulting Buffer
method handleStreamRequest
handleStreamRequest: ( request: StreamingRequest, callback: StreamRequestCallback) => void;
method prepareStream
prepareStream: ( request: PrepareStreamRequest, callback: PrepareStreamCallback) => void;
interface CameraStreamingOptionsBase
interface CameraStreamingOptionsBase {}
Camera
property audio
audio?: AudioStreamingOptions;
"audio" is optional and only needs to be declared if audio streaming is supported. If defined the Microphone service will be added and Microphone volume control will be made available. If not defined hap-nodejs will expose a default codec in order for the video stream to work
property disable_audio_proxy
disable_audio_proxy?: boolean;
property proxy
proxy?: boolean;
property video
video: VideoStreamingOptions;
interface CameraStreamingOptionsLegacySRTP
interface CameraStreamingOptionsLegacySRTP {}
Camera
property srtp
srtp: boolean;
interface CameraStreamingOptionsSupportedCryptoSuites
interface CameraStreamingOptionsSupportedCryptoSuites {}
Camera
property supportedCryptoSuites
supportedCryptoSuites: SRTPCryptoSuites[];
interface Characteristic
interface Characteristic {}
Characteristic
method emit
emit: { ( event: 'get', callback: CharacteristicGetCallback, context: CharacteristicContext, connection?: HAPConnection ): boolean; ( event: 'set', value: CharacteristicValue, callback: CharacteristicSetCallback, context: any, connection?: HAPConnection ): boolean; (event: 'change', change: CharacteristicChange): boolean; (event: 'subscribe'): boolean; (event: 'unsubscribe'): boolean; ( event: 'characteristic-warning', type: CharacteristicWarningType, message: string, stack?: string ): boolean;};
method on
on: { ( event: 'get', listener: ( callback: CharacteristicGetCallback, context: CharacteristicContext, connection?: HAPConnection ) => void ): this; ( event: 'set', listener: ( value: CharacteristicValue, callback: CharacteristicSetCallback, context: any, connection?: HAPConnection ) => void ): this; (event: 'change', listener: (change: CharacteristicChange) => void): this; (event: 'subscribe', listener: VoidCallback): this; (event: 'unsubscribe', listener: VoidCallback): this; ( event: 'characteristic-warning', listener: ( type: CharacteristicWarningType, message: string, stack?: string ) => void ): this;};
interface CharacteristicId
interface CharacteristicId {}
HAP Accessory Server
interface CharacteristicJsonObject
interface CharacteristicJsonObject {}
HAP Accessory Server
property "valid-values-range"
'valid-values-range'?: [min: number, max: number];
property "valid-values"
'valid-values'?: number[];
property description
description?: string;
property format
format: Formats | string;
property iid
iid: number;
property maxDataLen
maxDataLen?: number;
property maxLen
maxLen?: number;
property maxValue
maxValue?: number;
property minStep
minStep?: number;
property minValue
minValue?: number;
property perms
perms: Perms[];
property type
type: string;
property unit
unit?: Units | string;
property value
value?: Nullable<CharacteristicValue>;
interface CharacteristicOperationContext
interface CharacteristicOperationContext {}
This format for a context object can be used to pass to any characteristic write operation. It can contain additional information used by the internal event handlers of hap-nodejs. The context object can be combined with any custom data for own use.
Characteristic
property omitEventUpdate
omitEventUpdate?: boolean;
If set to true for any characteristic write operation the Accessory won't send any event notifications to HomeKit controllers for that particular change.
interface CharacteristicProps
interface CharacteristicProps {}
Characteristic
property adminOnlyAccess
adminOnlyAccess?: Access[];
property description
description?: string;
property format
format: Formats | string;
property maxDataLen
maxDataLen?: number;
Maximum number of characters when format is Formats.DATA. Default is 2097152 characters.
property maxLen
maxLen?: number;
Maximum number of characters when format is Formats.STRING. Default is 64 characters. Maximum allowed is 256 characters.
property maxValue
maxValue?: number;
Defines the maximum value for a numeric characteristic
property minStep
minStep?: number;
property minValue
minValue?: number;
Defines the minimum value for a numeric characteristic
property perms
perms: Perms[];
property unit
unit?: Units | string;
property validValueRanges
validValueRanges?: [min: number, max: number];
Two element array where the first value specifies the lowest valid value and the second element specifies the highest valid value.
property validValues
validValues?: number[];
Defines an array of valid values to be used for the characteristic.
interface CharacteristicReadDataValue
interface CharacteristicReadDataValue extends PartialCharacteristicReadDataValue {}
HAP Accessory Server
interface CharacteristicReadError
interface CharacteristicReadError extends PartialCharacteristicReadError {}
HAP Accessory Server
interface CharacteristicsReadRequest
interface CharacteristicsReadRequest {}
HAP Accessory Server
property ids
ids: CharacteristicId[];
property includeEvent
includeEvent: boolean;
property includeMeta
includeMeta: boolean;
property includePerms
includePerms: boolean;
property includeType
includeType: boolean;
interface CharacteristicsReadResponse
interface CharacteristicsReadResponse {}
HAP Accessory Server
property characteristics
characteristics: CharacteristicReadData[];
interface CharacteristicsWriteRequest
interface CharacteristicsWriteRequest {}
HAP Accessory Server
property characteristics
characteristics: CharacteristicWrite[];
property pid
pid?: number;
interface CharacteristicsWriteResponse
interface CharacteristicsWriteResponse {}
HAP Accessory Server
property characteristics
characteristics: CharacteristicWriteData[];
interface CharacteristicWarning
interface CharacteristicWarning {}
Accessory
property characteristic
characteristic: Characteristic;
property message
message: string;
property originatorChain
originatorChain: string[];
property stack
stack?: string;
property type
type: CharacteristicWarningType;
interface CharacteristicWrite
interface CharacteristicWrite {}
HAP Accessory Server
interface CharacteristicWriteDataValue
interface CharacteristicWriteDataValue extends PartialCharacteristicWriteDataValue {}
HAP Accessory Server
interface CharacteristicWriteError
interface CharacteristicWriteError extends PartialCharacteristicWriteError {}
HAP Accessory Server
interface Controller
interface Controller<M extends ControllerServiceMap = ControllerServiceMap> {}
A Controller represents a somewhat more complex arrangement of multiple services which together form a accessory like for example cameras, remotes, tvs or routers. Controllers implementing this interface are capable of being serialized and thus stored on and recreated from disk. Meaning services, characteristic configurations and optionally additional controller states can be persistently saved. As a result, implementors of this interface need to follow strict guidelines on how to initialize their services and characteristics.
The set of services can change though over the lifespan of the implementation (e.g. protocol changes imposed by HAP like the addition of secure-video for cameras). Such changes can be made using initWithServices. See below for more infos.
The constructor of a Controller should only initialize controller specific configuration and states and MUST NOT create any services or characteristics. Additionally, it must implement all necessary methods as noted below. Those methods will get called when the accessory gets added to an Accessory or a Accessory is restored from disk. Controller API
method configureServices
configureServices: () => void;
This method is called to configure the services and their characteristics of the controller. When this method is called, it is guaranteed that either constructServices or initWithServices were called before and all services are already created.
This method SHOULD set up all necessary event handlers for services and characteristics.
method constructServices
constructServices: () => M;
This method is called by the accessory the controller is added to. This method is only called if a new controller is constructed (aka the controller is not restored from disk initWithServices). It MUST create all needed services and characteristics. It MAY create links between services or mark them as hidden or primary. It MUST NOT configure any event handlers. The controller SHOULD save created services in internal properties for later access.
The method must return all created services in a ServiceMap. A ControllerServiceMap basically maps a name to every service on the controller. It is used to potentially recreate a controller for a given ServiceMap using initWithServices.
The set of services represented by the Controller MUST remain static and can only change over new version of the Controller implementation (see initWithServices)
Returns
a ControllerServiceMap representing all services of a controller indexed by a controller chosen name.
method controllerId
controllerId: () => ControllerIdentifier;
Every instance of a Controller must define appropriate identifying material. The returned identifier MUST NOT change over the lifetime of the Controller object.
Note: The controller can choose to return the same identifier for all controllers of the same type. This will result in the user only being able to add ONE instance of an Controller to an accessory.
Some predefined identifiers can be found in ControllerIdentifier.
method handleControllerRemoved
handleControllerRemoved: () => void;
This method is called once the Controller is removed from the accessory. The controller MUST reset everything to its initial state (just as it would have been constructed freshly) form the constructor. Adding the Controller back to an accessory after it was removed MUST be supported! If the controller is a SerializableController it MUST NOT call the StateChangeDelegate as a result of a call to this method.
All service contained in the ControllerServiceMap returned by constructServices will be automatically removed from the Accessory. The Controller MUST remove any references to those services.
method handleFactoryReset
handleFactoryReset: () => void;
This method is called to signal a factory reset of the controller and its services and characteristics. A controller MUST reset any configuration or states to default values.
This method is called once the accessory gets unpaired or the Controller gets removed from the Accessory.
method initWithServices
initWithServices: (serviceMap: M) => M | void;
This method is called to initialize the controller with already created services. The controller SHOULD save the passed services in internal properties for later access.
The controller can return a ServiceMap to signal that the set of services changed. A Controller MUST modify the ServiceMap which is passed to the method and MUST NOT create a new one (to support inheritance). It MUST NOT return a ServiceMap if the service configuration did not change! It MUST be able to restore services using a ServiceMap from any point in time.
Parameter serviceMap
A ControllerServiceMap that represents all services of a controller indexed by the controller chosen name.
Returns
optionally a ControllerServiceMap. This can be used to alter the services configuration of a controller.
interface ControllerConstructor
interface ControllerConstructor {}
Controller API
construct signature
new (): Controller;
interface ControllerContext
interface ControllerContext {}
Controller API
property controller
controller: Controller;
property serviceMap
serviceMap: ControllerServiceMap;
interface ControllerServiceMap
interface ControllerServiceMap {}
A ControllerServiceMap represents all services used by a Controller. It is up to the Controller to choose unique and persistent names for its services.
Controller API
index signature
[name: string]: Service | undefined;
interface DataStreamConnection
interface DataStreamConnection {}
HomeKit Data Streams (HDS)
method emit
emit: { ( event: 'identification', frame: HDSFrame, callback: IdentificationCallback ): boolean; (event: 'handle-message-globally', message: DataStreamMessage): boolean; (event: 'closed'): boolean;};
method on
on: { ( event: 'identification', listener: (frame: HDSFrame, callback: IdentificationCallback) => void ): this; ( event: 'handle-message-globally', listener: (message: DataStreamMessage) => void ): this; (event: 'closed', listener: () => void): this;};
interface DataStreamProtocolHandler
interface DataStreamProtocolHandler {}
HomeKit Data Streams (HDS)
property eventHandler
eventHandler?: Record<string, EventHandler>;
property requestHandler
requestHandler?: Record<string, RequestHandler>;
interface DataStreamServer
interface DataStreamServer {}
HomeKit Data Streams (HDS)
method emit
emit: { (event: 'connection-opened', connection: DataStreamConnection): boolean; (event: 'connection-closed', connection: DataStreamConnection): boolean;};
method on
on: { ( event: 'connection-opened', listener: (connection: DataStreamConnection) => void ): this; ( event: 'connection-closed', listener: (connection: DataStreamConnection) => void ): this;};
interface DoorbellOptions
interface DoorbellOptions {}
Options which are additionally supplied for a DoorbellController.
Doorbell
property externalDoorbellService
externalDoorbellService?: Service;
This property may be used to supply an external Service.Doorbell. This is particularly handy when one is migrating from an existing implementation to a
DoorbellController
and want to avoid loosing users automation by removing and deleting the service.NOTE: You are responsible for managing the service yourself (e.g. creation, restoring, adding to accessory, ...)
property name
name?: string;
Name used to for the Service.Doorbell service.
interface EventedHTTPServer
interface EventedHTTPServer {}
HAP Accessory Server
method emit
emit: { (event: 'listening', port: number, address: string): boolean; (event: 'connection-opened', connection: HAPConnection): boolean; ( event: 'request', connection: HAPConnection, request: IncomingMessage, response: ServerResponse ): boolean; (event: 'connection-closed', connection: HAPConnection): boolean;};
method on
on: { ( event: 'listening', listener: (port: number, address: string) => void ): this; ( event: 'connection-opened', listener: (connection: HAPConnection) => void ): this; ( event: 'request', listener: ( connection: HAPConnection, request: IncomingMessage, response: ServerResponse ) => void ): this; ( event: 'connection-closed', listener: (connection: HAPConnection) => void ): this;};
interface H264CodecParameters
interface H264CodecParameters {}
Camera
interface HAPConnection
interface HAPConnection {}
HAP Accessory Server
method emit
emit: { ( event: 'request', request: IncomingMessage, response: ServerResponse ): boolean; (event: 'authenticated', username: string): boolean; (event: 'closed'): boolean;};
method on
on: { ( event: 'request', listener: (request: IncomingMessage, response: ServerResponse) => void ): this; (event: 'authenticated', listener: (username: string) => void): this; (event: 'closed', listener: () => void): this;};
interface HAPServer
interface HAPServer {}
HAP Accessory Server
method emit
emit: { (event: 'listening', port: number, address: string): boolean; (event: 'identify', callback: VoidCallback): boolean; ( event: 'add-pairing', connection: HAPConnection, username: string, publicKey: Buffer, permission: PermissionTypes, callback: AddPairingCallback ): boolean; ( event: 'remove-pairing', connection: HAPConnection, username: string, callback: RemovePairingCallback ): boolean; ( event: 'list-pairings', connection: HAPConnection, callback: ListPairingsCallback ): boolean; ( event: 'pair', username: string, clientLTPK: Buffer, callback: VoidCallback ): boolean; ( event: 'accessories', connection: HAPConnection, callback: AccessoriesCallback ): boolean; ( event: 'get-characteristics', connection: HAPConnection, request: CharacteristicsReadRequest, callback: ReadCharacteristicsCallback ): boolean; ( event: 'set-characteristics', connection: HAPConnection, request: CharacteristicsWriteRequest, callback: WriteCharacteristicsCallback ): boolean; ( event: 'request-resource', resource: ResourceRequest, callback: ResourceRequestCallback ): boolean; (event: 'connection-closed', connection: HAPConnection): boolean;};
method on
on: { ( event: 'listening', listener: (port: number, address: string) => void ): this; (event: 'identify', listener: (callback: VoidCallback) => void): this; ( event: 'add-pairing', listener: ( connection: HAPConnection, username: string, publicKey: Buffer, permission: PermissionTypes, callback: AddPairingCallback ) => void ): this; ( event: 'remove-pairing', listener: ( connection: HAPConnection, username: string, callback: RemovePairingCallback ) => void ): this; ( event: 'list-pairings', listener: ( connection: HAPConnection, callback: ListPairingsCallback ) => void ): this; ( event: 'pair', listener: ( username: string, clientLTPK: Buffer, callback: VoidCallback ) => void ): this; ( event: 'accessories', listener: ( connection: HAPConnection, callback: AccessoriesCallback ) => void ): this; ( event: 'get-characteristics', listener: ( connection: HAPConnection, request: CharacteristicsReadRequest, callback: ReadCharacteristicsCallback ) => void ): this; ( event: 'set-characteristics', listener: ( connection: HAPConnection, request: CharacteristicsWriteRequest, callback: WriteCharacteristicsCallback ) => void ): this; ( event: 'request-resource', listener: ( resource: ResourceRequest, callback: ResourceRequestCallback ) => void ): this; ( event: 'connection-closed', listener: (connection: HAPConnection) => void ): this;};
interface MediaContainerConfiguration
interface MediaContainerConfiguration {}
Camera
property fragmentLength
fragmentLength: number;
The length in milliseconds of every individual recording fragment. A typical value of HomeKit Secure Video cameras is 4000ms.
property type
type: MediaContainerType;
The type of media container.
interface PairingInformation
interface PairingInformation {}
Model
property permission
permission: PermissionTypes;
property publicKey
publicKey: Buffer;
property username
username: HAPUsername;
interface PartialCharacteristicReadDataValue
interface PartialCharacteristicReadDataValue {}
HAP Accessory Server
property ev
ev?: boolean;
property format
format?: string;
property maxLen
maxLen?: number;
property maxValue
maxValue?: number;
property minStep
minStep?: number;
property minValue
minValue?: number;
property perms
perms?: Perms[];
property status
status?: HAPStatus.SUCCESS;
property type
type?: string;
property unit
unit?: string;
property value
value: CharacteristicValue | null;
interface PartialCharacteristicReadError
interface PartialCharacteristicReadError {}
HAP Accessory Server
property status
status: HAPStatus;
interface PartialCharacteristicWriteDataValue
interface PartialCharacteristicWriteDataValue {}
HAP Accessory Server
interface PartialCharacteristicWriteError
interface PartialCharacteristicWriteError {}
HAP Accessory Server
interface ProxiedSourceResponse
interface ProxiedSourceResponse {}
Camera
property proxy_pt
proxy_pt: number;
property proxy_server_address
proxy_server_address: string;
property proxy_server_rtcp
proxy_server_rtcp: number;
property proxy_server_rtp
proxy_server_rtp: number;
interface PublishInfo
interface PublishInfo {}
Accessory
property addIdentifyingMaterial
addIdentifyingMaterial?: boolean;
If this option is set to true, HAP-NodeJS will add identifying material (based on username) to the end of the accessory display name (and bonjour instance name). Default: true
property advertiser
advertiser?: MDNSAdvertiser;
Defines the advertiser used with the published Accessory.
property bind
bind?: (InterfaceName | IPAddress) | (InterfaceName | IPAddress)[];
Defines the host where the HAP server will be bound to. When undefined the HAP server will bind to all available interfaces (see https://nodejs.org/api/net.html#net_server_listen_port_host_backlog_callback).
This property accepts a mixture of IPAddresses and network interface names. Depending on the mixture of supplied addresses/names hap-nodejs will bind differently.
It is advised to not just bind to a specific address, but specifying the interface name in oder to bind on all address records (and ip version) available.
HAP-NodeJS (or the underlying ciao library) will not report about misspelled interface names, as it could be that the interface is currently just down and will come up later.
Here are a few examples: - bind: "::" Pretty much identical to not specifying anything, as most systems (with ipv6 support) will default to the unspecified ipv6 address (with dual stack support).
- bind: "0.0.0.0" Binding TCP socket to the unspecified ipv4 address. The mdns advertisement will exclude any ipv6 address records.
- bind: ["en0", "lo0"] The mdns advertising will advertise all records of the en0 and loopback interface (if available) and will also react to address changes on those interfaces. In order for the HAP server to accept all those address records (which may contain ipv6 records) it will bind on the unspecified ipv6 address "::" (assuming dual stack is supported).
- bind: ["en0", "lo0", "0.0.0.0"] Same as above, only that the HAP server will bind on the unspecified ipv4 address "0.0.0.0". The mdns advertisement will not advertise any ipv6 records.
- bind: "169.254.104.90" This will bind the HAP server to the address 0.0.0.0. The mdns advertisement will only advertise the A record 169.254.104.90. If the given network interface of that address encounters an ip address change (to a different address), the mdns advertisement will result in not advertising an address at all. So it is advised to specify an interface name instead of a specific address. This is identical with ipv6 addresses.
- bind: ["169.254.104.90", "192.168.1.4"] As the HAP TCP socket can only bind to a single address, when specifying multiple ip addresses the HAP server will bind to the unspecified ip address (0.0.0.0 if only ipv4 addresses are supplied, :: if a mixture or only ipv6 addresses are supplied). The mdns advertisement will only advertise the specified ip addresses. If the given network interface of that address encounters an ip address change (to different addresses), the mdns advertisement will result in not advertising an address at all. So it is advised to specify an interface name instead of a specific address.
property category
category?: Categories;
Specify the category for the HomeKit accessory. The category is used only in the mdns advertisement and specifies the devices type for the HomeKit controller. Currently, this only affects the icon shown in the pairing screen. For the Television and Smart Speaker service it also affects the icon shown in the Home app when paired.
property pincode
pincode: HAPPincode;
property port
port?: number;
Defines the port where the HAP server will be bound to. When undefined port 0 will be used resulting in a random port.
property setupID
setupID?: string;
property username
username: MacAddress;
interface RecordingManagementServices
interface RecordingManagementServices {}
Camera
property dataStreamManagement
dataStreamManagement: DataStreamManagement;
property operatingMode
operatingMode: CameraOperatingMode;
property recordingManagement
recordingManagement: CameraRecordingManagement;
interface RecordingManagementState
interface RecordingManagementState {}
Camera
property configurationHash
configurationHash: { algorithm: 'sha256'; hash: string;};
This property stores a hash of the supported configurations (recording, video and audio) of the recording management. We use this to determine if the configuration was changed by the user. If it was changed, we need to discard the
selectedConfiguration
to signify to HomeKit Controllers that they might reconsider their decision based on the updated configuration.
property eventSnapshotsActive
eventSnapshotsActive: boolean;
Service
CameraOperatingMode
; CharacteristicEventSnapshotsActive
property homeKitCameraActive
homeKitCameraActive: boolean;
Service
CameraOperatingMode
; CharacteristicHomeKitCameraActive
property periodicSnapshotsActive
periodicSnapshotsActive: boolean;
Service
CameraOperatingMode
; CharacteristicPeriodicSnapshotsActive
property recordingActive
recordingActive: boolean;
Service
CameraRecordingManagement
; CharacteristicActive
property recordingAudioActive
recordingAudioActive: boolean;
Service
CameraRecordingManagement
; CharacteristicRecordingAudioActive
property selectedConfiguration
selectedConfiguration?: string;
The base64 encoded tlv of the CameraRecordingConfiguration. This value MIGHT be
undefined
if no HomeKit controller has yet selected a configuration.
interface RecordingPacket
interface RecordingPacket {}
Camera
interface RemoteController
interface RemoteController {}
Apple TV Remote
method emit
emit: { (event: 'active-change', active: boolean): boolean; (event: 'active-identifier-change', activeIdentifier: number): boolean; (event: 'target-add', targetConfiguration: TargetConfiguration): boolean; ( event: 'target-update', targetConfiguration: TargetConfiguration, updates: TargetUpdates[] ): boolean; (event: 'target-remove', targetIdentifier: number): boolean; (event: 'targets-reset'): boolean;};
method on
on: { (event: 'active-change', listener: (active: boolean) => void): this; ( event: 'active-identifier-change', listener: (activeIdentifier: number) => void ): this; ( event: 'target-add', listener: (targetConfiguration: TargetConfiguration) => void ): this; ( event: 'target-update', listener: ( targetConfiguration: TargetConfiguration, updates: TargetUpdates[] ) => void ): this; (event: 'target-remove', listener: (targetIdentifier: number) => void): this; (event: 'targets-reset', listener: () => void): this;};
interface RemoteControllerServiceMap
interface RemoteControllerServiceMap extends ControllerServiceMap {}
Apple TV Remote
property audioStreamManagement
audioStreamManagement?: AudioStreamManagement;
property dataStreamTransportManagement
dataStreamTransportManagement?: DataStreamTransportManagement;
property siri
siri?: Siri;
property targetControl
targetControl: TargetControl;
property targetControlManagement
targetControlManagement: TargetControlManagement;
interface ResourceRequest
interface ResourceRequest {}
HAP Accessory Server
property "image-height"
'image-height': number;
property "image-width"
'image-width': number;
property "reason"
reason?: ResourceRequestReason;
property "resource-type"
'resource-type': ResourceRequestType;
property aid
aid?: number;
interface RTPProxyOptions
interface RTPProxyOptions {}
Camera
property disabled
disabled: boolean;
property isIPV6
isIPV6?: boolean;
property outgoingAddress
outgoingAddress: string;
property outgoingPort
outgoingPort: number;
property outgoingSSRC
outgoingSSRC: number;
interface RTPStreamManagementState
interface RTPStreamManagementState {}
Camera
interface SelectedH264CodecParameters
interface SelectedH264CodecParameters {}
Camera
property bitRate
bitRate: number;
property iFrameInterval
iFrameInterval: number;
The selected i-frame interval in milliseconds.
property level
level: H264Level;
property profile
profile: H264Profile;
interface SerializableController
interface SerializableController< M extends ControllerServiceMap = ControllerServiceMap, S = any> extends Controller<M> {}
A SerializableController is a Controller which additionally carries states/data (beside services and characteristics) which needs to be persistently stored. For example current target configuration for an AppleTV remote. Controller API
method deserialize
deserialize: (serialized: S) => void;
This method is called to restore the controller state from disk. This is only called once, when the data was loaded from disk and the Accessory is to be published. A controller MUST provide backwards compatibility for any configuration layout exposed at any time. A Controller MUST NOT depend on any specific calling order.
Parameter serialized
method handleFactoryReset
handleFactoryReset: () => void;
This method is inherited from Controller.handleFactoryReset though is required with SerializableController.
method serialize
serialize: () => S | undefined;
This method can be used to persistently save controller related configuration across reboots. It should return undefined, if the controller data was reset to default values and nothing needs to be stored anymore.
Returns
an arbitrary Controller defined object containing all necessary data
method setupStateChangeDelegate
setupStateChangeDelegate: (delegate?: StateChangeDelegate) => void;
This method is called once upon setup. It supplies a function used by the Controller to signal state changes. The implementing controller SHOULD store the function and call it every time the internal controller state changes. It should be expected that the serialize method will be called next and that the state will be stored to disk. The delegate parameter can be undefined when the controller is removed and the state change delegate is reset.
Parameter delegate
The StateChangeDelegate to call when controller state has changed
interface SerializedAccessory
interface SerializedAccessory {}
Accessory
property category
category: Categories;
property controllers
controllers?: SerializedControllerContext[];
property displayName
displayName: string;
property lastKnownUsername
lastKnownUsername?: MacAddress;
property linkedServices
linkedServices?: Record<ServiceId, ServiceId[]>;
property services
services: SerializedService[];
property UUID
UUID: string;
interface SerializedAdaptiveLightingControllerState
interface SerializedAdaptiveLightingControllerState {}
Adaptive Lighting
property activeTransition
activeTransition: ActiveAdaptiveLightingTransition;
interface SerializedCharacteristic
interface SerializedCharacteristic {}
Characteristic
property constructorName
constructorName?: string;
property displayName
displayName: string;
property eventOnlyCharacteristic
eventOnlyCharacteristic: boolean;
property props
props: CharacteristicProps;
property UUID
UUID: string;
property value
value: Nullable<CharacteristicValue>;
interface SerializedControllerContext
interface SerializedControllerContext {}
Controller API
interface SerializedControllerState
interface SerializedControllerState {}
Apple TV Remote
property activeIdentifier
activeIdentifier: number;
property targetConfigurations
targetConfigurations: Record<number, TargetConfiguration>;
interface SerializedService
interface SerializedService {}
Service
property characteristics
characteristics: SerializedCharacteristic[];
property constructorName
constructorName?: string;
property displayName
displayName: string;
property hiddenService
hiddenService?: boolean;
property optionalCharacteristics
optionalCharacteristics?: SerializedCharacteristic[];
property primaryService
primaryService?: boolean;
property subtype
subtype?: string;
property UUID
UUID: string;
interface Service
interface Service {}
Service
method emit
emit: { ( event: 'characteristic-change', change: ServiceCharacteristicChange ): boolean; (event: 'service-configurationChange'): boolean; (event: 'characteristic-warning', warning: CharacteristicWarning): boolean;};
method on
on: { ( event: 'characteristic-change', listener: (change: ServiceCharacteristicChange) => void ): this; (event: 'service-configurationChange', listener: () => void): this; ( event: 'characteristic-warning', listener: (warning: CharacteristicWarning) => void ): this;};
interface ServiceConfigurationChange
interface ServiceConfigurationChange {}
Service
property service
service: Service;
interface ServiceJsonObject
interface ServiceJsonObject {}
HAP Accessory Server
interface SiriAudioSession
interface SiriAudioSession {}
Apple TV Remote
interface SiriAudioStreamProducer
interface SiriAudioStreamProducer {}
Apple TV Remote
method startAudioProduction
startAudioProduction: ( selectedAudioConfiguration: AudioCodecConfiguration) => void;
method stopAudioProduction
stopAudioProduction: () => void;
interface SiriAudioStreamProducerConstructor
interface SiriAudioStreamProducerConstructor {}
Apple TV Remote
construct signature
new ( frameHandler: FrameHandler, errorHandler: ErrorHandler, options?: any): SiriAudioStreamProducer;
Creates a new instance of a SiriAudioStreamProducer
Parameter frameHandler
called for every opus frame recorded
Parameter errorHandler
should be called with an appropriate reason when the producing process errored
Parameter options
optional parameter for passing any configuration related options
interface SourceResponse
interface SourceResponse {}
Camera
interface VideoRecordingOptions
interface VideoRecordingOptions {}
Camera
property parameters
parameters: H264CodecParameters;
property resolutions
resolutions: Resolution[];
Required resolutions to be supported are: * 1920x1080 * 1280x720
The following frame rates are required to be supported: * 15 fps * 24fps or 30fps
property type
type: VideoCodecType;
Enums
enum Access
const enum Access { READ = 0, WRITE = 1, NOTIFY = 2,}
Describes the abstract access to a Characteristic. It abstracts the more granular access described by Perms.
It is used in CharacteristicProps.adminOnlyAccess.
Characteristic
enum AccessControlEvent
const enum AccessControlEvent { ACCESS_LEVEL_UPDATED = 'update-control-level', PASSWORD_SETTING_UPDATED = 'update-password',}
Television
member ACCESS_LEVEL_UPDATED
ACCESS_LEVEL_UPDATED = 'update-control-level'
member PASSWORD_SETTING_UPDATED
PASSWORD_SETTING_UPDATED = 'update-password'
enum AccessLevel
const enum AccessLevel { ANYONE = 0, HOME_MEMBERS_ONLY = 1,}
This defines the Access Level for TVs and Speakers. It is pretty much only used for the AirPlay 2 protocol so this information is not really useful.
Television
member ANYONE
ANYONE = 0
This access level is set when the users selects "Anyone" or "Anyone On The Same Network" in the Access Control settings.
member HOME_MEMBERS_ONLY
HOME_MEMBERS_ONLY = 1
This access level is set when the users selects "Only People Sharing this Home" in the Access Control settings. On this level password setting is ignored. Requests to the HAPServer can only come from Home members anyways, so there is no real use to it. This is pretty much only used for the AirPlay 2 protocol.
enum AccessoryEventTypes
const enum AccessoryEventTypes { IDENTIFY = 'identify', LISTENING = 'listening', ADVERTISED = 'advertised', SERVICE_CONFIGURATION_CHANGE = 'service-configurationChange', SERVICE_CHARACTERISTIC_CHANGE = 'service-characteristic-change', PAIRED = 'paired', UNPAIRED = 'unpaired', CHARACTERISTIC_WARNING = 'characteristic-warning',}
Accessory
member ADVERTISED
ADVERTISED = 'advertised'
This event is emitted once the mDNS suite has fully advertised the presence of the accessory. This event is guaranteed to be called after LISTENING.
member CHARACTERISTIC_WARNING
CHARACTERISTIC_WARNING = 'characteristic-warning'
member IDENTIFY
IDENTIFY = 'identify'
Emitted when an iOS device wishes for this Accessory to identify itself. If
paired
is false, then this device is currently browsing for Accessories in the system-provided "Add Accessory" screen. Ifpaired
is true, then this is a device that has already paired with us. Note that ifpaired
is true, listening for this event is a shortcut for the underlying mechanism of setting theIdentify
Characteristic:getService(Service.AccessoryInformation).getCharacteristic(Characteristic.Identify).on('set', ...)
You must call the callback for identification to be successful.
member LISTENING
LISTENING = 'listening'
This event is emitted once the HAP TCP socket is bound. At this point the mdns advertisement isn't yet available. Use the ADVERTISED if you require the accessory to be discoverable.
member PAIRED
PAIRED = 'paired'
member SERVICE_CHARACTERISTIC_CHANGE
SERVICE_CHARACTERISTIC_CHANGE = 'service-characteristic-change'
Emitted after a change in the value of one of the provided Service's Characteristics.
member SERVICE_CONFIGURATION_CHANGE
SERVICE_CONFIGURATION_CHANGE = 'service-configurationChange'
member UNPAIRED
UNPAIRED = 'unpaired'
enum AdaptiveLightingControllerEvents
const enum AdaptiveLightingControllerEvents { UPDATE = 'update', DISABLED = 'disable',}
Adaptive Lighting
member DISABLED
DISABLED = 'disable'
In yet unknown circumstances HomeKit may also send a dedicated disable command via the control point characteristic. You may want to handle that in manual mode as well. The current transition will still be associated with the controller object when this event is called.
member UPDATE
UPDATE = 'update'
This event is called once a HomeKit controller enables Adaptive Lighting or a HomeHub sends an updated transition schedule for the next 24 hours. This is also called on startup when AdaptiveLighting was previously enabled.
enum AdaptiveLightingControllerMode
const enum AdaptiveLightingControllerMode { AUTOMATIC = 1, MANUAL = 2,}
Defines in which mode the AdaptiveLightingController will operate in. Adaptive Lighting
member AUTOMATIC
AUTOMATIC = 1
In automatic mode pretty much everything from setup to transition scheduling is done by the controller.
member MANUAL
MANUAL = 2
In manual mode setup is done by the controller but the actual transition must be done by the user. This is useful for lights which natively support transitions.
enum AudioBitrate
const enum AudioBitrate { VARIABLE = 0, CONSTANT = 1,}
Camera
enum AudioCodecTypes
const enum AudioCodecTypes { PCMU = 0, PCMA = 1, AAC_ELD = 2, OPUS = 3, MSBC = 4, AMR = 5, AMR_WB = 6,}
Camera
enum AudioRecordingCodecType
const enum AudioRecordingCodecType { AAC_LC = 0, AAC_ELD = 1,}
Camera
enum AudioRecordingSamplerate
const enum AudioRecordingSamplerate { KHZ_8 = 0, KHZ_16 = 1, KHZ_24 = 2, KHZ_32 = 3, KHZ_44_1 = 4, KHZ_48 = 5,}
Camera
enum AudioSamplerate
const enum AudioSamplerate { KHZ_8 = 0, KHZ_16 = 1, KHZ_24 = 2,}
Camera
enum AudioStreamingCodecType
const enum AudioStreamingCodecType { PCMU = 'PCMU', PCMA = 'PCMA', AAC_ELD = 'AAC-eld', OPUS = 'OPUS', MSBC = 'mSBC', AMR = 'AMR', AMR_WB = 'AMR-WB',}
Camera
enum AudioStreamingSamplerate
const enum AudioStreamingSamplerate { KHZ_8 = 8, KHZ_16 = 16, KHZ_24 = 24,}
Camera
enum ButtonState
const enum ButtonState { UP = 0, DOWN = 1,}
Apple TV Remote
enum ButtonType
const enum ButtonType { UNDEFINED = 0, MENU = 1, PLAY_PAUSE = 2, TV_HOME = 3, SELECT = 4, ARROW_UP = 5, ARROW_RIGHT = 6, ARROW_DOWN = 7, ARROW_LEFT = 8, VOLUME_UP = 9, VOLUME_DOWN = 10, SIRI = 11, POWER = 12, GENERIC = 13,}
Apple TV Remote
member ARROW_DOWN
ARROW_DOWN = 7
member ARROW_LEFT
ARROW_LEFT = 8
member ARROW_RIGHT
ARROW_RIGHT = 6
member ARROW_UP
ARROW_UP = 5
member GENERIC
GENERIC = 13
member MENU
MENU = 1
member PLAY_PAUSE
PLAY_PAUSE = 2
member POWER
POWER = 12
member SELECT
SELECT = 4
member SIRI
SIRI = 11
member TV_HOME
TV_HOME = 3
member UNDEFINED
UNDEFINED = 0
member VOLUME_DOWN
VOLUME_DOWN = 10
member VOLUME_UP
VOLUME_UP = 9
enum CameraControllerEvents
const enum CameraControllerEvents { MICROPHONE_PROPERTIES_CHANGED = 'microphone-change', SPEAKER_PROPERTIES_CHANGED = 'speaker-change',}
Camera
member MICROPHONE_PROPERTIES_CHANGED
MICROPHONE_PROPERTIES_CHANGED = 'microphone-change'
Emitted when the mute state or the volume changed. The Apple Home App typically does not set those values except the mute state. When you adjust the volume in the Camera view it will reset the muted state if it was set previously. The value of volume has nothing to do with the volume slider in the Camera view of the Home app.
member SPEAKER_PROPERTIES_CHANGED
SPEAKER_PROPERTIES_CHANGED = 'speaker-change'
Emitted when the mute state or the volume changed. The Apple Home App typically does not set those values except the mute state. When you unmute the device microphone it will reset the mute state if it was set previously.
enum Categories
const enum Categories { OTHER = 1, BRIDGE = 2, FAN = 3, GARAGE_DOOR_OPENER = 4, LIGHTBULB = 5, DOOR_LOCK = 6, OUTLET = 7, SWITCH = 8, THERMOSTAT = 9, SENSOR = 10, ALARM_SYSTEM = 11, SECURITY_SYSTEM = 11, DOOR = 12, WINDOW = 13, WINDOW_COVERING = 14, PROGRAMMABLE_SWITCH = 15, RANGE_EXTENDER = 16, CAMERA = 17, IP_CAMERA = 17, VIDEO_DOORBELL = 18, AIR_PURIFIER = 19, AIR_HEATER = 20, AIR_CONDITIONER = 21, AIR_HUMIDIFIER = 22, AIR_DEHUMIDIFIER = 23, APPLE_TV = 24, HOMEPOD = 25, SPEAKER = 26, AIRPORT = 27, SPRINKLER = 28, FAUCET = 29, SHOWER_HEAD = 30, TELEVISION = 31, TARGET_CONTROLLER = 32, ROUTER = 33, AUDIO_RECEIVER = 34, TV_SET_TOP_BOX = 35, TV_STREAMING_STICK = 36,}
Known category values. Category is a hint to iOS clients about what "type" of Accessory this represents, for UI only.
Accessory
member AIR_CONDITIONER
AIR_CONDITIONER = 21
member AIR_DEHUMIDIFIER
AIR_DEHUMIDIFIER = 23
member AIR_HEATER
AIR_HEATER = 20
member AIR_HUMIDIFIER
AIR_HUMIDIFIER = 22
member AIR_PURIFIER
AIR_PURIFIER = 19
member AIRPORT
AIRPORT = 27
member ALARM_SYSTEM
ALARM_SYSTEM = 11
member APPLE_TV
APPLE_TV = 24
member AUDIO_RECEIVER
AUDIO_RECEIVER = 34
member BRIDGE
BRIDGE = 2
member CAMERA
CAMERA = 17
member DOOR
DOOR = 12
member DOOR_LOCK
DOOR_LOCK = 6
member FAN
FAN = 3
member FAUCET
FAUCET = 29
member GARAGE_DOOR_OPENER
GARAGE_DOOR_OPENER = 4
member HOMEPOD
HOMEPOD = 25
member IP_CAMERA
IP_CAMERA = 17
member LIGHTBULB
LIGHTBULB = 5
member OTHER
OTHER = 1
member OUTLET
OUTLET = 7
member PROGRAMMABLE_SWITCH
PROGRAMMABLE_SWITCH = 15
member RANGE_EXTENDER
RANGE_EXTENDER = 16
member ROUTER
ROUTER = 33
member SECURITY_SYSTEM
SECURITY_SYSTEM = 11
member SENSOR
SENSOR = 10
member SHOWER_HEAD
SHOWER_HEAD = 30
member SPEAKER
SPEAKER = 26
member SPRINKLER
SPRINKLER = 28
member SWITCH
SWITCH = 8
member TARGET_CONTROLLER
TARGET_CONTROLLER = 32
member TELEVISION
TELEVISION = 31
member THERMOSTAT
THERMOSTAT = 9
member TV_SET_TOP_BOX
TV_SET_TOP_BOX = 35
member TV_STREAMING_STICK
TV_STREAMING_STICK = 36
member VIDEO_DOORBELL
VIDEO_DOORBELL = 18
member WINDOW
WINDOW = 13
member WINDOW_COVERING
WINDOW_COVERING = 14
enum ChangeReason
const enum ChangeReason { WRITE = 'write', UPDATE = 'update', READ = 'read', EVENT = 'event',}
Characteristic
member EVENT
EVENT = 'event'
Used when call to Characteristic.sendEventNotification was made.
member READ
READ = 'read'
Used when HomeKit reads a value or the API user calls the deprecated method
Characteristic.getValue
.
member UPDATE
UPDATE = 'update'
Reason used when the API user calls the method Characteristic.updateValue.
member WRITE
WRITE = 'write'
Reason used when HomeKit writes a value or the API user calls Characteristic.setValue.
enum CharacteristicEventTypes
const enum CharacteristicEventTypes { GET = 'get', SET = 'set', CHANGE = 'change', SUBSCRIBE = 'subscribe', UNSUBSCRIBE = 'unsubscribe', CHARACTERISTIC_WARNING = 'characteristic-warning',}
Characteristic
member CHANGE
CHANGE = 'change'
Emitted after a new value is set for the characteristic. The new value can be set via a request by a HomeKit controller or via an API call.
member CHARACTERISTIC_WARNING
CHARACTERISTIC_WARNING = 'characteristic-warning'
member GET
GET = 'get'
This event is thrown when a HomeKit controller wants to read the current value of the characteristic. The event handler should call the supplied callback as fast as possible.
HAP-NodeJS will complain about slow running get handlers after 3 seconds and terminate the request after 10 seconds.
member SET
SET = 'set'
This event is thrown when a HomeKit controller wants to write a new value to the characteristic. The event handler should call the supplied callback as fast as possible.
HAP-NodeJS will complain about slow running set handlers after 3 seconds and terminate the request after 10 seconds.
member SUBSCRIBE
SUBSCRIBE = 'subscribe'
member UNSUBSCRIBE
UNSUBSCRIBE = 'unsubscribe'
enum CharacteristicWarningType
const enum CharacteristicWarningType { SLOW_WRITE = 'slow-write', TIMEOUT_WRITE = 'timeout-write', SLOW_READ = 'slow-read', TIMEOUT_READ = 'timeout-read', WARN_MESSAGE = 'warn-message', ERROR_MESSAGE = 'error-message', DEBUG_MESSAGE = 'debug-message',}
Accessory
member DEBUG_MESSAGE
DEBUG_MESSAGE = 'debug-message'
member ERROR_MESSAGE
ERROR_MESSAGE = 'error-message'
member SLOW_READ
SLOW_READ = 'slow-read'
member SLOW_WRITE
SLOW_WRITE = 'slow-write'
member TIMEOUT_READ
TIMEOUT_READ = 'timeout-read'
member TIMEOUT_WRITE
TIMEOUT_WRITE = 'timeout-write'
member WARN_MESSAGE
WARN_MESSAGE = 'warn-message'
enum DataFormatTags
const enum DataFormatTags { INVALID = 0, TRUE = 1, FALSE = 2, TERMINATOR = 3, NULL = 4, UUID = 5, DATE = 6, INTEGER_MINUS_ONE = 7, INTEGER_RANGE_START_0 = 8, INTEGER_RANGE_STOP_39 = 46, INT8 = 48, INT16LE = 49, INT32LE = 50, INT64LE = 51, FLOAT32LE = 53, FLOAT64LE = 54, UTF8_LENGTH_START = 64, UTF8_LENGTH_STOP = 96, UTF8_LENGTH8 = 97, UTF8_LENGTH16LE = 98, UTF8_LENGTH32LE = 99, UTF8_LENGTH64LE = 100, UTF8_NULL_TERMINATED = 111, DATA_LENGTH_START = 112, DATA_LENGTH_STOP = 144, DATA_LENGTH8 = 145, DATA_LENGTH16LE = 146, DATA_LENGTH32LE = 147, DATA_LENGTH64LE = 148, DATA_TERMINATED = 159, COMPRESSION_START = 160, COMPRESSION_STOP = 207, ARRAY_LENGTH_START = 208, ARRAY_LENGTH_STOP = 222, ARRAY_TERMINATED = 223, DICTIONARY_LENGTH_START = 224, DICTIONARY_LENGTH_STOP = 238, DICTIONARY_TERMINATED = 239,}
HomeKit Data Streams (HDS)
member ARRAY_LENGTH_START
ARRAY_LENGTH_START = 208
member ARRAY_LENGTH_STOP
ARRAY_LENGTH_STOP = 222
member ARRAY_TERMINATED
ARRAY_TERMINATED = 223
member COMPRESSION_START
COMPRESSION_START = 160
member COMPRESSION_STOP
COMPRESSION_STOP = 207
member DATA_LENGTH_START
DATA_LENGTH_START = 112
member DATA_LENGTH_STOP
DATA_LENGTH_STOP = 144
member DATA_LENGTH16LE
DATA_LENGTH16LE = 146
member DATA_LENGTH32LE
DATA_LENGTH32LE = 147
member DATA_LENGTH64LE
DATA_LENGTH64LE = 148
member DATA_LENGTH8
DATA_LENGTH8 = 145
member DATA_TERMINATED
DATA_TERMINATED = 159
member DATE
DATE = 6
member DICTIONARY_LENGTH_START
DICTIONARY_LENGTH_START = 224
member DICTIONARY_LENGTH_STOP
DICTIONARY_LENGTH_STOP = 238
member DICTIONARY_TERMINATED
DICTIONARY_TERMINATED = 239
member FALSE
FALSE = 2
member FLOAT32LE
FLOAT32LE = 53
member FLOAT64LE
FLOAT64LE = 54
member INT16LE
INT16LE = 49
member INT32LE
INT32LE = 50
member INT64LE
INT64LE = 51
member INT8
INT8 = 48
member INTEGER_MINUS_ONE
INTEGER_MINUS_ONE = 7
member INTEGER_RANGE_START_0
INTEGER_RANGE_START_0 = 8
member INTEGER_RANGE_STOP_39
INTEGER_RANGE_STOP_39 = 46
member INVALID
INVALID = 0
member NULL
NULL = 4
member TERMINATOR
TERMINATOR = 3
member TRUE
TRUE = 1
member UTF8_LENGTH_START
UTF8_LENGTH_START = 64
member UTF8_LENGTH_STOP
UTF8_LENGTH_STOP = 96
member UTF8_LENGTH16LE
UTF8_LENGTH16LE = 98
member UTF8_LENGTH32LE
UTF8_LENGTH32LE = 99
member UTF8_LENGTH64LE
UTF8_LENGTH64LE = 100
member UTF8_LENGTH8
UTF8_LENGTH8 = 97
member UTF8_NULL_TERMINATED
UTF8_NULL_TERMINATED = 111
member UUID
UUID = 5
enum DataStreamConnectionEvent
const enum DataStreamConnectionEvent { IDENTIFICATION = 'identification', HANDLE_MESSAGE_GLOBALLY = 'handle-message-globally', CLOSED = 'closed',}
HomeKit Data Streams (HDS)
member CLOSED
CLOSED = 'closed'
This event is emitted when the socket of the connection was closed.
member HANDLE_MESSAGE_GLOBALLY
HANDLE_MESSAGE_GLOBALLY = 'handle-message-globally'
This event is emitted when no handler could be found for the given protocol of an event or request message.
member IDENTIFICATION
IDENTIFICATION = 'identification'
This event is emitted when the first HDSFrame is received from a new connection. The connection expects the handler to identify the connection by trying to match the decryption keys. If identification was successful the PreparedDataStreamSession should be supplied to the callback, otherwise undefined should be supplied.
enum DataStreamServerEvent
const enum DataStreamServerEvent { CONNECTION_OPENED = 'connection-opened', CONNECTION_CLOSED = 'connection-closed',}
HomeKit Data Streams (HDS)
member CONNECTION_CLOSED
CONNECTION_CLOSED = 'connection-closed'
This event is emitted when the socket of a connection gets closed.
member CONNECTION_OPENED
CONNECTION_OPENED = 'connection-opened'
This event is emitted when a new client socket is received. At this point we have no idea to what hap session this connection will be matched.
enum DataStreamStatus
const enum DataStreamStatus { SUCCESS = 0, GENERIC_ERROR = 1, BUSY = 2,}
HomeKit Data Streams (HDS)
enum DefaultControllerType
const enum DefaultControllerType { CAMERA = 'camera', REMOTE = 'remote', TV = 'tv', ROUTER = 'router', LOCK = 'lock', CHARACTERISTIC_TRANSITION = 'characteristic-transition',}
Controller API
enum EventedHTTPServerEvent
const enum EventedHTTPServerEvent { LISTENING = 'listening', CONNECTION_OPENED = 'connection-opened', REQUEST = 'request', CONNECTION_CLOSED = 'connection-closed',}
HAP Accessory Server
member CONNECTION_CLOSED
CONNECTION_CLOSED = 'connection-closed'
member CONNECTION_OPENED
CONNECTION_OPENED = 'connection-opened'
member LISTENING
LISTENING = 'listening'
member REQUEST
REQUEST = 'request'
enum EventTriggerOption
const enum EventTriggerOption { MOTION = 1, DOORBELL = 2,}
Describes the Event trigger.
Camera
member DOORBELL
DOORBELL = 2
The Doorbell trigger. If enabled a doorbell button press should trigger the start of a recording.
Note: While the doorbell is defined by the HomeKit specification and HAP-NodeJS supports (and the RecordingManagement advertises support for it), HomeKit HomeHubs will (as of now, iOS 15-16) never enable Doorbell triggers. Seemingly this is currently unsupported by Apple. See https://github.com/homebridge/HAP-NodeJS/issues/976#issuecomment-1280301989.
member MOTION
MOTION = 1
The Motion trigger. If enabled motion should trigger the start of a recording.
enum Formats
const enum Formats { BOOL = 'bool', INT = 'int', FLOAT = 'float', STRING = 'string', UINT8 = 'uint8', UINT16 = 'uint16', UINT32 = 'uint32', UINT64 = 'uint64', DATA = 'data', TLV8 = 'tlv8',}
Characteristic
member BOOL
BOOL = 'bool'
member DATA
DATA = 'data'
Data is base64 encoded string.
member FLOAT
FLOAT = 'float'
Signed 64-bit floating point
member INT
INT = 'int'
Signed 32-bit integer
member STRING
STRING = 'string'
String encoded in utf8
member TLV8
TLV8 = 'tlv8'
Base64 encoded tlv8 string.
member UINT16
UINT16 = 'uint16'
Unsigned 16-bit integer.
member UINT32
UINT32 = 'uint32'
Unsigned 32-bit integer.
member UINT64
UINT64 = 'uint64'
Unsigned 64-bit integer.
member UINT8
UINT8 = 'uint8'
Unsigned 8-bit integer.
enum H264Level
const enum H264Level { LEVEL3_1 = 0, LEVEL3_2 = 1, LEVEL4_0 = 2,}
Camera
enum H264Profile
const enum H264Profile { BASELINE = 0, MAIN = 1, HIGH = 2,}
Camera
enum HAPConnectionEvent
const enum HAPConnectionEvent { REQUEST = 'request', AUTHENTICATED = 'authenticated', CLOSED = 'closed',}
HAP Accessory Server
member AUTHENTICATED
AUTHENTICATED = 'authenticated'
member CLOSED
CLOSED = 'closed'
member REQUEST
REQUEST = 'request'
enum HAPConnectionState
const enum HAPConnectionState { CONNECTING = 0, FULLY_SET_UP = 1, AUTHENTICATED = 2, TO_BE_TEARED_DOWN = 3, CLOSING = 4, CLOSED = 5,}
HAP Accessory Server
member AUTHENTICATED
AUTHENTICATED = 2
member CLOSED
CLOSED = 5
member CLOSING
CLOSING = 4
member CONNECTING
CONNECTING = 0
member FULLY_SET_UP
FULLY_SET_UP = 1
member TO_BE_TEARED_DOWN
TO_BE_TEARED_DOWN = 3
enum HAPHTTPCode
const enum HAPHTTPCode { OK = 200, NO_CONTENT = 204, MULTI_STATUS = 207, BAD_REQUEST = 400, NOT_FOUND = 404, UNPROCESSABLE_ENTITY = 422, INTERNAL_SERVER_ERROR = 500, SERVICE_UNAVAILABLE = 503,}
Those status codes are the one listed as appropriate for the HAP spec!
When the response is a client error 4xx or server error 5xx, the response must include a status HAPStatus property.
When the response is a MULTI_STATUS EVERY entry in the characteristics property MUST include a status property (even success).
HAP Accessory Server
member BAD_REQUEST
BAD_REQUEST = 400
member INTERNAL_SERVER_ERROR
INTERNAL_SERVER_ERROR = 500
member MULTI_STATUS
MULTI_STATUS = 207
member NO_CONTENT
NO_CONTENT = 204
member NOT_FOUND
NOT_FOUND = 404
member OK
OK = 200
member SERVICE_UNAVAILABLE
SERVICE_UNAVAILABLE = 503
member UNPROCESSABLE_ENTITY
UNPROCESSABLE_ENTITY = 422
enum HAPPairingHTTPCode
const enum HAPPairingHTTPCode { OK = 200, BAD_REQUEST = 400, METHOD_NOT_ALLOWED = 405, TOO_MANY_REQUESTS = 429, CONNECTION_AUTHORIZATION_REQUIRED = 470, INTERNAL_SERVER_ERROR = 500,}
When in a request is made to the pairing endpoints, and mime type is 'application/pairing+tlv8' one should use the below status codes.
HAP Accessory Server
member BAD_REQUEST
BAD_REQUEST = 400
member CONNECTION_AUTHORIZATION_REQUIRED
CONNECTION_AUTHORIZATION_REQUIRED = 470
member INTERNAL_SERVER_ERROR
INTERNAL_SERVER_ERROR = 500
member METHOD_NOT_ALLOWED
METHOD_NOT_ALLOWED = 405
member OK
OK = 200
member TOO_MANY_REQUESTS
TOO_MANY_REQUESTS = 429
enum HAPServerEventTypes
const enum HAPServerEventTypes { LISTENING = 'listening', IDENTIFY = 'identify', ADD_PAIRING = 'add-pairing', REMOVE_PAIRING = 'remove-pairing', LIST_PAIRINGS = 'list-pairings', PAIR = 'pair', ACCESSORIES = 'accessories', GET_CHARACTERISTICS = 'get-characteristics', SET_CHARACTERISTICS = 'set-characteristics', REQUEST_RESOURCE = 'request-resource', CONNECTION_CLOSED = 'connection-closed',}
HAP Accessory Server
member ACCESSORIES
ACCESSORIES = 'accessories'
This event is emitted when a client requests the complete representation of Accessory data for this Accessory (for instance, what services, characteristics, etc. are supported) and any bridged Accessories in the case of a Bridge Accessory. The listener must call the provided callback function when the accessory data is ready. We will automatically JSON.stringify the data.
member ADD_PAIRING
ADD_PAIRING = 'add-pairing'
member CONNECTION_CLOSED
CONNECTION_CLOSED = 'connection-closed'
member GET_CHARACTERISTICS
GET_CHARACTERISTICS = 'get-characteristics'
This event is emitted when a client wishes to retrieve the current value of one or more characteristics. The listener must call the provided callback function when the values are ready. iOS clients can typically wait up to 10 seconds for this call to return. We will automatically JSON.stringify the data (which must be an array) and wrap it in an object with a top-level "characteristics" property.
member IDENTIFY
IDENTIFY = 'identify'
Emitted when a client wishes for this server to identify itself before pairing. You must call the callback to respond to the client with success.
member LIST_PAIRINGS
LIST_PAIRINGS = 'list-pairings'
member LISTENING
LISTENING = 'listening'
Emitted when the server is fully set up and ready to receive connections.
member PAIR
PAIR = 'pair'
This event is emitted when a client completes the "pairing" process and exchanges encryption keys. Note that this does not mean the "Add Accessory" process in iOS has completed. You must call the callback to complete the process.
member REMOVE_PAIRING
REMOVE_PAIRING = 'remove-pairing'
member REQUEST_RESOURCE
REQUEST_RESOURCE = 'request-resource'
member SET_CHARACTERISTICS
SET_CHARACTERISTICS = 'set-characteristics'
This event is emitted when a client wishes to set the current value of one or more characteristics and/or subscribe to one or more events. The 'events' param is an initially-empty object, associated with the current connection, on which you may store event registration keys for later processing. The listener must call the provided callback when the request has been processed.
enum HAPStatus
const enum HAPStatus { SUCCESS = 0, INSUFFICIENT_PRIVILEGES = -70401, SERVICE_COMMUNICATION_FAILURE = -70402, RESOURCE_BUSY = -70403, READ_ONLY_CHARACTERISTIC = -70404, WRITE_ONLY_CHARACTERISTIC = -70405, NOTIFICATION_NOT_SUPPORTED = -70406, OUT_OF_RESOURCE = -70407, OPERATION_TIMED_OUT = -70408, RESOURCE_DOES_NOT_EXIST = -70409, INVALID_VALUE_IN_REQUEST = -70410, INSUFFICIENT_AUTHORIZATION = -70411, NOT_ALLOWED_IN_CURRENT_STATE = -70412,}
HAP Accessory Server
member INSUFFICIENT_AUTHORIZATION
INSUFFICIENT_AUTHORIZATION = -70411
Insufficient authorization.
member INSUFFICIENT_PRIVILEGES
INSUFFICIENT_PRIVILEGES = -70401
The request was rejected due to insufficient privileges.
member INVALID_VALUE_IN_REQUEST
INVALID_VALUE_IN_REQUEST = -70410
Received an invalid value in the given request for the given characteristic.
member NOT_ALLOWED_IN_CURRENT_STATE
NOT_ALLOWED_IN_CURRENT_STATE = -70412
Operation not allowed in the current state.
member NOTIFICATION_NOT_SUPPORTED
NOTIFICATION_NOT_SUPPORTED = -70406
Event notifications are not supported for the requested characteristic (Perms.NOTIFY not defined).
member OPERATION_TIMED_OUT
OPERATION_TIMED_OUT = -70408
The operation timed out.
member OUT_OF_RESOURCE
OUT_OF_RESOURCE = -70407
The device is out of resources to process the request.
member READ_ONLY_CHARACTERISTIC
READ_ONLY_CHARACTERISTIC = -70404
Cannot write a read-only characteristic (Perms.PAIRED_WRITE not defined).
member RESOURCE_BUSY
RESOURCE_BUSY = -70403
The resource is busy. Try again.
member RESOURCE_DOES_NOT_EXIST
RESOURCE_DOES_NOT_EXIST = -70409
The given resource does not exist.
member SERVICE_COMMUNICATION_FAILURE
SERVICE_COMMUNICATION_FAILURE = -70402
Operation failed due to some communication failure with the characteristic.
member SUCCESS
SUCCESS = 0
Success of the request.
member WRITE_ONLY_CHARACTERISTIC
WRITE_ONLY_CHARACTERISTIC = -70405
Cannot read from a write-only characteristic (Perms.PAIRED_READ not defined).
enum HDSConnectionErrorType
const enum HDSConnectionErrorType { ILLEGAL_STATE = 1, CLOSED_SOCKET = 2, MAX_PAYLOAD_LENGTH = 3,}
HomeKit Data Streams (HDS)
member CLOSED_SOCKET
CLOSED_SOCKET = 2
member ILLEGAL_STATE
ILLEGAL_STATE = 1
member MAX_PAYLOAD_LENGTH
MAX_PAYLOAD_LENGTH = 3
enum HDSProtocolSpecificErrorReason
const enum HDSProtocolSpecificErrorReason { NORMAL = 0, NOT_ALLOWED = 1, BUSY = 2, CANCELLED = 3, UNSUPPORTED = 4, UNEXPECTED_FAILURE = 5, TIMEOUT = 6, BAD_DATA = 7, PROTOCOL_ERROR = 8, INVALID_CONFIGURATION = 9,}
HomeKit Data Streams (HDS)
member BAD_DATA
BAD_DATA = 7
member BUSY
BUSY = 2
member CANCELLED
CANCELLED = 3
member INVALID_CONFIGURATION
INVALID_CONFIGURATION = 9
member NORMAL
NORMAL = 0
member NOT_ALLOWED
NOT_ALLOWED = 1
member PROTOCOL_ERROR
PROTOCOL_ERROR = 8
member TIMEOUT
TIMEOUT = 6
member UNEXPECTED_FAILURE
UNEXPECTED_FAILURE = 5
member UNSUPPORTED
UNSUPPORTED = 4
enum HDSStatus
enum HDSStatus { SUCCESS = 0, OUT_OF_MEMORY = 1, TIMEOUT = 2, HEADER_ERROR = 3, PAYLOAD_ERROR = 4, MISSING_PROTOCOL = 5, PROTOCOL_SPECIFIC_ERROR = 6,}
HomeKit Data Streams (HDS)
member HEADER_ERROR
HEADER_ERROR = 3
member MISSING_PROTOCOL
MISSING_PROTOCOL = 5
member OUT_OF_MEMORY
OUT_OF_MEMORY = 1
member PAYLOAD_ERROR
PAYLOAD_ERROR = 4
member PROTOCOL_SPECIFIC_ERROR
PROTOCOL_SPECIFIC_ERROR = 6
member SUCCESS
SUCCESS = 0
member TIMEOUT
TIMEOUT = 2
enum MDNSAdvertiser
const enum MDNSAdvertiser { CIAO = 'ciao', BONJOUR = 'bonjour-hap', AVAHI = 'avahi', RESOLVED = 'resolved',}
Accessory
member AVAHI
AVAHI = 'avahi'
Use Avahi/D-Bus as advertiser.
member BONJOUR
BONJOUR = 'bonjour-hap'
Use the
bonjour-hap
module as advertiser.
member CIAO
CIAO = 'ciao'
Use the
@homebridge/ciao
module as advertiser.
member RESOLVED
RESOLVED = 'resolved'
Use systemd-resolved/D-Bus as advertiser.
Note: The systemd-resolved D-Bus interface doesn't provide means to detect restarts of the service. Therefore, we can't detect if our advertisement might be lost due to a restart of the systemd-resolved daemon restart. Consequentially, treat this feature as an experimental feature.
enum MediaContainerType
const enum MediaContainerType { FRAGMENTED_MP4 = 0,}
Camera
member FRAGMENTED_MP4
FRAGMENTED_MP4 = 0
enum MessageType
const enum MessageType { EVENT = 1, REQUEST = 2, RESPONSE = 3,}
HomeKit Data Streams (HDS)
enum PacketDataType
const enum PacketDataType { MEDIA_INITIALIZATION = 'mediaInitialization', MEDIA_FRAGMENT = 'mediaFragment',}
Camera
member MEDIA_FRAGMENT
MEDIA_FRAGMENT = 'mediaFragment'
mp4 moof + mdat boxes
member MEDIA_INITIALIZATION
MEDIA_INITIALIZATION = 'mediaInitialization'
mp4 moov box
enum PermissionTypes
const enum PermissionTypes { USER = 0, ADMIN = 1,}
Model
enum Perms
const enum Perms { PAIRED_READ = 'pr', PAIRED_WRITE = 'pw', NOTIFY = 'ev', EVENTS = 'ev', ADDITIONAL_AUTHORIZATION = 'aa', TIMED_WRITE = 'tw', HIDDEN = 'hd', WRITE_RESPONSE = 'wr',}
Characteristic
member ADDITIONAL_AUTHORIZATION
ADDITIONAL_AUTHORIZATION = 'aa'
member EVENTS
EVENTS = 'ev'
member HIDDEN
HIDDEN = 'hd'
member NOTIFY
NOTIFY = 'ev'
member PAIRED_READ
PAIRED_READ = 'pr'
member PAIRED_WRITE
PAIRED_WRITE = 'pw'
member TIMED_WRITE
TIMED_WRITE = 'tw'
member WRITE_RESPONSE
WRITE_RESPONSE = 'wr'
enum Protocols
const enum Protocols { CONTROL = 'control', TARGET_CONTROL = 'targetControl', DATA_SEND = 'dataSend',}
HomeKit Data Streams (HDS)
member CONTROL
CONTROL = 'control'
member DATA_SEND
DATA_SEND = 'dataSend'
member TARGET_CONTROL
TARGET_CONTROL = 'targetControl'
enum RemoteControllerEvents
const enum RemoteControllerEvents { ACTIVE_CHANGE = 'active-change', ACTIVE_IDENTIFIER_CHANGE = 'active-identifier-change', TARGET_ADDED = 'target-add', TARGET_UPDATED = 'target-update', TARGET_REMOVED = 'target-remove', TARGETS_RESET = 'targets-reset',}
Apple TV Remote
member ACTIVE_CHANGE
ACTIVE_CHANGE = 'active-change'
This event is emitted when the active state of the remote has changed. active = true indicates that there is currently an Apple TV listening of button presses and audio streams.
member ACTIVE_IDENTIFIER_CHANGE
ACTIVE_IDENTIFIER_CHANGE = 'active-identifier-change'
This event is emitted when the currently selected target has changed. Possible reasons for a changed active identifier: manual change via api call, first target configuration gets added, active target gets removed, accessory gets unpaired, reset request was sent. An activeIdentifier of 0 indicates that no target is selected.
member TARGET_ADDED
TARGET_ADDED = 'target-add'
This event is emitted when a new target configuration is received. As we currently do not persistently store configured targets, this will be called at every startup for every Apple TV configured in the home.
member TARGET_REMOVED
TARGET_REMOVED = 'target-remove'
This event is emitted when an existing configuration for a target was removed.
member TARGET_UPDATED
TARGET_UPDATED = 'target-update'
This event is emitted when an existing target was updated. The 'updates' array indicates what exactly was changed for the target.
member TARGETS_RESET
TARGETS_RESET = 'targets-reset'
This event is emitted when a reset of the target configuration is requested. With this event every configuration made should be reset. This event is also called when the accessory gets unpaired.
enum ResourceRequestReason
const enum ResourceRequestReason { PERIODIC = 0, EVENT = 1,}
Camera
member EVENT
EVENT = 1
The resource request is the result of some event. In the example of camera image snapshots, requests are made due to e.g. a motion event or similar.
member PERIODIC
PERIODIC = 0
The reason describes periodic resource requests. In the example of camera image snapshots those are the typical preview images every 10 seconds.
enum ResourceRequestType
const enum ResourceRequestType { IMAGE = 'image',}
HAP Accessory Server
member IMAGE
IMAGE = 'image'
enum ServiceEventTypes
const enum ServiceEventTypes { CHARACTERISTIC_CHANGE = 'characteristic-change', SERVICE_CONFIGURATION_CHANGE = 'service-configurationChange', CHARACTERISTIC_WARNING = 'characteristic-warning',}
Service
member CHARACTERISTIC_CHANGE
CHARACTERISTIC_CHANGE = 'characteristic-change'
member CHARACTERISTIC_WARNING
CHARACTERISTIC_WARNING = 'characteristic-warning'
member SERVICE_CONFIGURATION_CHANGE
SERVICE_CONFIGURATION_CHANGE = 'service-configurationChange'
enum SiriAudioSessionEvents
const enum SiriAudioSessionEvents { CLOSE = 'close',}
Apple TV Remote
member CLOSE
CLOSE = 'close'
enum SRTPCryptoSuites
const enum SRTPCryptoSuites { AES_CM_128_HMAC_SHA1_80 = 0, AES_CM_256_HMAC_SHA1_80 = 1, NONE = 2,}
Camera
member AES_CM_128_HMAC_SHA1_80
AES_CM_128_HMAC_SHA1_80 = 0
member AES_CM_256_HMAC_SHA1_80
AES_CM_256_HMAC_SHA1_80 = 1
member NONE
NONE = 2
enum StreamRequestTypes
const enum StreamRequestTypes { RECONFIGURE = 'reconfigure', START = 'start', STOP = 'stop',}
Camera
enum TargetCategory
const enum TargetCategory { UNDEFINED = 0, APPLE_TV = 24,}
Apple TV Remote
enum TargetUpdates
const enum TargetUpdates { NAME = 0, CATEGORY = 1, UPDATED_BUTTONS = 2, REMOVED_BUTTONS = 3,}
Apple TV Remote
member CATEGORY
CATEGORY = 1
member NAME
NAME = 0
member REMOVED_BUTTONS
REMOVED_BUTTONS = 3
member UPDATED_BUTTONS
UPDATED_BUTTONS = 2
enum TLVErrorCode
const enum TLVErrorCode { UNKNOWN = 1, INVALID_REQUEST = 2, AUTHENTICATION = 2, BACKOFF = 3, MAX_PEERS = 4, MAX_TRIES = 5, UNAVAILABLE = 6, BUSY = 7,}
TLV error codes for the
TLVValues.ERROR_CODE
field.HAP Accessory Server
member AUTHENTICATION
AUTHENTICATION = 2
member BACKOFF
BACKOFF = 3
member BUSY
BUSY = 7
member INVALID_REQUEST
INVALID_REQUEST = 2
member MAX_PEERS
MAX_PEERS = 4
member MAX_TRIES
MAX_TRIES = 5
member UNAVAILABLE
UNAVAILABLE = 6
member UNKNOWN
UNKNOWN = 1
enum Topics
const enum Topics { HELLO = 'hello', WHOAMI = 'whoami', OPEN = 'open', DATA = 'data', ACK = 'ack', CLOSE = 'close',}
HomeKit Data Streams (HDS)
enum Units
const enum Units { CELSIUS = 'celsius', PERCENTAGE = 'percentage', ARC_DEGREE = 'arcdegrees', LUX = 'lux', SECONDS = 'seconds',}
Characteristic
member ARC_DEGREE
ARC_DEGREE = 'arcdegrees'
member CELSIUS
CELSIUS = 'celsius'
Celsius is the only temperature unit in the HomeKit Accessory Protocol. Unit conversion is always done on the client side e.g. on the iPhone in the Home App depending on the configured unit on the device itself.
member LUX
LUX = 'lux'
member PERCENTAGE
PERCENTAGE = 'percentage'
member SECONDS
SECONDS = 'seconds'
enum VideoCodecPacketizationMode
const enum VideoCodecPacketizationMode { NON_INTERLEAVED = 0,}
Camera
member NON_INTERLEAVED
NON_INTERLEAVED = 0
enum VideoCodecType
const enum VideoCodecType { H264 = 0,}
Camera
member H264
H264 = 0
Type Aliases
type AccessoriesCallback
type AccessoriesCallback = ( error: HAPHttpError | undefined, result?: AccessoriesResponse) => void;
HAP Accessory Server
type AccessoryCharacteristicChange
type AccessoryCharacteristicChange = ServiceCharacteristicChange & { service: Service;};
Accessory
type AdditionalAuthorizationHandler
type AdditionalAuthorizationHandler = ( additionalAuthorizationData: string | undefined) => boolean;
Characteristic
type AddPairingCallback
type AddPairingCallback = PairingsCallback;
HAP Accessory Server
type AudioCodecConfiguration
type AudioCodecConfiguration = { codecType: AudioCodecTypes; parameters: AudioCodecParameters;};
Apple TV Remote
type AudioCodecParameters
type AudioCodecParameters = { channels: number; bitrate: AudioBitrate; samplerate: AudioSamplerate; rtpTime?: RTPTime;};
Apple TV Remote
type AudioFrame
type AudioFrame = { data: Buffer; rms: number;};
Apple TV Remote
type AudioInfo
type AudioInfo = { codec: AudioStreamingCodecType; channel: number; bit_rate: number; sample_rate: AudioStreamingSamplerate; packet_time: number; pt: number; ssrc: number; max_bit_rate: number; rtcp_interval: number; comfort_pt: number; comfortNoiseEnabled: boolean;};
Camera
type AudioRecordingCodec
type AudioRecordingCodec = { type: AudioRecordingCodecType; /** * The count of audio channels. Must be at least `1`. * Defaults to `1`. */ audioChannels?: number; /** * The supported bitrate mode. Defaults to {@link AudioBitrate.VARIABLE}. */ bitrateMode?: AudioBitrate; samplerate: AudioRecordingSamplerate[] | AudioRecordingSamplerate;};
Camera
type AudioRecordingOptions
type AudioRecordingOptions = { /** * List (or single entry) of supported {@link AudioRecordingCodec}s. */ codecs: AudioRecordingCodec | AudioRecordingCodec[];};
Camera
type AudioStreamingCodec
type AudioStreamingCodec = { type: AudioStreamingCodecType | string; audioChannels?: number; bitrate?: AudioBitrate; samplerate: AudioStreamingSamplerate[] | AudioStreamingSamplerate;};
Camera
type AudioStreamingOptions
type AudioStreamingOptions = { codecs: AudioStreamingCodec[]; twoWayAudio?: boolean; comfort_noise?: boolean;};
Camera
type ButtonConfiguration
type ButtonConfiguration = { buttonID: number; buttonType: ButtonType; buttonName?: string;};
Apple TV Remote
type CameraStreamingOptions
type CameraStreamingOptions = CameraStreamingOptionsBase & (CameraStreamingOptionsLegacySRTP | CameraStreamingOptionsSupportedCryptoSuites);
Camera
type CharacteristicChange
type CharacteristicChange = { originator?: HAPConnection; newValue: Nullable<CharacteristicValue>; oldValue: Nullable<CharacteristicValue>; reason: ChangeReason; context?: CharacteristicContext;};
Characteristic
type CharacteristicContext
type CharacteristicContext = any;
Characteristic
type CharacteristicGetCallback
type CharacteristicGetCallback = ( status?: HAPStatus | null | Error, value?: Nullable<CharacteristicValue>) => void;
Characteristic
type CharacteristicGetHandler
type CharacteristicGetHandler = ( context: CharacteristicContext, connection?: HAPConnection) => Promise<Nullable<CharacteristicValue>> | Nullable<CharacteristicValue>;
Characteristic
type CharacteristicReadData
type CharacteristicReadData = CharacteristicReadDataValue | CharacteristicReadError;
HAP Accessory Server
type CharacteristicSetCallback
type CharacteristicSetCallback = ( error?: HAPStatus | null | Error, writeResponse?: Nullable<CharacteristicValue>) => void;
Characteristic
type CharacteristicSetHandler
type CharacteristicSetHandler = ( value: CharacteristicValue, context: CharacteristicContext, connection?: HAPConnection) => | Promise<Nullable<CharacteristicValue> | void> | Nullable<CharacteristicValue> | void;
Characteristic
type CharacteristicValue
type CharacteristicValue = | PrimitiveTypes | PrimitiveTypes[] | { [key: string]: PrimitiveTypes; };
Characteristic
type CharacteristicWriteData
type CharacteristicWriteData = | CharacteristicWriteDataValue | CharacteristicWriteError;
HAP Accessory Server
type ConstructorArgs
type ConstructorArgs<C> = C extends new (...args: infer A) => any ? A : never;
Type of the constructor arguments of the provided constructor type.
Utils
type ControllerIdentifier
type ControllerIdentifier = string | ControllerType;
Controller API
type ControllerType
type ControllerType = string | DefaultControllerType;
ControllerType is basically a string uniquely identifying the type of Controller. An Accessory only allows one type of Controller to be configured.
There are predefined types DefaultControllerType for all controller implementations provided by hap-nodejs. You can define custom ControllerTypes if you wish to, but be careful that it does not collide with any known definitions. Controller API
type DataStreamMessage
type DataStreamMessage = { type: MessageType; protocol: string; topic: string; id?: number; status?: HDSStatus; message: Record<any, any>;};
HomeKit Data Streams (HDS)
type ErrorHandler
type ErrorHandler = (error: HDSProtocolSpecificErrorReason) => void;
Apple TV Remote
type EventHandler
type EventHandler = (message: Record<any, any>) => void;
HomeKit Data Streams (HDS)
type EventName
type EventName = string;
HAP Accessory Server
type FrameHandler
type FrameHandler = (frame: AudioFrame) => void;
Apple TV Remote
type GlobalEventHandler
type GlobalEventHandler = ( connection: DataStreamConnection, message: Record<any, any>) => void;
HomeKit Data Streams (HDS)
type GlobalRequestHandler
type GlobalRequestHandler = ( connection: DataStreamConnection, id: number, message: Record<any, any>) => void;
HomeKit Data Streams (HDS)
type HAPHttpError
type HAPHttpError = { httpCode: HAPHTTPCode; status: HAPStatus;};
HAP Accessory Server
type HAPPincode
type HAPPincode = string;
Defines a pincode for the HAP accessory. Must have a format like "XXX-XX-XXX".
Accessory
type HAPUsername
type HAPUsername = string;
HAP Accessory Server
type HDSFrame
type HDSFrame = { header: Buffer; cipheredPayload: Buffer; authTag: Buffer; plaintextPayload?: Buffer;};
HomeKit Data Streams (HDS)
type IdentificationCallback
type IdentificationCallback = ( identifiedSession?: PreparedDataStreamSession) => void;
HomeKit Data Streams (HDS)
type IdentifyCallback
type IdentifyCallback = VoidCallback;
HAP Accessory Server
type InterfaceName
type InterfaceName = string;
Utils
type IPAddress
type IPAddress = IPv4Address | IPv6Address;
Utils
type IPv4Address
type IPv4Address = string;
Utils
type IPv6Address
type IPv6Address = string;
Utils
type ListPairingsCallback
type ListPairingsCallback = PairingsCallback<PairingInformation[]>;
HAP Accessory Server
type MacAddress
type MacAddress = string;
Defines a mac address. Must have a format like 'XX:XX:XX:XX:XX:XX' with XX being a valid hexadecimal string
Utils
type NodeCallback
type NodeCallback<T> = (err: Nullable<Error> | undefined, data?: T) => void;
Utils
type Nullable
type Nullable<T> = T | null;
Utils
type PairCallback
type PairCallback = VoidCallback;
HAP Accessory Server
type PairingsCallback
type PairingsCallback<T = void> = (error: TLVErrorCode | 0, data?: T) => void;
HAP Accessory Server
type PartialAllowingNull
type PartialAllowingNull<T> = { [P in keyof T]?: T[P] | null;};
Like TypeScripts
Partial
but allowing null as a value.Utils
type PartialCharacteristicReadData
type PartialCharacteristicReadData = | PartialCharacteristicReadDataValue | PartialCharacteristicReadError;
HAP Accessory Server
type PartialCharacteristicWriteData
type PartialCharacteristicWriteData = | PartialCharacteristicWriteDataValue | PartialCharacteristicWriteError;
HAP Accessory Server
type PreparedDataStreamSession
type PreparedDataStreamSession = { connection: HAPConnection; accessoryToControllerEncryptionKey: Buffer; controllerToAccessoryEncryptionKey: Buffer; accessoryKeySalt: Buffer; port?: number; connectTimeout?: NodeJS.Timeout;};
HomeKit Data Streams (HDS)
type PrepareSessionCallback
type PrepareSessionCallback = ( error?: Error, preparedSession?: PreparedDataStreamSession) => void;
HomeKit Data Streams (HDS)
type PrepareStreamCallback
type PrepareStreamCallback = ( error?: Error, response?: PrepareStreamResponse) => void;
Camera
type PrepareStreamRequest
type PrepareStreamRequest = { sessionID: StreamSessionIdentifier; sourceAddress: string; targetAddress: string; addressVersion: 'ipv4' | 'ipv6'; audio: Source; video: Source;};
Camera
type PrepareStreamResponse
type PrepareStreamResponse = { /** * Any value set to this optional property will overwrite the automatically determined local address, * which is sent as RTP endpoint to the iOS device. */ addressOverride?: string; video: SourceResponse | ProxiedSourceResponse; audio?: SourceResponse | ProxiedSourceResponse;};
Camera
type PrepareWriteRequest
type PrepareWriteRequest = { ttl: number; pid: number;};
HAP Accessory Server
type PrimitiveTypes
type PrimitiveTypes = string | number | boolean;
Utils
type ReadCharacteristicsCallback
type ReadCharacteristicsCallback = ( error: HAPHttpError | undefined, response?: CharacteristicsReadResponse) => void;
HAP Accessory Server
type ReconfiguredVideoInfo
type ReconfiguredVideoInfo = { width: number; height: number; fps: number; max_bit_rate: number; rtcp_interval: number;};
Camera
type ReconfigureStreamRequest
type ReconfigureStreamRequest = { sessionID: StreamSessionIdentifier; type: StreamRequestTypes.RECONFIGURE; video: ReconfiguredVideoInfo;};
Camera
type RemovePairingCallback
type RemovePairingCallback = PairingsCallback;
HAP Accessory Server
type RequestHandler
type RequestHandler = (id: number, message: Record<any, any>) => void;
HomeKit Data Streams (HDS)
type Resolution
type Resolution = [number, number, number];
Camera
type ResourceRequestCallback
type ResourceRequestCallback = ( error: HAPHttpError | undefined, resource?: Buffer) => void;
HAP Accessory Server
type ResponseHandler
type ResponseHandler = ( error: Error | undefined, status: HDSStatus | undefined, message: Record<any, any>) => void;
HomeKit Data Streams (HDS)
type RTPTime
type RTPTime = 20 | 30 | 40 | 60;
Apple TV Remote
type SerializedServiceMap
type SerializedServiceMap = Record<string, ServiceId>;
Controller API
type ServiceCharacteristicChange
type ServiceCharacteristicChange = CharacteristicChange & { characteristic: Characteristic;};
Service
type ServiceId
type ServiceId = string;
string with the format:
UUID + (subtype | "")
Service
type SessionIdentifier
type SessionIdentifier = string;
UUID string uniquely identifying every HAP connection.
HAP Accessory Server
type SnapshotRequest
type SnapshotRequest = { height: number; width: number; /** * An optional {@link ResourceRequestReason}. The client decides if it wants to send this value. It is typically * only sent in the context of HomeKit Secure Video Cameras. * This value might be used by a `CameraStreamingDelegate` for informational purposes. * When `handleSnapshotRequest` is called, it is already checked if the respective reason is allowed in the current camera configuration. */ reason?: ResourceRequestReason;};
Camera
type SnapshotRequestCallback
type SnapshotRequestCallback = (error?: Error | HAPStatus, buffer?: Buffer) => void;
Camera
type Source
type Source = { port: number; srtpCryptoSuite: SRTPCryptoSuites; srtp_key: Buffer; srtp_salt: Buffer; proxy_rtp?: number; proxy_rtcp?: number;};
Camera
type StartStreamRequest
type StartStreamRequest = { sessionID: StreamSessionIdentifier; type: StreamRequestTypes.START; video: VideoInfo; audio: AudioInfo;};
Camera
type StateChangeDelegate
type StateChangeDelegate = () => void;
Controller API
type StopStreamRequest
type StopStreamRequest = { sessionID: StreamSessionIdentifier; type: StreamRequestTypes.STOP;};
Camera
type StreamingRequest
type StreamingRequest = | StartStreamRequest | ReconfigureStreamRequest | StopStreamRequest;
Camera
type StreamRequestCallback
type StreamRequestCallback = (error?: Error) => void;
Camera
type StreamSessionIdentifier
type StreamSessionIdentifier = string;
Camera
type SupportedButtonConfiguration
type SupportedButtonConfiguration = { buttonID: number; buttonType: ButtonType;};
Apple TV Remote
type SupportedConfiguration
type SupportedConfiguration = { maximumTargets: number; ticksPerSecond: number; supportedButtonConfiguration: SupportedButtonConfiguration[]; hardwareImplemented: boolean;};
Apple TV Remote
type TargetConfiguration
type TargetConfiguration = { targetIdentifier: number; targetName?: string; targetCategory?: TargetCategory; buttonConfiguration: Record<number, ButtonConfiguration>;};
Apple TV Remote
type TLVEncodable
type TLVEncodable = Buffer | number | string;
TLV8
type VideoInfo
type VideoInfo = { codec: VideoCodecType; profile: H264Profile; level: H264Level; packetizationMode: VideoCodecPacketizationMode; cvoId?: number; width: number; height: number; fps: number; pt: number; ssrc: number; max_bit_rate: number; rtcp_interval: number; mtu: number;};
Camera
type VideoStreamingOptions
type VideoStreamingOptions = { codec: H264CodecParameters; resolutions: Resolution[]; cvoId?: number;};
Camera
type VoidCallback
type VoidCallback = (err?: Nullable<Error>) => void;
Utils
type WithUUID
type WithUUID<T> = T & { UUID: string;};
Utils
type WriteCharacteristicsCallback
type WriteCharacteristicsCallback = ( error: HAPHttpError | undefined, response?: CharacteristicsWriteResponse) => void;
HAP Accessory Server
Namespaces
namespace bonjour-hap
module 'bonjour-hap' {}
function createWithOptions
createWithOptions: (options?: MulticastOptions) => BonjourHAP;
class BonjourHAP
class BonjourHAP {}
method destroy
destroy: () => void;
method publish
publish: (options: PublishOptions) => BonjourHAPService;
method unpublishAll
unpublishAll: (callback: () => void) => void;
class BonjourHAPService
class BonjourHAPService {}
property fqdn
fqdn: string;
property host
host: string;
property name
name: string;
property port
port: number;
property protocol
protocol: Protocols;
property published
published: boolean;
property subtypes
subtypes: string[];
property txt
txt: Record<string, string>;
property type
type: string;
method destroy
destroy: () => void;
method start
start: () => void;
method stop
stop: (callback?: () => void) => void;
method updateTxt
updateTxt: (txt: TxtRecord, silent?: boolean) => void;
enum Protocols
const enum Protocols { TCP = 'tcp', UDP = 'udp',}
type MulticastOptions
type MulticastOptions = { multicast?: boolean; interface?: string; port?: number; ip?: string; ttl?: number; loopback?: boolean; reuseAddr?: boolean;};
type Nullable
type Nullable<T> = T | null;
type PublishOptions
type PublishOptions = { // eslint-disable-next-line @typescript-eslint/no-explicit-any category?: any; host?: string; name?: string; pincode?: string; port: number; protocol?: Protocols; subtypes?: string[]; txt?: Record<string, string>; type?: string; username?: string;
addUnsafeServiceEnumerationRecord?: boolean;
restrictedAddresses?: string[]; disabledIpv6?: boolean;};
type TxtRecord
type TxtRecord = Record<string, string>;
namespace LegacyTypes
module 'dist/accessories/types.d.ts' {}
variable ACCESSORY_INFORMATION_STYPE
const ACCESSORY_INFORMATION_STYPE: string;
variable ADMIN_ONLY_ACCESS_CTYPE
const ADMIN_ONLY_ACCESS_CTYPE: string;
variable ALARM_CURRENT_STATE_CTYPE
const ALARM_CURRENT_STATE_CTYPE: string;
variable ALARM_STYPE
const ALARM_STYPE: string;
variable ALARM_SYSTEM_TCTYPE
const ALARM_SYSTEM_TCTYPE: number;
variable ALARM_TARGET_STATE_CTYPE
const ALARM_TARGET_STATE_CTYPE: string;
variable AUDIO_FEEDBACK_CTYPE
const AUDIO_FEEDBACK_CTYPE: string;
variable BATTERY_LEVEL_CTYPE
const BATTERY_LEVEL_CTYPE: string;
variable BRIGHTNESS_CTYPE
const BRIGHTNESS_CTYPE: string;
variable CONTACT_SENSOR_STATE_CTYPE
const CONTACT_SENSOR_STATE_CTYPE: string;
variable CONTACT_SENSOR_STYPE
const CONTACT_SENSOR_STYPE: string;
variable COOLING_THRESHOLD_CTYPE
const COOLING_THRESHOLD_CTYPE: string;
variable CURRENT_DOOR_STATE_CTYPE
const CURRENT_DOOR_STATE_CTYPE: string;
variable CURRENT_LOCK_MECHANISM_STATE_CTYPE
const CURRENT_LOCK_MECHANISM_STATE_CTYPE: string;
variable CURRENT_RELATIVE_HUMIDITY_CTYPE
const CURRENT_RELATIVE_HUMIDITY_CTYPE: string;
variable CURRENT_TEMPERATURE_CTYPE
const CURRENT_TEMPERATURE_CTYPE: string;
variable CURRENTHEATINGCOOLING_CTYPE
const CURRENTHEATINGCOOLING_CTYPE: string;
variable DOOR_LOCK_TCTYPE
const DOOR_LOCK_TCTYPE: number;
variable DOOR_TCTYPE
const DOOR_TCTYPE: number;
variable FAN_STYPE
const FAN_STYPE: string;
variable FAN_TCTYPE
const FAN_TCTYPE: number;
variable FIRMWARE_REVISION_CTYPE
const FIRMWARE_REVISION_CTYPE: string;
variable GARAGE_DOOR_OPENER_STYPE
const GARAGE_DOOR_OPENER_STYPE: string;
variable GARAGE_DOOR_OPENER_TCTYPE
const GARAGE_DOOR_OPENER_TCTYPE: number;
variable HEATING_THRESHOLD_CTYPE
const HEATING_THRESHOLD_CTYPE: string;
variable HUE_CTYPE
const HUE_CTYPE: string;
variable HUMIDITY_SENSOR_STYPE
const HUMIDITY_SENSOR_STYPE: string;
variable IDENTIFY_CTYPE
const IDENTIFY_CTYPE: string;
variable LIGHTBULB_STYPE
const LIGHTBULB_STYPE: string;
variable LIGHTBULB_TCTYPE
const LIGHTBULB_TCTYPE: number;
variable LOCK_MANAGEMENT_AUTO_SECURE_TIMEOUT_CTYPE
const LOCK_MANAGEMENT_AUTO_SECURE_TIMEOUT_CTYPE: string;
variable LOCK_MANAGEMENT_CONTROL_POINT_CTYPE
const LOCK_MANAGEMENT_CONTROL_POINT_CTYPE: string;
variable LOCK_MANAGEMENT_STYPE
const LOCK_MANAGEMENT_STYPE: string;
variable LOCK_MECHANISM_LAST_KNOWN_ACTION_CTYPE
const LOCK_MECHANISM_LAST_KNOWN_ACTION_CTYPE: string;
variable LOCK_MECHANISM_STYPE
const LOCK_MECHANISM_STYPE: string;
variable LOGS_CTYPE
const LOGS_CTYPE: string;
variable MANUFACTURER_CTYPE
const MANUFACTURER_CTYPE: string;
variable MODEL_CTYPE
const MODEL_CTYPE: string;
variable MOTION_DETECTED_CTYPE
const MOTION_DETECTED_CTYPE: string;
variable MOTION_SENSOR_STYPE
const MOTION_SENSOR_STYPE: string;
variable NAME_CTYPE
const NAME_CTYPE: string;
variable OBSTRUCTION_DETECTED_CTYPE
const OBSTRUCTION_DETECTED_CTYPE: string;
variable OCCUPANCY_DETECTED_CTYPE
const OCCUPANCY_DETECTED_CTYPE: string;
variable OCCUPANCY_SENSOR_STYPE
const OCCUPANCY_SENSOR_STYPE: string;
variable OTHER_TCTYPE
const OTHER_TCTYPE: number;
variable OUTLET_IN_USE_CTYPE
const OUTLET_IN_USE_CTYPE: string;
variable OUTLET_STYPE
const OUTLET_STYPE: string;
variable OUTLET_TCTYPE
const OUTLET_TCTYPE: number;
variable POWER_STATE_CTYPE
const POWER_STATE_CTYPE: string;
variable PROGRAMMABLE_SWITCH_OUTPUT_STATE_CTYPE
const PROGRAMMABLE_SWITCH_OUTPUT_STATE_CTYPE: string;
variable PROGRAMMABLE_SWITCH_SWITCH_EVENT_CTYPE
const PROGRAMMABLE_SWITCH_SWITCH_EVENT_CTYPE: string;
variable PROGRAMMABLE_SWITCH_TCTYPE
const PROGRAMMABLE_SWITCH_TCTYPE: number;
variable ROTATION_DIRECTION_CTYPE
const ROTATION_DIRECTION_CTYPE: string;
variable ROTATION_SPEED_CTYPE
const ROTATION_SPEED_CTYPE: string;
variable SATURATION_CTYPE
const SATURATION_CTYPE: string;
variable SENSOR_TCTYPE
const SENSOR_TCTYPE: number;
variable SERIAL_NUMBER_CTYPE
const SERIAL_NUMBER_CTYPE: string;
variable STATUS_FAULT_CTYPE
const STATUS_FAULT_CTYPE: string;
variable STATUS_LOW_BATTERY_CTYPE
const STATUS_LOW_BATTERY_CTYPE: string;
variable SWITCH_STYPE
const SWITCH_STYPE: string;
variable SWITCH_TCTYPE
const SWITCH_TCTYPE: number;
variable TARGET_DOORSTATE_CTYPE
const TARGET_DOORSTATE_CTYPE: string;
variable TARGET_LOCK_MECHANISM_STATE_CTYPE
const TARGET_LOCK_MECHANISM_STATE_CTYPE: string;
variable TARGET_RELATIVE_HUMIDITY_CTYPE
const TARGET_RELATIVE_HUMIDITY_CTYPE: string;
variable TARGET_TEMPERATURE_CTYPE
const TARGET_TEMPERATURE_CTYPE: string;
variable TARGETHEATINGCOOLING_CTYPE
const TARGETHEATINGCOOLING_CTYPE: string;
variable TEMPERATURE_SENSOR_STYPE
const TEMPERATURE_SENSOR_STYPE: string;
variable TEMPERATURE_UNITS_CTYPE
const TEMPERATURE_UNITS_CTYPE: string;
variable THERMOSTAT_STYPE
const THERMOSTAT_STYPE: string;
variable THERMOSTAT_TCTYPE
const THERMOSTAT_TCTYPE: number;
variable VERSION_CTYPE
const VERSION_CTYPE: string;
variable WINDOW_COVERING_CURRENT_POSITION_CTYPE
const WINDOW_COVERING_CURRENT_POSITION_CTYPE: string;
variable WINDOW_COVERING_OPERATION_STATE_CTYPE
const WINDOW_COVERING_OPERATION_STATE_CTYPE: string;
variable WINDOW_COVERING_STYPE
const WINDOW_COVERING_STYPE: string;
variable WINDOW_COVERING_TARGET_POSITION_CTYPE
const WINDOW_COVERING_TARGET_POSITION_CTYPE: string;
variable WINDOW_COVERING_TCTYPE
const WINDOW_COVERING_TCTYPE: number;
variable WINDOW_TCTYPE
const WINDOW_TCTYPE: number;
namespace simple-plist
module 'simple-plist' {}
function readFileSync
readFileSync: (path: string) => Record<string, any>;
namespace uuid
module 'dist/lib/util/uuid.d.ts' {}
Parses the uuid as a string from the given Buffer. The parser will use the first 8 bytes.
Parameter buf
The buffer to read from.
variable BASE_UUID
const BASE_UUID: string;
function generate
generate: (data: BinaryLike) => string;
function isValid
isValid: (UUID: string) => boolean;
function toLongForm
toLongForm: (uuid: string, base?: string) => string;
function toShortForm
toShortForm: (uuid: string, base?: string) => string;
function unparse
unparse: { (buf: Buffer): string; (buf: Buffer, offset: number): string };
Parses the uuid as a string from the given Buffer. The parser will use the first 8 bytes.
Parameter buf
The buffer to read from.
Parses the uuid as a string from the given Buffer at the specified offset.
Parameter buf
The buffer to read from.
Parameter offset
The offset in the buffer to start reading from.
function write
write: { (uuid: string): Buffer; (uuid: string, buf: Buffer, offset: number): void;};
type Binary
type Binary = Buffer | NodeJS.TypedArray | DataView;
type BinaryLike
type BinaryLike = string | Binary;
Package Files (32)
- @types/bonjour-hap.d.ts
- @types/simple-plist.d.ts
- dist/accessories/types.d.ts
- dist/index.d.ts
- dist/lib/Accessory.d.ts
- dist/lib/Bridge.d.ts
- dist/lib/Characteristic.d.ts
- dist/lib/HAPServer.d.ts
- dist/lib/Service.d.ts
- dist/lib/camera/RTPProxy.d.ts
- dist/lib/camera/RTPStreamManagement.d.ts
- dist/lib/camera/RecordingManagement.d.ts
- dist/lib/controller/AdaptiveLightingController.d.ts
- dist/lib/controller/CameraController.d.ts
- dist/lib/controller/Controller.d.ts
- dist/lib/controller/DoorbellController.d.ts
- dist/lib/controller/RemoteController.d.ts
- dist/lib/datastream/DataStreamManagement.d.ts
- dist/lib/datastream/DataStreamParser.d.ts
- dist/lib/datastream/DataStreamServer.d.ts
- dist/lib/model/AccessoryInfo.d.ts
- dist/lib/model/HAPStorage.d.ts
- dist/lib/tv/AccessControlManagement.d.ts
- dist/lib/util/clone.d.ts
- dist/lib/util/color-utils.d.ts
- dist/lib/util/eventedhttp.d.ts
- dist/lib/util/hapStatusError.d.ts
- dist/lib/util/once.d.ts
- dist/lib/util/time.d.ts
- dist/lib/util/tlv.d.ts
- dist/lib/util/uuid.d.ts
- dist/types.d.ts
Dependencies (10)
Dev Dependencies (20)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/hap-nodejs
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/hap-nodejs)
- HTML<a href="https://www.jsdocs.io/package/hap-nodejs"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 17226 ms. - Missing or incorrect documentation? Open an issue for this package.