Class Characteristic

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.

Hierarchy (view full)

Constructors

Properties

Methods

Characteristic Definitions

AccessCodeControlPoint AccessCodeSupportedConfiguration AccessControlLevel AccessoryFlags AccessoryIdentifier Active ActiveIdentifier ActivityInterval 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 DiagonalFieldOfView DigitalZoom DisplayOrder EventRetransmissionMaximum EventSnapshotsActive EventTransmissionCounters FilterChangeIndication FilterLifeLevel FirmwareRevision FirmwareUpdateReadiness FirmwareUpdateStatus HardwareFinish HardwareRevision HeartBeat HeatingThresholdTemperature HoldPosition HomeKitCameraActive Hue Identifier Identify ImageMirroring ImageRotation InputDeviceType InputSourceType 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 OperatingStateResponse OpticalZoom OutletInUse OzoneDensity PairingFeatures PairSetup PairVerify PasswordSetting PeriodicSnapshotsActive PictureMode Ping PM10Density PM2_5Density PositionState PowerModeSelection ProductData ProgrammableSwitchEvent ProgrammableSwitchOutputState ProgramMode ReceivedSignalStrengthIndication ReceiverSensitivity RecordingAudioActive RelativeHumidityDehumidifierThreshold RelativeHumidityHumidifierThreshold RelayControlPoint RelayEnabled RelayState RemainingDuration RemoteKey ResetFilterIndication RotationDirection RotationSpeed RouterStatus Saturation SecuritySystemAlarmType SecuritySystemCurrentState SecuritySystemTargetState SelectedAudioStreamConfiguration SelectedCameraRecordingConfiguration SelectedDiagnosticsModes SelectedRTPStreamConfiguration SelectedSleepConfiguration SerialNumber ServiceLabelIndex ServiceLabelNamespace SetDuration SetupDataStreamTransport SetupEndpoints SetupTransferTransport SignalToNoiseRatio SiriEnable SiriEndpointSessionStatus SiriEngineVersion SiriInputType SiriLightOnUse SiriListening SiriTouchToUse SlatType SleepDiscoveryMode SleepInterval SmokeDetected SoftwareRevision StagedFirmwareVersion StatusActive StatusFault StatusJammed StatusLowBattery StatusTampered StreamingStatus 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 Token TransmitPower TunnelConnectionTimeout TunneledAccessoryAdvertising TunneledAccessoryConnected TunneledAccessoryStateNumber ValveType Version VideoAnalysisActive VOCDensity Volume VolumeControlType VolumeSelector WakeConfiguration WANConfigurationList WANStatusList WaterLevel WiFiCapabilities WiFiConfigurationControl WiFiSatelliteStatus

Constructors

Properties

displayName: string
iid: Nullable<number> = null
UUID: string

Methods

  • 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.

    Parameters

    Returns Characteristic

    Characteristic.onGet(async () => {
    return true;
    });
  • 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.

    Parameters

    Returns void

  • 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):

    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.

    Returns Iterable<number, any, any>

    // 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 manipulation
    const validValues = Array.from(characteristic.validValuesIterator());

Characteristic Definitions

