UNPKG

homebridge-bondbridge

Version:

Plugin to integrate BondBridge units by Bond to Homekit

1,099 lines (1,074 loc) 275 kB
'use strict'; // The sObject.defineProperty is to resolve a lint issue. // See utils/Bb2indexOfEnumLintTest.js for further information. let Bb2indexOfEnum = require( "../utils/Bb2indexOfEnum" ); Object.defineProperty( exports, "Bb2indexOfEnum", { enumerable: true, get: function ( ){ return Bb2indexOfEnum.Bb2indexOfEnum; } }); function stringToBool( str ) { str += ''; str = str.toUpperCase( ); if ( str == "0" || str == "FALSE" ) return false; if ( str == "1" || str == "TRUE" ) return true; return undefined; } function stringToFloat( str ) { if ( !isNaN( str ) ) { let rc = parseFloat( str ); if ( ! isNaN( rc ) ) return rc; } return undefined; } function stringToInt( str ) { str += ''; // Convert it to a Number, no matter what let result = Number( str ); if ( typeof result == "number" ) return result; return undefined; } function stringToString( str ) { if ( typeof str == "string" ) return str; // more or less to pass previous testcases if ( typeof str == "number" ) return str += ''; return undefined; } function stringPassThru( str ) { return str; } function stringToTLV8( str ) { return str; } class CustomCharacteristic { constructor( api, type, UUID, props ) { this.characteristic = { }; this.api = api; var _a; this.characteristic[ type ] = (_a = class extends this.api.hap.Characteristic { constructor() { super(type, UUID, props); this.value = this.getDefaultValue(); } }, _a.UUID = UUID, _a); } } // NOTE - DO NOT CHANGE TO LOWER CASE // - This would mean ALL testcases would have to be changed as well. //:76,375s/^ \([A-Z]\)/ \l\1/ var BB2_ACC_TYPE_ENUM = { AccessControlLevel: 0, AccessoryFlags: 1, AccessoryIdentifier: 2, Active: 3, ActiveIdentifier: 4, ActivityInterval: 5, AdministratorOnlyAccess: 6, AirParticulateDensity: 7, AirParticulateSize: 8, AirQuality: 9, AppMatchingIdentifier: 10, AudioFeedback: 11, BatteryLevel: 12, Brightness: 13, ButtonEvent: 14, CCAEnergyDetectThreshold: 15, CCASignalDetectThreshold: 16, CameraOperatingModeIndicator: 17, CarbonDioxideDetected: 18, CarbonDioxideLevel: 19, CarbonDioxidePeakLevel: 20, CarbonMonoxideDetected: 21, CarbonMonoxideLevel: 22, CarbonMonoxidePeakLevel: 23, Category: 24, CharacteristicValueTransitionControl: 25, ChargingState: 26, ClosedCaptions: 27, ColorTemperature: 28, ConfigureBridgedAccessory: 29, ConfigureBridgedAccessoryStatus: 30, ConfiguredName: 31, ContactSensorState: 32, CoolingThresholdTemperature: 33, CurrentAirPurifierState: 34, CurrentAmbientLightLevel: 35, CurrentDoorState: 36, CurrentFanState: 37, CurrentHeaterCoolerState: 38, CurrentHeatingCoolingState: 39, CurrentHorizontalTiltAngle: 40, CurrentHumidifierDehumidifierState: 41, CurrentMediaState: 42, CurrentPosition: 43, CurrentRelativeHumidity: 44, CurrentSlatState: 45, CurrentTemperature: 46, CurrentTiltAngle: 47, CurrentTime: 48, CurrentTransport: 49, CurrentVerticalTiltAngle: 50, CurrentVisibilityState: 51, DataStreamHAPTransport: 52, DataStreamHAPTransportInterrupt: 53, DayoftheWeek: 54, DiagonalFieldOfView: 55, DigitalZoom: 56, DiscoverBridgedAccessories: 57, DiscoveredBridgedAccessories: 58, DisplayOrder: 59, EventRetransmissionMaximum: 60, EventSnapshotsActive: 61, EventTransmissionCounters: 62, FilterChangeIndication: 63, FilterLifeLevel: 64, FirmwareRevision: 65, HardwareRevision: 66, HeartBeat: 67, HeatingThresholdTemperature: 68, HoldPosition: 69, HomeKitCameraActive: 70, Hue: 71, Identifier: 72, Identify: 73, ImageMirroring: 74, ImageRotation: 75, InUse: 76, InputDeviceType: 77, InputSourceType: 78, IsConfigured: 79, LeakDetected: 80, LinkQuality: 81, ListPairings: 82, LockControlPoint: 83, LockCurrentState: 84, LockLastKnownAction: 85, LockManagementAutoSecurityTimeout: 86, LockPhysicalControls: 87, LockTargetState: 88, Logs: 89, MACRetransmissionMaximum: 90, MACTransmissionCounters: 91, ManagedNetworkEnable: 92, ManuallyDisabled: 93, Manufacturer: 94, Model: 95, MotionDetected: 96, Mute: 97, Name: 98, NetworkAccessViolationControl: 99, NetworkClientProfileControl: 100, NetworkClientStatusControl: 101, NightVision: 102, NitrogenDioxideDensity: 103, ObstructionDetected: 104, OccupancyDetected: 105, On: 106, OperatingStateResponse: 107, OpticalZoom: 108, OutletInUse: 109, OzoneDensity: 110, PM10Density: 111, PM2_5Density: 112, PairSetup: 113, PairVerify: 114, PairingFeatures: 115, PairingPairings: 116, PasswordSetting: 117, PeriodicSnapshotsActive: 118, PictureMode: 119, Ping: 120, PositionState: 121, PowerModeSelection: 122, ProductData: 123, ProgramMode: 124, ProgrammableSwitchEvent: 125, ProgrammableSwitchOutputState: 126, Reachable: 127, ReceivedSignalStrengthIndication: 128, ReceiverSensitivity: 129, RecordingAudioActive: 130, RelativeHumidityDehumidifierThreshold: 131, RelativeHumidityHumidifierThreshold: 132, RelayControlPoint: 133, RelayEnabled: 134, RelayState: 135, RemainingDuration: 136, RemoteKey: 137, ResetFilterIndication: 138, RotationDirection: 139, RotationSpeed: 140, RouterStatus: 141, Saturation: 142, SecuritySystemAlarmType: 143, SecuritySystemCurrentState: 144, SecuritySystemTargetState: 145, SelectedAudioStreamConfiguration: 146, SelectedCameraRecordingConfiguration: 147, SelectedRTPStreamConfiguration: 148, SerialNumber: 149, ServiceLabelIndex: 150, ServiceLabelNamespace: 151, SetDuration: 152, SetupDataStreamTransport: 153, SetupEndpoints: 154, SetupTransferTransport: 155, SignalToNoiseRatio: 156, SiriInputType: 157, SlatType: 158, SleepDiscoveryMode: 159, SleepInterval: 160, SmokeDetected: 161, SoftwareRevision: 162, StatusActive: 163, StatusFault: 164, StatusJammed: 165, StatusLowBattery: 166, StatusTampered: 167, StreamingStatus: 168, SulphurDioxideDensity: 169, SupportedAudioRecordingConfiguration: 170, SupportedAudioStreamConfiguration: 171, SupportedCameraRecordingConfiguration: 172, SupportedCharacteristicValueTransitionConfiguration: 173, SupportedDataStreamTransportConfiguration: 174, SupportedDiagnosticsSnapshot: 175, SupportedRTPConfiguration: 176, SupportedRouterConfiguration: 177, SupportedTransferTransportConfiguration: 178, SupportedVideoRecordingConfiguration: 179, SupportedVideoStreamConfiguration: 180, SwingMode: 181, TargetAirPurifierState: 182, TargetAirQuality: 183, TargetControlList: 184, TargetControlSupportedConfiguration: 185, TargetDoorState: 186, TargetFanState: 187, TargetHeaterCoolerState: 188, TargetHeatingCoolingState: 189, TargetHorizontalTiltAngle: 190, TargetHumidifierDehumidifierState: 191, TargetMediaState: 192, TargetPosition: 193, TargetRelativeHumidity: 194, TargetSlatState: 195, TargetTemperature: 196, TargetTiltAngle: 197, TargetVerticalTiltAngle: 198, TargetVisibilityState: 199, TemperatureDisplayUnits: 200, ThirdPartyCameraActive: 201, TimeUpdate: 202, TransmitPower: 203, MaximumTransmitPower: 204, TunnelConnectionTimeout: 205, TunneledAccessoryAdvertising: 206, TunneledAccessoryConnected: 207, TunneledAccessoryStateNumber: 208, VOCDensity: 209, ValveType: 210, Version: 211, VideoAnalysisActive: 212, Volume: 213, VolumeControlType: 214, VolumeSelector: 215, WANConfigurationList: 216, WANStatusList: 217, WakeConfiguration: 218, WaterLevel: 219, WiFiCapabilities: 220, WiFiConfigurationControl: 221, WiFiSatelliteStatus: 222, AssetUpdateReadiness: 223, SupportedAssetTypes: 224, ConfigurationState: 225, NFCAccessControlPoint: 226, NFCAccessSupportedConfiguration: 227, SiriEndpointSessionStatus: 228, ThreadControlPoint: 229, ThreadNodeCapabilities: 230, ThreadStatus: 231, ThreadOpenThreadVersion: 232, // Added Mar 2024 AccessCodeControlPoint: 233, AccessCodeSupportedConfiguration: 234, AirPlayEnable: 235, CharacteristicValueActiveTransitionCount: 236, CryptoHash: 237, FirmwareUpdateReadiness: 238, FirmwareUpdateStatus: 239, HardwareFinish: 240, MetricsBufferFullState: 241, MultifunctionButton: 242, SelectedDiagnosticsModes: 243, SelectedSleepConfiguration: 244, SiriEnable: 245, SiriEngineVersion: 246, SiriLightOnUse: 247, SiriListening: 248, SiriTouchToUse: 249, StagedFirmwareVersion: 250, SupportedMetrics: 251, SupportedFirmwareUpdateConfiguration: 252, TapType: 253, Token: 254, EOL: 255, properties: { }, accEnumIndexToUC: function( index ) { return BB2_ACC_TYPE_ENUM.properties[ index ].type; }, accEnumIndexToLC: function( index ) { return BB2_ACC_TYPE_ENUM.properties[ index ].sche; }, Bb2indexOfEnum: function( characteristicString ) { let accTypeEnumIndex = -1; accTypeEnumIndex = BB2_ACC_TYPE_ENUM.properties.Bb2indexOfEnum( i => i.type === characteristicString ); if ( accTypeEnumIndex >= 0 ) return accTypeEnumIndex; return BB2_ACC_TYPE_ENUM.properties.Bb2indexOfEnum( i => i.sche === characteristicString ); }, add: function( api, type, description, props, validValues ) { let UUID = api.hap.uuid.generate( type ); let characteristic = new CustomCharacteristic( api, type, UUID, props ); let hapFormats = api.hap.Formats; let stringConversionFunction; switch ( props.format ) { case hapFormats.BOOL: stringConversionFunction = function ( str ){ return stringToBool( str ); }; props.allowedWordCount = 1; break; case hapFormats.INT: case hapFormats.UINT8: case hapFormats.UINT16: case hapFormats.UINT32: case hapFormats.UINT64: stringConversionFunction = function ( str ){ return stringToInt( str ); }; props.allowedWordCount = 1; break; case hapFormats.FLOAT: stringConversionFunction = function ( str ){ return stringToFloat( str ); }; props.allowedWordCount = 1; break; case hapFormats.STRING: stringConversionFunction = function ( str ){ return stringToString( str ); }; props.allowedWordCount = 0; break; case hapFormats.DATA: stringConversionFunction = function ( str ){ return stringPassThru( str ); }; props.allowedWordCount = 0; break; case hapFormats.TLV8: stringConversionFunction = function ( str ){ return stringToTLV8( str ); }; props.allowedWordCount = 0; break; case hapFormats.DICT: stringConversionFunction = function ( str ){ return stringPassThru( str ); }; props.allowedWordCount = 0; break; } BB2_ACC_TYPE_ENUM.properties[ BB2_ACC_TYPE_ENUM.EOL ] = { "type": type, "characteristic": characteristic.characteristic[ type ], "UUID": UUID, "description": description, "relatedCurrentAccTypeEnumIndex": null, "relatedTargetAccTypeEnumIndex": null, "stringConversionFunction": stringConversionFunction, "props": props, "validValues": validValues }; BB2_ACC_TYPE_ENUM[ type ] = BB2_ACC_TYPE_ENUM.EOL; BB2_ACC_TYPE_ENUM.EOL ++; // The returned characteristic is not good for anything but unit testing. // The one used for services is the above: characteristic.characteristic[ type ] return characteristic; }, }; // Export both the init function and the uninitialized data for unit testing module.exports = { init: function (Characteristic, hapFormats, hapUnits, hapPerms) { // Fill in the properties of all possible characteristics // props was added because calling getCharacteridtic().props.perms adds // the characteristic in by default. This costs some lines, but is advantageous. // NOTE - DO NOT CHANGE TYPE TO LOWER CASE. // - HOW Would you handle MACTransmission, UUID, ... // If checking char.At(0).toUpperCase ? // :g/type: "\([A-Z]\)/s//type: "\l\1/g // :g/sche: "\([A-Z]\)/s//sche: "\l\1/g // :g/type: "\([a-z]\)/s//type: "\u\1/g BB2_ACC_TYPE_ENUM.properties = { 0: { type: "AccessControlLevel", sche: "accessControlLevel", characteristic: Characteristic.AccessControlLevel, deprecated: false, UUID: "000000E5-0000-1000-8000-0026BB765291", description: "The Devices Access Control Level", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToInt( str ); }, props: {format: hapFormats.UINT16, allowedWordCount: 1, maxValue: 2, minValue: 0, minStep: 1, perms: [hapPerms.NOTIFY, hapPerms.PAIRED_READ, hapPerms.PAIRED_WRITE ] }, validValues: {} }, 1: { type: "AccessoryFlags", sche: "accessoryFlags", characteristic: Characteristic.AccessoryFlags, deprecated: false, UUID: "000000A6-0000-1000-8000-0026BB765291", description: "The Devices Accessory Flags", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToInt( str ); }, props: {format: hapFormats.UINT32, allowedWordCount: 1, perms: [hapPerms.PAIRED_READ, hapPerms.NOTIFY ] }, validValues: {} }, 2: { type: "AccessoryIdentifier", // HomeKitTypes-Bridge sche: "accessoryIdentifier", // HomeKitTypes-Bridge characteristic: Characteristic.AccessoryIdentifier, deprecated: false, UUID: "00000057-0000-1000-8000-0026BB765291", description: "The Devices Accessory Identifier String", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToString( str ); }, props: {format: hapFormats.STRING, allowedWordCount: 0, perms: [hapPerms.PAIRED_READ ] }, validValues: {} }, 3: { type: "Active", sche: "active", characteristic: Characteristic.Active, deprecated: false, UUID: "000000B0-0000-1000-8000-0026BB765291", description: "If the Device is ACTIVE/INACTIVE", relatedCurrentAccTypeEnumIndex: BB2_ACC_TYPE_ENUM.Active, relatedTargetAccTypeEnumIndex: BB2_ACC_TYPE_ENUM.Active, stringConversionFunction: function ( str ){ return stringToInt( str ); }, props: {format: hapFormats.UINT8, allowedWordCount: 1, maxValue: 1, minValue: 0, minStep: 1, perms: [hapPerms.PAIRED_READ, hapPerms.PAIRED_WRITE, hapPerms.NOTIFY ] }, validValues: // Checked 04/24/2020 {"INACTIVE": Characteristic.Active.INACTIVE, "ACTIVE": Characteristic.Active.ACTIVE } }, 4: { type: "ActiveIdentifier", // HomeKitTypes-Television sche: "activeIdentifier", // HomeKitTypes-Television characteristic: Characteristic.ActiveIdentifier, deprecated: false, UUID: "000000E7-0000-1000-8000-0026BB765291", description: "The Devices Active Identifier", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToInt( str ); }, props: {format: hapFormats.UINT32, allowedWordCount: 1, perms: [hapPerms.PAIRED_READ, hapPerms.PAIRED_WRITE, hapPerms.NOTIFY ] }, validValues: {} }, 5: { type: "ActivityInterval", // HomeKit - Checke3d 11-19-2020 sche: "activityInterval", // HomeKit - Checke3d 11-19-2020 characteristic: Characteristic.ActivityInterval, deprecated: false, UUID: "0000023B-0000-1000-8000-0026BB765291", description: "The Devices Activity Interval", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToInt( str ); }, props: {format: hapFormats.UINT32, allowedWordCount: 1, minValue: 0, minStep: 1, perms: [hapPerms.PAIRED_READ, hapPerms.NOTIFY ] }, validValues: {} }, 6: { type: "AdministratorOnlyAccess", sche: "administratorOnlyAccess", characteristic: Characteristic.AdministratorOnlyAccess, deprecated: false, UUID: "00000001-0000-1000-8000-0026BB765291", description: "If the Device has 2cwAdmin Only Access", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToBool( str ); }, props: {format: hapFormats.BOOL, allowedWordCount: 1, perms: [hapPerms.PAIRED_READ, hapPerms.PAIRED_WRITE, hapPerms.NOTIFY ] }, validValues: {"FALSE": 0, "TRUE": 1 } }, 7: { type: "AirParticulateDensity", sche: "airParticulateDensity", characteristic: Characteristic.AirParticulateDensity, deprecated: false, UUID: "00000064-0000-1000-8000-0026BB765291", description: "The Measured Air Particulate Density", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToFloat( str ); }, props: {format: hapFormats.FLOAT, allowedWordCount: 1, maxValue: 1000, minValue: 0, perms: [hapPerms.PAIRED_READ, hapPerms.NOTIFY ] }, validValues: {} }, 8: { type: "AirParticulateSize", sche: "airParticulateSize", characteristic: Characteristic.AirParticulateSize, deprecated: false, UUID: "00000065-0000-1000-8000-0026BB765291", description: "The Measured Air Particulate Size", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToInt( str ); }, props: {format: hapFormats.UINT8, allowedWordCount: 1, maxValue: 1, minValue: 0, minStep: 1, perms: [hapPerms.PAIRED_READ, hapPerms.NOTIFY ] }, validValues: // Checked 04/24/2020 {"_2_5_M": Characteristic.AirParticulateSize._2_5_M, "_10_M": Characteristic.AirParticulateSize._10_M } }, 9: { type: "AirQuality", sche: "airQuality", characteristic: Characteristic.AirQuality, deprecated: false, UUID: "00000095-0000-1000-8000-0026BB765291", description: "The Current Air Quality", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, // @deprecated Removed and not used anymore as of homebridge v2 // BB2_ACC_TYPE_ENUM.TargetAirQuality, stringConversionFunction: function ( str ){ return stringToInt( str ); }, props: {format: hapFormats.UINT8, allowedWordCount: 1, maxValue: 5, minValue: 0, minStep: 1, perms: [hapPerms.PAIRED_READ, hapPerms.NOTIFY ] }, validValues: // Checked 04/24/2020 {"UNKNOWN": Characteristic.AirQuality.UNKNOWN, "EXCELLENT": Characteristic.AirQuality.EXCELLENT, "GOOD": Characteristic.AirQuality.GOOD, "FAIR": Characteristic.AirQuality.FAIR, "INFERIOR": Characteristic.AirQuality.INFERIOR, "POOR": Characteristic.AirQuality.POOR } }, 10: { type: "AppMatchingIdentifier", sche: "appMatchingIdentifier", characteristic: Characteristic.AppMatchingIdentifier, deprecated: false, UUID: "000000A4-0000-1000-8000-0026BB765291", description: "The Devices App Matching Identifier", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, /* eslint no-unused-vars: ["error", {"args": "none"}] */ stringConversionFunction: function ( str ){ return stringToTLV8( str ); }, props: {format: hapFormats.TLV8, allowedWordCount: 0, perms: [hapPerms.PAIRED_READ ] }, validValues: // Checked 11/20/2020 {} }, 11: { type: "AudioFeedback", sche: "audioFeedback", characteristic: Characteristic.AudioFeedback, deprecated: false, UUID: "00000005-0000-1000-8000-0026BB765291", description: "If Audio Feedback is Present", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToBool( str ); }, props: {format: hapFormats.BOOL, allowedWordCount: 1, perms: [hapPerms.PAIRED_READ, hapPerms.PAIRED_WRITE, hapPerms.NOTIFY ] }, validValues: {"FALSE": 0, "TRUE": 1 } }, 12: { type: "BatteryLevel", sche: "batteryLevel", characteristic: Characteristic.BatteryLevel, deprecated: false, UUID: "00000068-0000-1000-8000-0026BB765291", description: "The Measured Battery Level", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToInt( str ); }, props: {format: hapFormats.UINT8, allowedWordCount: 1, unit: hapUnits.PERCENTAGE, maxValue: 100, minValue: 0, minStep: 1, perms: [hapPerms.PAIRED_READ, hapPerms.NOTIFY ] }, validValues: {} }, 13: { type: "Brightness", sche: "brightness", characteristic: Characteristic.Brightness, deprecated: false, UUID: "00000008-0000-1000-8000-0026BB765291", description: "The Percentage of Existing Brightness", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToInt( str ); }, props: {format: hapFormats.INT, allowedWordCount: 1, unit: hapUnits.PERCENTAGE, maxValue: 100, minValue: 0, minStep: 1, perms: [hapPerms.PAIRED_READ, hapPerms.PAIRED_WRITE, hapPerms.NOTIFY ] }, validValues: {} }, 14: { type: "ButtonEvent", sche: "buttonEvent", characteristic: Characteristic.ButtonEvent, deprecated: false, UUID: "00000126-0000-1000-8000-0026BB765291", description: "The Devices zbutton Event", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToTLV8( str ); }, props: {format: hapFormats.TLV8, allowedWordCount: 0, perms: [hapPerms.PAIRED_READ, hapPerms.NOTIFY ] }, validValues: {} }, 15: { type: "CCAEnergyDetectThreshold", sche: "ccaEnergyDetectThreshold", characteristic: Characteristic.CCAEnergyDetectThreshold, deprecated: false, UUID: "00000246-0000-1000-8000-0026BB765291", description: "The Devices CCA Energy Detect Threshold", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToInt( str ); }, props: {format: hapFormats.INT, allowedWordCount: 1, perms: [hapPerms.PAIRED_READ ] }, validValues: {} }, 16: { type: "CCASignalDetectThreshold", sche: "ccaSignalDetectThreshold", characteristic: Characteristic.CCASignalDetectThreshold, deprecated: false, UUID: "00000245-0000-1000-8000-0026BB765291", description: "The Devices Signal Detect Threshold", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToInt( str ); }, props: {format: hapFormats.INT, allowedWordCount: 1, perms: [hapPerms.PAIRED_READ ] }, validValues: {} }, 17: { type: "CameraOperatingModeIndicator", sche: "cameraOperatingModeIndicator", characteristic: Characteristic.CameraOperatingModeIndicator, deprecated: false, UUID: "0000021D-0000-1000-8000-0026BB765291", description: "The State of the Camera's Operating Mode Indicator", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToBool( str ); }, props: {format: hapFormats.BOOL, allowedWordCount: 1, perms: [hapPerms.PAIRED_READ, hapPerms.PAIRED_WRITE, hapPerms.NOTIFY, hapPerms.TIMED_WRITE ] }, validValues: { "DISABLE": 0, "ENABLE": 1 } }, 18: { type: "CarbonDioxideDetected", sche: "carbonDioxideDetected", characteristic: Characteristic.CarbonDioxideDetected, deprecated: false, UUID: "00000092-0000-1000-8000-0026BB765291", description: "If Carbon Dioxide has been Detected", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToInt( str ); }, props: {format: hapFormats.UINT8, allowedWordCount: 1, maxValue: 1, minValue: 0, minStep: 1, perms: [hapPerms.PAIRED_READ, hapPerms.NOTIFY ] }, validValues: {"CO2_LEVELS_NORMAL": Characteristic.CarbonDioxideDetected.CO2_LEVELS_NORMAL, "CO2_LEVELS_ABNORMAL": Characteristic.CarbonDioxideDetected.CO2_LEVELS_ABNORMAL } }, 19: { type: "CarbonDioxideLevel", sche: "carbonDioxideLevel", characteristic: Characteristic.CarbonDioxideLevel, deprecated: false, UUID: "00000093-0000-1000-8000-0026BB765291", description: "The Amount of CO2 Detected", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToFloat( str ); }, props: {format: hapFormats.FLOAT, allowedWordCount: 1, maxValue: 100000, minValue: 0, minStep: 1, perms: [hapPerms.PAIRED_READ, hapPerms.NOTIFY ] }, validValues: {} }, 20: { type: "CarbonDioxidePeakLevel", sche: "carbonDioxidePeakLevel", characteristic: Characteristic.CarbonDioxidePeakLevel, deprecated: false, UUID: "00000094-0000-1000-8000-0026BB765291", description: "The Maximum Amount of CO2 Detected", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToFloat( str ); }, props: {format: hapFormats.FLOAT, allowedWordCount: 1, maxValue: 100000, minValue: 0, minStep: 1, perms: [hapPerms.PAIRED_READ, hapPerms.NOTIFY ] }, validValues: {} }, 21: { type: "CarbonMonoxideDetected", sche: "carbonMonoxideDetected", characteristic: Characteristic.CarbonMonoxideDetected, deprecated: false, UUID: "00000069-0000-1000-8000-0026BB765291", description: "Indication of CO Detected", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToInt( str ); }, props: {format: hapFormats.UINT8, allowedWordCount: 1, maxValue: 1, minValue: 0, minStep: 1, perms: [hapPerms.PAIRED_READ, hapPerms.NOTIFY ] }, validValues: {"CO_LEVELS_NORMAL": Characteristic.CarbonMonoxideDetected.CO_LEVELS_NORMAL, "CO_LEVELS_ABNORMAL": Characteristic.CarbonMonoxideDetected.CO_LEVELS_ABNORMAL } }, 22: { type: "CarbonMonoxideLevel", sche: "carbonMonoxideLevel", characteristic: Characteristic.CarbonMonoxideLevel, deprecated: false, UUID: "00000090-0000-1000-8000-0026BB765291", description: "The Amount of CO Detected", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToFloat( str ); }, props: {format: hapFormats.FLOAT, allowedWordCount: 1, maxValue: 100, minValue: 0, minStep: 1, perms: [hapPerms.PAIRED_READ, hapPerms.NOTIFY ] }, validValues: {} }, 23: { type: "CarbonMonoxidePeakLevel", sche: "carbonMonoxidePeakLevel", characteristic: Characteristic.CarbonMonoxidePeakLevel, deprecated: false, UUID: "00000091-0000-1000-8000-0026BB765291", description: "The Maximum Amount of CO Detected", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToFloat( str ); }, props: {format: hapFormats.FLOAT, allowedWordCount: 1, maxValue: 100, minValue: 0, minStep: 1, perms: [hapPerms.PAIRED_READ, hapPerms.NOTIFY ] }, validValues: {} }, // @deprecated Removed and not used anymore as of homebridge v2 24: { type: "Category", // HomeKitTypes-Bridge sche: "category", // HomeKitTypes-Bridge characteristic: Characteristic.Category, deprecated: true, UUID: "000000A3-0000-1000-8000-0026BB765291", description: "A Hint to HomeKitf of which Icon to Use", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToInt( str ); }, props: {format: hapFormats.UINT16, allowedWordCount: 1, maxValue: 16, minValue: 1, perms: [hapPerms.PAIRED_READ, hapPerms.NOTIFY ] }, validValues: {} }, 25: { type: "CharacteristicValueTransitionControl", // HomeKit sche: "characteristicValueTransitionControl", // HomeKit characteristic: Characteristic.CharacteristicValueTransitionControl, deprecated: false, UUID: "00000143-0000-1000-8000-0026BB765291", description: "The Devices Characteristic Value Transition Control", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToTLV8( str ); }, props: {format: hapFormats.TLV8, allowedWordCount: 0, perms: [hapPerms.PAIRED_READ, hapPerms.PAIRED_WRITE, hapPerms.WRITE_RESPONSE ] }, validValues: {} }, 26: { type: "ChargingState", sche: "chargingState", characteristic: Characteristic.ChargingState, deprecated: false, UUID: "0000008F-0000-1000-8000-0026BB765291", description: "The Current Charging State", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToInt( str ); }, props: {format: hapFormats.UINT8, allowedWordCount: 1, maxValue: 2, minValue: 0, minStep: 1, perms: [hapPerms.PAIRED_READ, hapPerms.NOTIFY ] }, validValues: // Checked 04/24/2020. Note: HomeKit Spec has inProgress, Not CHARGING {"NOT_CHARGING": Characteristic.ChargingState.NOT_CHARGING, "CHARGING": Characteristic.ChargingState.CHARGING, "NOT_CHARGEABLE": Characteristic.ChargingState.NOT_CHARGEABLE } }, 27: { type: "ClosedCaptions", // HomeKitTypes-Television sche: "closedCaptions", // HomeKitTypes-Television characteristic: Characteristic.ClosedCaptions, deprecated: false, UUID: "000000DD-0000-1000-8000-0026BB765291", description: "If Closed Captioning is Enabled", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToInt( str ); }, props: {format: hapFormats.UINT8, allowedWordCount: 1, maxValue: 1, minValue: 0, minStep: 1, perms: [hapPerms.PAIRED_READ, hapPerms.PAIRED_WRITE, hapPerms.NOTIFY ] }, validValues: {"DISABLED": Characteristic.ClosedCaptions.DISABLED, "ENABLED": Characteristic.ClosedCaptions.ENABLED } }, 28: { type: "ColorTemperature", sche: "colorTemperature", characteristic: Characteristic.ColorTemperature, deprecated: false, UUID: "000000CE-0000-1000-8000-0026BB765291", description: "The Colors Current Temperature", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToInt( str ); }, props: {format: hapFormats.INT, allowedWordCount: 1, maxValue: 500, minValue: 140, minStep: 1, perms: [hapPerms.PAIRED_READ, hapPerms.PAIRED_WRITE, hapPerms.NOTIFY ] }, validValues: {} }, // @deprecated Removed and not used anymore as of homebridge v2 29: { type: "ConfigureBridgedAccessory", // HomeKitTypes-Bridge sche: "configureBridgedAccessory", // HomeKitTypes-Bridge characteristic: Characteristic.ConfigureBridgedAccessory, deprecated: true, UUID: "000000A0-0000-1000-8000-0026BB765291", description: "The Configured Bridge Accessory", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToTLV8( str ); }, props: {format: hapFormats.TLV8, allowedWordCount: 0, perms: [hapPerms.WRITE ] }, validValues: {} }, // @deprecated Removed and not used anymore as of homebridge v2 30: { type: "ConfigureBridgedAccessoryStatus", // HomeKitTypes-Bridge sche: "configureBridgedAccessoryStatus", // HomeKitTypes-Bridge characteristic: Characteristic.ConfigureBridgedAccessoryStatus, deprecated: true, UUID: "0000009D-0000-1000-8000-0026BB765291", description: "The Configured Bridge Accessory Status", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToTLV8( str ); }, props: {format: hapFormats.TLV8, allowedWordCount: 0, perms: [hapPerms.PAIRED_READ, hapPerms.NOTIFY ] }, validValues: {} }, 31: { type: "ConfiguredName", // HomeKitTypes-Television sche: "configuredName", // HomeKitTypes-Television characteristic: Characteristic.ConfiguredName, deprecated: false, UUID: "000000E3-0000-1000-8000-0026BB765291", description: "Name of accessory, as displayed in HomeKit", relatedCurrentAccTypeEnumIndex: null, relatedTargetAccTypeEnumIndex: null, stringConversionFunction: function ( str ){ return stringToString( str ); }, props: {format: hapFormats.STRING, allowedWordCount: 0, perms: [hapPerms.PAIRED_READ, hapPerms.PAIRED_WRITE, hapPerms.NOTIFY ] }, validValues: {} }, 32: { type: "ContactSensorState", sche: "contactSensorS