AccessCodeControlPoint: typeof AccessCodeControlPoint
AccessCodeSupportedConfiguration: typeof AccessCodeSupportedConfiguration
AccessControlLevel: typeof AccessControlLevel
AccessoryFlags: typeof AccessoryFlags
AccessoryIdentifier: typeof AccessoryIdentifier
Active: typeof Active
ActiveIdentifier: typeof ActiveIdentifier
ActivityInterval: typeof ActivityInterval
AdministratorOnlyAccess: typeof AdministratorOnlyAccess
AirParticulateDensity: typeof AirParticulateDensity
AirParticulateSize: typeof AirParticulateSize
AirPlayEnable: typeof AirPlayEnable
AirQuality: typeof AirQuality
AppMatchingIdentifier: typeof AppMatchingIdentifier
AssetUpdateReadiness: typeof AssetUpdateReadiness
AudioFeedback: typeof AudioFeedback
BatteryLevel: typeof BatteryLevel
Brightness: typeof Brightness
ButtonEvent: typeof ButtonEvent
CameraOperatingModeIndicator: typeof CameraOperatingModeIndicator
CarbonDioxideDetected: typeof CarbonDioxideDetected
CarbonDioxideLevel: typeof CarbonDioxideLevel
CarbonDioxidePeakLevel: typeof CarbonDioxidePeakLevel
CarbonMonoxideDetected: typeof CarbonMonoxideDetected
CarbonMonoxideLevel: typeof CarbonMonoxideLevel
CarbonMonoxidePeakLevel: typeof CarbonMonoxidePeakLevel
CCAEnergyDetectThreshold: typeof CCAEnergyDetectThreshold
CCASignalDetectThreshold: typeof CCASignalDetectThreshold
CharacteristicValueActiveTransitionCount: typeof CharacteristicValueActiveTransitionCount
CharacteristicValueTransitionControl: typeof CharacteristicValueTransitionControl
ChargingState: typeof ChargingState
ClosedCaptions: typeof ClosedCaptions
ColorTemperature: typeof ColorTemperature
ConfigurationState: typeof ConfigurationState
ConfiguredName: typeof ConfiguredName
ContactSensorState: typeof ContactSensorState
CoolingThresholdTemperature: typeof CoolingThresholdTemperature
CryptoHash: typeof CryptoHash
CurrentAirPurifierState: typeof CurrentAirPurifierState
CurrentAmbientLightLevel: typeof CurrentAmbientLightLevel
CurrentDoorState: typeof CurrentDoorState
CurrentFanState: typeof CurrentFanState
CurrentHeaterCoolerState: typeof CurrentHeaterCoolerState
CurrentHeatingCoolingState: typeof CurrentHeatingCoolingState
CurrentHorizontalTiltAngle: typeof CurrentHorizontalTiltAngle
CurrentHumidifierDehumidifierState: typeof CurrentHumidifierDehumidifierState
CurrentMediaState: typeof CurrentMediaState
CurrentPosition: typeof CurrentPosition
CurrentRelativeHumidity: typeof CurrentRelativeHumidity
CurrentSlatState: typeof CurrentSlatState
CurrentTemperature: typeof CurrentTemperature
CurrentTiltAngle: typeof CurrentTiltAngle
CurrentTransport: typeof CurrentTransport
CurrentVerticalTiltAngle: typeof CurrentVerticalTiltAngle
CurrentVisibilityState: typeof CurrentVisibilityState
DataStreamHAPTransport: typeof DataStreamHAPTransport
DataStreamHAPTransportInterrupt: typeof DataStreamHAPTransportInterrupt
DiagonalFieldOfView: typeof DiagonalFieldOfView
DigitalZoom: typeof DigitalZoom
DisplayOrder: typeof DisplayOrder
EventRetransmissionMaximum: typeof EventRetransmissionMaximum
EventSnapshotsActive: typeof EventSnapshotsActive
EventTransmissionCounters: typeof EventTransmissionCounters
FilterChangeIndication: typeof FilterChangeIndication
FilterLifeLevel: typeof FilterLifeLevel
FirmwareRevision: typeof FirmwareRevision
FirmwareUpdateReadiness: typeof FirmwareUpdateReadiness
FirmwareUpdateStatus: typeof FirmwareUpdateStatus
HardwareFinish: typeof HardwareFinish
HardwareRevision: typeof HardwareRevision
HeartBeat: typeof HeartBeat
HeatingThresholdTemperature: typeof HeatingThresholdTemperature
HoldPosition: typeof HoldPosition
HomeKitCameraActive: typeof HomeKitCameraActive
Hue: typeof Hue
Identifier: typeof Identifier
Identify: typeof Identify
ImageMirroring: typeof ImageMirroring
ImageRotation: typeof ImageRotation
InputDeviceType: typeof InputDeviceType
InputSourceType: typeof InputSourceType
InUse: typeof InUse
IsConfigured: typeof IsConfigured
LeakDetected: typeof LeakDetected
ListPairings: typeof ListPairings
LockControlPoint: typeof LockControlPoint
LockCurrentState: typeof LockCurrentState
LockLastKnownAction: typeof LockLastKnownAction
LockManagementAutoSecurityTimeout: typeof LockManagementAutoSecurityTimeout
LockPhysicalControls: typeof LockPhysicalControls
LockTargetState: typeof LockTargetState
Logs: typeof Logs
MACRetransmissionMaximum: typeof MACRetransmissionMaximum
MACTransmissionCounters: typeof MACTransmissionCounters
ManagedNetworkEnable: typeof ManagedNetworkEnable
ManuallyDisabled: typeof ManuallyDisabled
Manufacturer: typeof Manufacturer
MaximumTransmitPower: typeof MaximumTransmitPower
MetricsBufferFullState: typeof MetricsBufferFullState
Model: typeof Model
MotionDetected: typeof MotionDetected
MultifunctionButton: typeof MultifunctionButton
Mute: typeof Mute
Name: typeof Name
NetworkAccessViolationControl: typeof NetworkAccessViolationControl
NetworkClientProfileControl: typeof NetworkClientProfileControl
NetworkClientStatusControl: typeof NetworkClientStatusControl
NFCAccessControlPoint: typeof NFCAccessControlPoint
NFCAccessSupportedConfiguration: typeof NFCAccessSupportedConfiguration
NightVision: typeof NightVision
NitrogenDioxideDensity: typeof NitrogenDioxideDensity
ObstructionDetected: typeof ObstructionDetected
OccupancyDetected: typeof OccupancyDetected
On: typeof On
OperatingStateResponse: typeof OperatingStateResponse
OpticalZoom: typeof OpticalZoom
OutletInUse: typeof OutletInUse
OzoneDensity: typeof OzoneDensity
PairingFeatures: typeof PairingFeatures
PairSetup: typeof PairSetup
PairVerify: typeof PairVerify
PasswordSetting: typeof PasswordSetting
PeriodicSnapshotsActive: typeof PeriodicSnapshotsActive
PictureMode: typeof PictureMode
Ping: typeof Ping
PM10Density: typeof PM10Density
PM2_5Density: typeof PM2_5Density
PositionState: typeof PositionState
PowerModeSelection: typeof PowerModeSelection
ProductData: typeof ProductData
ProgrammableSwitchEvent: typeof ProgrammableSwitchEvent
ProgrammableSwitchOutputState: typeof ProgrammableSwitchOutputState
ProgramMode: typeof ProgramMode
ReceivedSignalStrengthIndication: typeof ReceivedSignalStrengthIndication
ReceiverSensitivity: typeof ReceiverSensitivity
RecordingAudioActive: typeof RecordingAudioActive
RelativeHumidityDehumidifierThreshold: typeof RelativeHumidityDehumidifierThreshold
RelativeHumidityHumidifierThreshold: typeof RelativeHumidityHumidifierThreshold
RelayControlPoint: typeof RelayControlPoint
RelayEnabled: typeof RelayEnabled
RelayState: typeof RelayState
RemainingDuration: typeof RemainingDuration
RemoteKey: typeof RemoteKey
ResetFilterIndication: typeof ResetFilterIndication
RotationDirection: typeof RotationDirection
RotationSpeed: typeof RotationSpeed
RouterStatus: typeof RouterStatus
Saturation: typeof Saturation
SecuritySystemAlarmType: typeof SecuritySystemAlarmType
SecuritySystemCurrentState: typeof SecuritySystemCurrentState
SecuritySystemTargetState: typeof SecuritySystemTargetState
SelectedAudioStreamConfiguration: typeof SelectedAudioStreamConfiguration
SelectedCameraRecordingConfiguration: typeof SelectedCameraRecordingConfiguration
SelectedDiagnosticsModes: typeof SelectedDiagnosticsModes
SelectedRTPStreamConfiguration: typeof SelectedRTPStreamConfiguration
SelectedSleepConfiguration: typeof SelectedSleepConfiguration
SerialNumber: typeof SerialNumber
ServiceLabelIndex: typeof ServiceLabelIndex
ServiceLabelNamespace: typeof ServiceLabelNamespace
SetDuration: typeof SetDuration
SetupDataStreamTransport: typeof SetupDataStreamTransport
SetupEndpoints: typeof SetupEndpoints
SetupTransferTransport: typeof SetupTransferTransport
SignalToNoiseRatio: typeof SignalToNoiseRatio
SiriEnable: typeof SiriEnable
SiriEndpointSessionStatus: typeof SiriEndpointSessionStatus
SiriEngineVersion: typeof SiriEngineVersion
SiriInputType: typeof SiriInputType
SiriLightOnUse: typeof SiriLightOnUse
SiriListening: typeof SiriListening
SiriTouchToUse: typeof SiriTouchToUse
SlatType: typeof SlatType
SleepDiscoveryMode: typeof SleepDiscoveryMode
SleepInterval: typeof SleepInterval
SmokeDetected: typeof SmokeDetected
SoftwareRevision: typeof SoftwareRevision
StagedFirmwareVersion: typeof StagedFirmwareVersion
StatusActive: typeof StatusActive
StatusFault: typeof StatusFault
StatusJammed: typeof StatusJammed
StatusLowBattery: typeof StatusLowBattery
StatusTampered: typeof StatusTampered
StreamingStatus: typeof StreamingStatus
SulphurDioxideDensity: typeof SulphurDioxideDensity
SupportedAssetTypes: typeof SupportedAssetTypes
SupportedAudioRecordingConfiguration: typeof SupportedAudioRecordingConfiguration
SupportedAudioStreamConfiguration: typeof SupportedAudioStreamConfiguration
SupportedCameraRecordingConfiguration: typeof SupportedCameraRecordingConfiguration
SupportedCharacteristicValueTransitionConfiguration: typeof SupportedCharacteristicValueTransitionConfiguration
SupportedDataStreamTransportConfiguration: typeof SupportedDataStreamTransportConfiguration
SupportedDiagnosticsModes: typeof SupportedDiagnosticsModes
SupportedDiagnosticsSnapshot: typeof SupportedDiagnosticsSnapshot
SupportedFirmwareUpdateConfiguration: typeof SupportedFirmwareUpdateConfiguration
SupportedMetrics: typeof SupportedMetrics
SupportedRouterConfiguration: typeof SupportedRouterConfiguration
SupportedRTPConfiguration: typeof SupportedRTPConfiguration
SupportedSleepConfiguration: typeof SupportedSleepConfiguration
SupportedTransferTransportConfiguration: typeof SupportedTransferTransportConfiguration
SupportedVideoRecordingConfiguration: typeof SupportedVideoRecordingConfiguration
SupportedVideoStreamConfiguration: typeof SupportedVideoStreamConfiguration
SwingMode: typeof SwingMode
TapType: typeof TapType
TargetAirPurifierState: typeof TargetAirPurifierState
TargetControlList: typeof TargetControlList
TargetControlSupportedConfiguration: typeof TargetControlSupportedConfiguration
TargetDoorState: typeof TargetDoorState
TargetFanState: typeof TargetFanState
TargetHeaterCoolerState: typeof TargetHeaterCoolerState
TargetHeatingCoolingState: typeof TargetHeatingCoolingState
TargetHorizontalTiltAngle: typeof TargetHorizontalTiltAngle
TargetHumidifierDehumidifierState: typeof TargetHumidifierDehumidifierState
TargetMediaState: typeof TargetMediaState
TargetPosition: typeof TargetPosition
TargetRelativeHumidity: typeof TargetRelativeHumidity
TargetTemperature: typeof TargetTemperature
TargetTiltAngle: typeof TargetTiltAngle
TargetVerticalTiltAngle: typeof TargetVerticalTiltAngle
TargetVisibilityState: typeof TargetVisibilityState
TemperatureDisplayUnits: typeof TemperatureDisplayUnits
ThirdPartyCameraActive: typeof ThirdPartyCameraActive
ThreadControlPoint: typeof ThreadControlPoint
ThreadNodeCapabilities: typeof ThreadNodeCapabilities
ThreadOpenThreadVersion: typeof ThreadOpenThreadVersion
ThreadStatus: typeof ThreadStatus
Token: typeof Token
TransmitPower: typeof TransmitPower
TunnelConnectionTimeout: typeof TunnelConnectionTimeout
TunneledAccessoryAdvertising: typeof TunneledAccessoryAdvertising
TunneledAccessoryConnected: typeof TunneledAccessoryConnected
TunneledAccessoryStateNumber: typeof TunneledAccessoryStateNumber
ValveType: typeof ValveType
Version: typeof Version
VideoAnalysisActive: typeof VideoAnalysisActive
VOCDensity: typeof VOCDensity
Volume: typeof Volume
VolumeControlType: typeof VolumeControlType
VolumeSelector: typeof VolumeSelector
WakeConfiguration: typeof WakeConfiguration
WANConfigurationList: typeof WANConfigurationList
WANStatusList: typeof WANStatusList
WaterLevel: typeof WaterLevel
WiFiCapabilities: typeof WiFiCapabilities
WiFiConfigurationControl: typeof WiFiConfigurationControl
WiFiSatelliteStatus: typeof WiFiSatelliteStatus