UNPKG

58.8 kBTypeScriptView Raw
1import { EventEmitter } from "events";
2import { CharacteristicJsonObject, CharacteristicValue, Nullable, PartialAllowingNull, VoidCallback } from "../types";
3import { CharacteristicWarningType } from "./Accessory";
4import type { 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 } from "./definitions";
5import { HAPStatus } from "./HAPServer";
6import { IdentifierCache } from "./model/IdentifierCache";
7import { HAPConnection } from "./util/eventedhttp";
8import { HapStatusError } from "./util/hapStatusError";
9/**
10 * @group Characteristic
11 */
12export declare const enum Formats {
13 BOOL = "bool",
14 /**
15 * Signed 32-bit integer
16 */
17 INT = "int",// signed 32-bit int
18 /**
19 * Signed 64-bit floating point
20 */
21 FLOAT = "float",
22 /**
23 * String encoded in utf8
24 */
25 STRING = "string",
26 /**
27 * Unsigned 8-bit integer.
28 */
29 UINT8 = "uint8",
30 /**
31 * Unsigned 16-bit integer.
32 */
33 UINT16 = "uint16",
34 /**
35 * Unsigned 32-bit integer.
36 */
37 UINT32 = "uint32",
38 /**
39 * Unsigned 64-bit integer.
40 */
41 UINT64 = "uint64",
42 /**
43 * Data is base64 encoded string.
44 */
45 DATA = "data",
46 /**
47 * Base64 encoded tlv8 string.
48 */
49 TLV8 = "tlv8"
50}
51/**
52 * @group Characteristic
53 */
54export declare const enum Units {
55 /**
56 * Celsius is the only temperature unit in the HomeKit Accessory Protocol.
57 * Unit conversion is always done on the client side e.g. on the iPhone in the Home App depending on
58 * the configured unit on the device itself.
59 */
60 CELSIUS = "celsius",
61 PERCENTAGE = "percentage",
62 ARC_DEGREE = "arcdegrees",
63 LUX = "lux",
64 SECONDS = "seconds"
65}
66/**
67 * @group Characteristic
68 */
69export declare const enum Perms {
70 PAIRED_READ = "pr",
71 PAIRED_WRITE = "pw",
72 NOTIFY = "ev",
73 EVENTS = "ev",
74 ADDITIONAL_AUTHORIZATION = "aa",
75 TIMED_WRITE = "tw",
76 HIDDEN = "hd",
77 WRITE_RESPONSE = "wr"
78}
79/**
80 * @group Characteristic
81 */
82export interface CharacteristicProps {
83 format: Formats | string;
84 perms: Perms[];
85 unit?: Units | string;
86 description?: string;
87 /**
88 * Defines the minimum value for a numeric characteristic
89 */
90 minValue?: number;
91 /**
92 * Defines the maximum value for a numeric characteristic
93 */
94 maxValue?: number;
95 minStep?: number;
96 /**
97 * Maximum number of characters when format is {@link Formats.STRING}.
98 * Default is 64 characters. Maximum allowed is 256 characters.
99 */
100 maxLen?: number;
101 /**
102 * Maximum number of characters when format is {@link Formats.DATA}.
103 * Default is 2097152 characters.
104 */
105 maxDataLen?: number;
106 /**
107 * Defines an array of valid values to be used for the characteristic.
108 */
109 validValues?: number[];
110 /**
111 * Two element array where the first value specifies the lowest valid value and
112 * the second element specifies the highest valid value.
113 */
114 validValueRanges?: [min: number, max: number];
115 adminOnlyAccess?: Access[];
116}
117/**
118 * Describes the abstract access to a {@link Characteristic}.
119 * It abstracts the more granular access described by {@link Perms}.
120 *
121 * It is used in {@link CharacteristicProps.adminOnlyAccess}.
122 *
123 * @group Characteristic
124 */
125export declare const enum Access {
126 READ = 0,
127 WRITE = 1,
128 NOTIFY = 2
129}
130/**
131 * @group Characteristic
132 */
133export type CharacteristicChange = {
134 originator?: HAPConnection;
135 newValue: Nullable<CharacteristicValue>;
136 oldValue: Nullable<CharacteristicValue>;
137 reason: ChangeReason;
138 context?: CharacteristicContext;
139};
140/**
141 * @group Characteristic
142 */
143export declare const enum ChangeReason {
144 /**
145 * Reason used when HomeKit writes a value or the API user calls {@link Characteristic.setValue}.
146 */
147 WRITE = "write",
148 /**
149 * Reason used when the API user calls the method {@link Characteristic.updateValue}.
150 */
151 UPDATE = "update",
152 /**
153 * Used when HomeKit reads a value or the API user calls the deprecated method `Characteristic.getValue`.
154 */
155 READ = "read",
156 /**
157 * Used when call to {@link Characteristic.sendEventNotification} was made.
158 */
159 EVENT = "event"
160}
161/**
162 * This format for a context object can be used to pass to any characteristic write operation.
163 * It can contain additional information used by the internal event handlers of hap-nodejs.
164 * The context object can be combined with any custom data for own use.
165 *
166 * @group Characteristic
167 */
168export interface CharacteristicOperationContext {
169 /**
170 * If set to true for any characteristic write operation
171 * the Accessory won't send any event notifications to HomeKit controllers
172 * for that particular change.
173 */
174 omitEventUpdate?: boolean;
175}
176/**
177 * @group Characteristic
178 */
179export interface SerializedCharacteristic {
180 displayName: string;
181 UUID: string;
182 eventOnlyCharacteristic: boolean;
183 constructorName?: string;
184 value: Nullable<CharacteristicValue>;
185 props: CharacteristicProps;
186}
187/**
188 * @group Characteristic
189 */
190export declare const enum CharacteristicEventTypes {
191 /**
192 * This event is thrown when a HomeKit controller wants to read the current value of the characteristic.
193 * The event handler should call the supplied callback as fast as possible.
194 *
195 * HAP-NodeJS will complain about slow running get handlers after 3 seconds and terminate the request after 10 seconds.
196 */
197 GET = "get",
198 /**
199 * This event is thrown when a HomeKit controller wants to write a new value to the characteristic.
200 * The event handler should call the supplied callback as fast as possible.
201 *
202 * HAP-NodeJS will complain about slow running set handlers after 3 seconds and terminate the request after 10 seconds.
203 */
204 SET = "set",
205 /**
206 * Emitted after a new value is set for the characteristic.
207 * The new value can be set via a request by a HomeKit controller or via an API call.
208 */
209 CHANGE = "change",
210 /**
211 * @private
212 */
213 SUBSCRIBE = "subscribe",
214 /**
215 * @private
216 */
217 UNSUBSCRIBE = "unsubscribe",
218 /**
219 * @private
220 */
221 CHARACTERISTIC_WARNING = "characteristic-warning"
222}
223/**
224 * @group Characteristic
225 */
226export type CharacteristicContext = any;
227/**
228 * @group Characteristic
229 */
230export type CharacteristicGetCallback = (status?: HAPStatus | null | Error, value?: Nullable<CharacteristicValue>) => void;
231/**
232 * @group Characteristic
233 */
234export type CharacteristicSetCallback = (error?: HAPStatus | null | Error, writeResponse?: Nullable<CharacteristicValue>) => void;
235/**
236 * @group Characteristic
237 */
238export type CharacteristicGetHandler = (context: CharacteristicContext, connection?: HAPConnection) => Promise<Nullable<CharacteristicValue>> | Nullable<CharacteristicValue>;
239/**
240 * @group Characteristic
241 */
242export type CharacteristicSetHandler = (value: CharacteristicValue, context: CharacteristicContext, connection?: HAPConnection) => Promise<Nullable<CharacteristicValue> | void> | Nullable<CharacteristicValue> | void;
243/**
244 * @group Characteristic
245 */
246export type AdditionalAuthorizationHandler = (additionalAuthorizationData: string | undefined) => boolean;
247/**
248 * @group Characteristic
249 */
250export declare interface Characteristic {
251 on(event: "get", listener: (callback: CharacteristicGetCallback, context: CharacteristicContext, connection?: HAPConnection) => void): this;
252 on(event: "set", listener: (value: CharacteristicValue, callback: CharacteristicSetCallback, context: CharacteristicContext, connection?: HAPConnection) => void): this;
253 on(event: "change", listener: (change: CharacteristicChange) => void): this;
254 /**
255 * @private
256 */
257 on(event: "subscribe", listener: VoidCallback): this;
258 /**
259 * @private
260 */
261 on(event: "unsubscribe", listener: VoidCallback): this;
262 /**
263 * @private
264 */
265 on(event: "characteristic-warning", listener: (type: CharacteristicWarningType, message: string, stack?: string) => void): this;
266 /**
267 * @private
268 */
269 emit(event: "get", callback: CharacteristicGetCallback, context: CharacteristicContext, connection?: HAPConnection): boolean;
270 /**
271 * @private
272 */
273 emit(event: "set", value: CharacteristicValue, callback: CharacteristicSetCallback, context: CharacteristicContext, connection?: HAPConnection): boolean;
274 /**
275 * @private
276 */
277 emit(event: "change", change: CharacteristicChange): boolean;
278 /**
279 * @private
280 */
281 emit(event: "subscribe"): boolean;
282 /**
283 * @private
284 */
285 emit(event: "unsubscribe"): boolean;
286 /**
287 * @private
288 */
289 emit(event: "characteristic-warning", type: CharacteristicWarningType, message: string, stack?: string): boolean;
290}
291/**
292 * Characteristic represents a particular typed variable that can be assigned to a Service. For instance, a
293 * "Hue" Characteristic might store a 'float' value of type 'arcdegrees'. You could add the Hue Characteristic
294 * to a {@link Service} in order to store that value. A particular Characteristic is distinguished from others by its
295 * UUID. HomeKit provides a set of known Characteristic UUIDs defined in HomeKit.ts along with a
296 * corresponding concrete subclass.
297 *
298 * You can also define custom Characteristics by providing your own UUID. Custom Characteristics can be added
299 * to any native or custom Services, but Siri will likely not be able to work with these.
300 *
301 * @group Characteristic
302 */
303export declare class Characteristic extends EventEmitter {
304 /**
305 * @group Characteristic Definitions
306 */
307 static AccessCodeControlPoint: typeof AccessCodeControlPoint;
308 /**
309 * @group Characteristic Definitions
310 */
311 static AccessCodeSupportedConfiguration: typeof AccessCodeSupportedConfiguration;
312 /**
313 * @group Characteristic Definitions
314 */
315 static AccessControlLevel: typeof AccessControlLevel;
316 /**
317 * @group Characteristic Definitions
318 */
319 static AccessoryFlags: typeof AccessoryFlags;
320 /**
321 * @group Characteristic Definitions
322 */
323 static AccessoryIdentifier: typeof AccessoryIdentifier;
324 /**
325 * @group Characteristic Definitions
326 */
327 static Active: typeof Active;
328 /**
329 * @group Characteristic Definitions
330 */
331 static ActiveIdentifier: typeof ActiveIdentifier;
332 /**
333 * @group Characteristic Definitions
334 */
335 static ActivityInterval: typeof ActivityInterval;
336 /**
337 * @group Characteristic Definitions
338 */
339 static AdministratorOnlyAccess: typeof AdministratorOnlyAccess;
340 /**
341 * @group Characteristic Definitions
342 */
343 static AirParticulateDensity: typeof AirParticulateDensity;
344 /**
345 * @group Characteristic Definitions
346 */
347 static AirParticulateSize: typeof AirParticulateSize;
348 /**
349 * @group Characteristic Definitions
350 */
351 static AirPlayEnable: typeof AirPlayEnable;
352 /**
353 * @group Characteristic Definitions
354 */
355 static AirQuality: typeof AirQuality;
356 /**
357 * @group Characteristic Definitions
358 */
359 static AppMatchingIdentifier: typeof AppMatchingIdentifier;
360 /**
361 * @group Characteristic Definitions
362 */
363 static AssetUpdateReadiness: typeof AssetUpdateReadiness;
364 /**
365 * @group Characteristic Definitions
366 */
367 static AudioFeedback: typeof AudioFeedback;
368 /**
369 * @group Characteristic Definitions
370 */
371 static BatteryLevel: typeof BatteryLevel;
372 /**
373 * @group Characteristic Definitions
374 */
375 static Brightness: typeof Brightness;
376 /**
377 * @group Characteristic Definitions
378 */
379 static ButtonEvent: typeof ButtonEvent;
380 /**
381 * @group Characteristic Definitions
382 */
383 static CameraOperatingModeIndicator: typeof CameraOperatingModeIndicator;
384 /**
385 * @group Characteristic Definitions
386 */
387 static CarbonDioxideDetected: typeof CarbonDioxideDetected;
388 /**
389 * @group Characteristic Definitions
390 */
391 static CarbonDioxideLevel: typeof CarbonDioxideLevel;
392 /**
393 * @group Characteristic Definitions
394 */
395 static CarbonDioxidePeakLevel: typeof CarbonDioxidePeakLevel;
396 /**
397 * @group Characteristic Definitions
398 */
399 static CarbonMonoxideDetected: typeof CarbonMonoxideDetected;
400 /**
401 * @group Characteristic Definitions
402 */
403 static CarbonMonoxideLevel: typeof CarbonMonoxideLevel;
404 /**
405 * @group Characteristic Definitions
406 */
407 static CarbonMonoxidePeakLevel: typeof CarbonMonoxidePeakLevel;
408 /**
409 * @group Characteristic Definitions
410 */
411 static CCAEnergyDetectThreshold: typeof CCAEnergyDetectThreshold;
412 /**
413 * @group Characteristic Definitions
414 */
415 static CCASignalDetectThreshold: typeof CCASignalDetectThreshold;
416 /**
417 * @group Characteristic Definitions
418 */
419 static CharacteristicValueActiveTransitionCount: typeof CharacteristicValueActiveTransitionCount;
420 /**
421 * @group Characteristic Definitions
422 */
423 static CharacteristicValueTransitionControl: typeof CharacteristicValueTransitionControl;
424 /**
425 * @group Characteristic Definitions
426 */
427 static ChargingState: typeof ChargingState;
428 /**
429 * @group Characteristic Definitions
430 */
431 static ClosedCaptions: typeof ClosedCaptions;
432 /**
433 * @group Characteristic Definitions
434 */
435 static ColorTemperature: typeof ColorTemperature;
436 /**
437 * @group Characteristic Definitions
438 */
439 static ConfigurationState: typeof ConfigurationState;
440 /**
441 * @group Characteristic Definitions
442 */
443 static ConfiguredName: typeof ConfiguredName;
444 /**
445 * @group Characteristic Definitions
446 */
447 static ContactSensorState: typeof ContactSensorState;
448 /**
449 * @group Characteristic Definitions
450 */
451 static CoolingThresholdTemperature: typeof CoolingThresholdTemperature;
452 /**
453 * @group Characteristic Definitions
454 */
455 static CryptoHash: typeof CryptoHash;
456 /**
457 * @group Characteristic Definitions
458 */
459 static CurrentAirPurifierState: typeof CurrentAirPurifierState;
460 /**
461 * @group Characteristic Definitions
462 */
463 static CurrentAmbientLightLevel: typeof CurrentAmbientLightLevel;
464 /**
465 * @group Characteristic Definitions
466 */
467 static CurrentDoorState: typeof CurrentDoorState;
468 /**
469 * @group Characteristic Definitions
470 */
471 static CurrentFanState: typeof CurrentFanState;
472 /**
473 * @group Characteristic Definitions
474 */
475 static CurrentHeaterCoolerState: typeof CurrentHeaterCoolerState;
476 /**
477 * @group Characteristic Definitions
478 */
479 static CurrentHeatingCoolingState: typeof CurrentHeatingCoolingState;
480 /**
481 * @group Characteristic Definitions
482 */
483 static CurrentHorizontalTiltAngle: typeof CurrentHorizontalTiltAngle;
484 /**
485 * @group Characteristic Definitions
486 */
487 static CurrentHumidifierDehumidifierState: typeof CurrentHumidifierDehumidifierState;
488 /**
489 * @group Characteristic Definitions
490 */
491 static CurrentMediaState: typeof CurrentMediaState;
492 /**
493 * @group Characteristic Definitions
494 */
495 static CurrentPosition: typeof CurrentPosition;
496 /**
497 * @group Characteristic Definitions
498 */
499 static CurrentRelativeHumidity: typeof CurrentRelativeHumidity;
500 /**
501 * @group Characteristic Definitions
502 */
503 static CurrentSlatState: typeof CurrentSlatState;
504 /**
505 * @group Characteristic Definitions
506 */
507 static CurrentTemperature: typeof CurrentTemperature;
508 /**
509 * @group Characteristic Definitions
510 */
511 static CurrentTiltAngle: typeof CurrentTiltAngle;
512 /**
513 * @group Characteristic Definitions
514 */
515 static CurrentTransport: typeof CurrentTransport;
516 /**
517 * @group Characteristic Definitions
518 */
519 static CurrentVerticalTiltAngle: typeof CurrentVerticalTiltAngle;
520 /**
521 * @group Characteristic Definitions
522 */
523 static CurrentVisibilityState: typeof CurrentVisibilityState;
524 /**
525 * @group Characteristic Definitions
526 */
527 static DataStreamHAPTransport: typeof DataStreamHAPTransport;
528 /**
529 * @group Characteristic Definitions
530 */
531 static DataStreamHAPTransportInterrupt: typeof DataStreamHAPTransportInterrupt;
532 /**
533 * @group Characteristic Definitions
534 */
535 static DiagonalFieldOfView: typeof DiagonalFieldOfView;
536 /**
537 * @group Characteristic Definitions
538 */
539 static DigitalZoom: typeof DigitalZoom;
540 /**
541 * @group Characteristic Definitions
542 */
543 static DisplayOrder: typeof DisplayOrder;
544 /**
545 * @group Characteristic Definitions
546 */
547 static EventRetransmissionMaximum: typeof EventRetransmissionMaximum;
548 /**
549 * @group Characteristic Definitions
550 */
551 static EventSnapshotsActive: typeof EventSnapshotsActive;
552 /**
553 * @group Characteristic Definitions
554 */
555 static EventTransmissionCounters: typeof EventTransmissionCounters;
556 /**
557 * @group Characteristic Definitions
558 */
559 static FilterChangeIndication: typeof FilterChangeIndication;
560 /**
561 * @group Characteristic Definitions
562 */
563 static FilterLifeLevel: typeof FilterLifeLevel;
564 /**
565 * @group Characteristic Definitions
566 */
567 static FirmwareRevision: typeof FirmwareRevision;
568 /**
569 * @group Characteristic Definitions
570 */
571 static FirmwareUpdateReadiness: typeof FirmwareUpdateReadiness;
572 /**
573 * @group Characteristic Definitions
574 */
575 static FirmwareUpdateStatus: typeof FirmwareUpdateStatus;
576 /**
577 * @group Characteristic Definitions
578 */
579 static HardwareFinish: typeof HardwareFinish;
580 /**
581 * @group Characteristic Definitions
582 */
583 static HardwareRevision: typeof HardwareRevision;
584 /**
585 * @group Characteristic Definitions
586 */
587 static HeartBeat: typeof HeartBeat;
588 /**
589 * @group Characteristic Definitions
590 */
591 static HeatingThresholdTemperature: typeof HeatingThresholdTemperature;
592 /**
593 * @group Characteristic Definitions
594 */
595 static HoldPosition: typeof HoldPosition;
596 /**
597 * @group Characteristic Definitions
598 */
599 static HomeKitCameraActive: typeof HomeKitCameraActive;
600 /**
601 * @group Characteristic Definitions
602 */
603 static Hue: typeof Hue;
604 /**
605 * @group Characteristic Definitions
606 */
607 static Identifier: typeof Identifier;
608 /**
609 * @group Characteristic Definitions
610 */
611 static Identify: typeof Identify;
612 /**
613 * @group Characteristic Definitions
614 */
615 static ImageMirroring: typeof ImageMirroring;
616 /**
617 * @group Characteristic Definitions
618 */
619 static ImageRotation: typeof ImageRotation;
620 /**
621 * @group Characteristic Definitions
622 */
623 static InputDeviceType: typeof InputDeviceType;
624 /**
625 * @group Characteristic Definitions
626 */
627 static InputSourceType: typeof InputSourceType;
628 /**
629 * @group Characteristic Definitions
630 */
631 static InUse: typeof InUse;
632 /**
633 * @group Characteristic Definitions
634 */
635 static IsConfigured: typeof IsConfigured;
636 /**
637 * @group Characteristic Definitions
638 */
639 static LeakDetected: typeof LeakDetected;
640 /**
641 * @group Characteristic Definitions
642 */
643 static ListPairings: typeof ListPairings;
644 /**
645 * @group Characteristic Definitions
646 */
647 static LockControlPoint: typeof LockControlPoint;
648 /**
649 * @group Characteristic Definitions
650 */
651 static LockCurrentState: typeof LockCurrentState;
652 /**
653 * @group Characteristic Definitions
654 */
655 static LockLastKnownAction: typeof LockLastKnownAction;
656 /**
657 * @group Characteristic Definitions
658 */
659 static LockManagementAutoSecurityTimeout: typeof LockManagementAutoSecurityTimeout;
660 /**
661 * @group Characteristic Definitions
662 */
663 static LockPhysicalControls: typeof LockPhysicalControls;
664 /**
665 * @group Characteristic Definitions
666 */
667 static LockTargetState: typeof LockTargetState;
668 /**
669 * @group Characteristic Definitions
670 */
671 static Logs: typeof Logs;
672 /**
673 * @group Characteristic Definitions
674 */
675 static MACRetransmissionMaximum: typeof MACRetransmissionMaximum;
676 /**
677 * @group Characteristic Definitions
678 */
679 static MACTransmissionCounters: typeof MACTransmissionCounters;
680 /**
681 * @group Characteristic Definitions
682 */
683 static ManagedNetworkEnable: typeof ManagedNetworkEnable;
684 /**
685 * @group Characteristic Definitions
686 */
687 static ManuallyDisabled: typeof ManuallyDisabled;
688 /**
689 * @group Characteristic Definitions
690 */
691 static Manufacturer: typeof Manufacturer;
692 /**
693 * @group Characteristic Definitions
694 */
695 static MaximumTransmitPower: typeof MaximumTransmitPower;
696 /**
697 * @group Characteristic Definitions
698 */
699 static MetricsBufferFullState: typeof MetricsBufferFullState;
700 /**
701 * @group Characteristic Definitions
702 */
703 static Model: typeof Model;
704 /**
705 * @group Characteristic Definitions
706 */
707 static MotionDetected: typeof MotionDetected;
708 /**
709 * @group Characteristic Definitions
710 */
711 static MultifunctionButton: typeof MultifunctionButton;
712 /**
713 * @group Characteristic Definitions
714 */
715 static Mute: typeof Mute;
716 /**
717 * @group Characteristic Definitions
718 */
719 static Name: typeof Name;
720 /**
721 * @group Characteristic Definitions
722 */
723 static NetworkAccessViolationControl: typeof NetworkAccessViolationControl;
724 /**
725 * @group Characteristic Definitions
726 */
727 static NetworkClientProfileControl: typeof NetworkClientProfileControl;
728 /**
729 * @group Characteristic Definitions
730 */
731 static NetworkClientStatusControl: typeof NetworkClientStatusControl;
732 /**
733 * @group Characteristic Definitions
734 */
735 static NFCAccessControlPoint: typeof NFCAccessControlPoint;
736 /**
737 * @group Characteristic Definitions
738 */
739 static NFCAccessSupportedConfiguration: typeof NFCAccessSupportedConfiguration;
740 /**
741 * @group Characteristic Definitions
742 */
743 static NightVision: typeof NightVision;
744 /**
745 * @group Characteristic Definitions
746 */
747 static NitrogenDioxideDensity: typeof NitrogenDioxideDensity;
748 /**
749 * @group Characteristic Definitions
750 */
751 static ObstructionDetected: typeof ObstructionDetected;
752 /**
753 * @group Characteristic Definitions
754 */
755 static OccupancyDetected: typeof OccupancyDetected;
756 /**
757 * @group Characteristic Definitions
758 */
759 static On: typeof On;
760 /**
761 * @group Characteristic Definitions
762 */
763 static OperatingStateResponse: typeof OperatingStateResponse;
764 /**
765 * @group Characteristic Definitions
766 */
767 static OpticalZoom: typeof OpticalZoom;
768 /**
769 * @group Characteristic Definitions
770 */
771 static OutletInUse: typeof OutletInUse;
772 /**
773 * @group Characteristic Definitions
774 */
775 static OzoneDensity: typeof OzoneDensity;
776 /**
777 * @group Characteristic Definitions
778 */
779 static PairingFeatures: typeof PairingFeatures;
780 /**
781 * @group Characteristic Definitions
782 */
783 static PairSetup: typeof PairSetup;
784 /**
785 * @group Characteristic Definitions
786 */
787 static PairVerify: typeof PairVerify;
788 /**
789 * @group Characteristic Definitions
790 */
791 static PasswordSetting: typeof PasswordSetting;
792 /**
793 * @group Characteristic Definitions
794 */
795 static PeriodicSnapshotsActive: typeof PeriodicSnapshotsActive;
796 /**
797 * @group Characteristic Definitions
798 */
799 static PictureMode: typeof PictureMode;
800 /**
801 * @group Characteristic Definitions
802 */
803 static Ping: typeof Ping;
804 /**
805 * @group Characteristic Definitions
806 */
807 static PM10Density: typeof PM10Density;
808 /**
809 * @group Characteristic Definitions
810 */
811 static PM2_5Density: typeof PM2_5Density;
812 /**
813 * @group Characteristic Definitions
814 */
815 static PositionState: typeof PositionState;
816 /**
817 * @group Characteristic Definitions
818 */
819 static PowerModeSelection: typeof PowerModeSelection;
820 /**
821 * @group Characteristic Definitions
822 */
823 static ProductData: typeof ProductData;
824 /**
825 * @group Characteristic Definitions
826 */
827 static ProgrammableSwitchEvent: typeof ProgrammableSwitchEvent;
828 /**
829 * @group Characteristic Definitions
830 */
831 static ProgrammableSwitchOutputState: typeof ProgrammableSwitchOutputState;
832 /**
833 * @group Characteristic Definitions
834 */
835 static ProgramMode: typeof ProgramMode;
836 /**
837 * @group Characteristic Definitions
838 */
839 static ReceivedSignalStrengthIndication: typeof ReceivedSignalStrengthIndication;
840 /**
841 * @group Characteristic Definitions
842 */
843 static ReceiverSensitivity: typeof ReceiverSensitivity;
844 /**
845 * @group Characteristic Definitions
846 */
847 static RecordingAudioActive: typeof RecordingAudioActive;
848 /**
849 * @group Characteristic Definitions
850 */
851 static RelativeHumidityDehumidifierThreshold: typeof RelativeHumidityDehumidifierThreshold;
852 /**
853 * @group Characteristic Definitions
854 */
855 static RelativeHumidityHumidifierThreshold: typeof RelativeHumidityHumidifierThreshold;
856 /**
857 * @group Characteristic Definitions
858 */
859 static RelayControlPoint: typeof RelayControlPoint;
860 /**
861 * @group Characteristic Definitions
862 */
863 static RelayEnabled: typeof RelayEnabled;
864 /**
865 * @group Characteristic Definitions
866 */
867 static RelayState: typeof RelayState;
868 /**
869 * @group Characteristic Definitions
870 */
871 static RemainingDuration: typeof RemainingDuration;
872 /**
873 * @group Characteristic Definitions
874 */
875 static RemoteKey: typeof RemoteKey;
876 /**
877 * @group Characteristic Definitions
878 */
879 static ResetFilterIndication: typeof ResetFilterIndication;
880 /**
881 * @group Characteristic Definitions
882 */
883 static RotationDirection: typeof RotationDirection;
884 /**
885 * @group Characteristic Definitions
886 */
887 static RotationSpeed: typeof RotationSpeed;
888 /**
889 * @group Characteristic Definitions
890 */
891 static RouterStatus: typeof RouterStatus;
892 /**
893 * @group Characteristic Definitions
894 */
895 static Saturation: typeof Saturation;
896 /**
897 * @group Characteristic Definitions
898 */
899 static SecuritySystemAlarmType: typeof SecuritySystemAlarmType;
900 /**
901 * @group Characteristic Definitions
902 */
903 static SecuritySystemCurrentState: typeof SecuritySystemCurrentState;
904 /**
905 * @group Characteristic Definitions
906 */
907 static SecuritySystemTargetState: typeof SecuritySystemTargetState;
908 /**
909 * @group Characteristic Definitions
910 */
911 static SelectedAudioStreamConfiguration: typeof SelectedAudioStreamConfiguration;
912 /**
913 * @group Characteristic Definitions
914 */
915 static SelectedCameraRecordingConfiguration: typeof SelectedCameraRecordingConfiguration;
916 /**
917 * @group Characteristic Definitions
918 */
919 static SelectedDiagnosticsModes: typeof SelectedDiagnosticsModes;
920 /**
921 * @group Characteristic Definitions
922 */
923 static SelectedRTPStreamConfiguration: typeof SelectedRTPStreamConfiguration;
924 /**
925 * @group Characteristic Definitions
926 */
927 static SelectedSleepConfiguration: typeof SelectedSleepConfiguration;
928 /**
929 * @group Characteristic Definitions
930 */
931 static SerialNumber: typeof SerialNumber;
932 /**
933 * @group Characteristic Definitions
934 */
935 static ServiceLabelIndex: typeof ServiceLabelIndex;
936 /**
937 * @group Characteristic Definitions
938 */
939 static ServiceLabelNamespace: typeof ServiceLabelNamespace;
940 /**
941 * @group Characteristic Definitions
942 */
943 static SetDuration: typeof SetDuration;
944 /**
945 * @group Characteristic Definitions
946 */
947 static SetupDataStreamTransport: typeof SetupDataStreamTransport;
948 /**
949 * @group Characteristic Definitions
950 */
951 static SetupEndpoints: typeof SetupEndpoints;
952 /**
953 * @group Characteristic Definitions
954 */
955 static SetupTransferTransport: typeof SetupTransferTransport;
956 /**
957 * @group Characteristic Definitions
958 */
959 static SignalToNoiseRatio: typeof SignalToNoiseRatio;
960 /**
961 * @group Characteristic Definitions
962 */
963 static SiriEnable: typeof SiriEnable;
964 /**
965 * @group Characteristic Definitions
966 */
967 static SiriEndpointSessionStatus: typeof SiriEndpointSessionStatus;
968 /**
969 * @group Characteristic Definitions
970 */
971 static SiriEngineVersion: typeof SiriEngineVersion;
972 /**
973 * @group Characteristic Definitions
974 */
975 static SiriInputType: typeof SiriInputType;
976 /**
977 * @group Characteristic Definitions
978 */
979 static SiriLightOnUse: typeof SiriLightOnUse;
980 /**
981 * @group Characteristic Definitions
982 */
983 static SiriListening: typeof SiriListening;
984 /**
985 * @group Characteristic Definitions
986 */
987 static SiriTouchToUse: typeof SiriTouchToUse;
988 /**
989 * @group Characteristic Definitions
990 */
991 static SlatType: typeof SlatType;
992 /**
993 * @group Characteristic Definitions
994 */
995 static SleepDiscoveryMode: typeof SleepDiscoveryMode;
996 /**
997 * @group Characteristic Definitions
998 */
999 static SleepInterval: typeof SleepInterval;
1000 /**
1001 * @group Characteristic Definitions
1002 */
1003 static SmokeDetected: typeof SmokeDetected;
1004 /**
1005 * @group Characteristic Definitions
1006 */
1007 static SoftwareRevision: typeof SoftwareRevision;
1008 /**
1009 * @group Characteristic Definitions
1010 */
1011 static StagedFirmwareVersion: typeof StagedFirmwareVersion;
1012 /**
1013 * @group Characteristic Definitions
1014 */
1015 static StatusActive: typeof StatusActive;
1016 /**
1017 * @group Characteristic Definitions
1018 */
1019 static StatusFault: typeof StatusFault;
1020 /**
1021 * @group Characteristic Definitions
1022 */
1023 static StatusJammed: typeof StatusJammed;
1024 /**
1025 * @group Characteristic Definitions
1026 */
1027 static StatusLowBattery: typeof StatusLowBattery;
1028 /**
1029 * @group Characteristic Definitions
1030 */
1031 static StatusTampered: typeof StatusTampered;
1032 /**
1033 * @group Characteristic Definitions
1034 */
1035 static StreamingStatus: typeof StreamingStatus;
1036 /**
1037 * @group Characteristic Definitions
1038 */
1039 static SulphurDioxideDensity: typeof SulphurDioxideDensity;
1040 /**
1041 * @group Characteristic Definitions
1042 */
1043 static SupportedAssetTypes: typeof SupportedAssetTypes;
1044 /**
1045 * @group Characteristic Definitions
1046 */
1047 static SupportedAudioRecordingConfiguration: typeof SupportedAudioRecordingConfiguration;
1048 /**
1049 * @group Characteristic Definitions
1050 */
1051 static SupportedAudioStreamConfiguration: typeof SupportedAudioStreamConfiguration;
1052 /**
1053 * @group Characteristic Definitions
1054 */
1055 static SupportedCameraRecordingConfiguration: typeof SupportedCameraRecordingConfiguration;
1056 /**
1057 * @group Characteristic Definitions
1058 */
1059 static SupportedCharacteristicValueTransitionConfiguration: typeof SupportedCharacteristicValueTransitionConfiguration;
1060 /**
1061 * @group Characteristic Definitions
1062 */
1063 static SupportedDataStreamTransportConfiguration: typeof SupportedDataStreamTransportConfiguration;
1064 /**
1065 * @group Characteristic Definitions
1066 */
1067 static SupportedDiagnosticsModes: typeof SupportedDiagnosticsModes;
1068 /**
1069 * @group Characteristic Definitions
1070 */
1071 static SupportedDiagnosticsSnapshot: typeof SupportedDiagnosticsSnapshot;
1072 /**
1073 * @group Characteristic Definitions
1074 */
1075 static SupportedFirmwareUpdateConfiguration: typeof SupportedFirmwareUpdateConfiguration;
1076 /**
1077 * @group Characteristic Definitions
1078 */
1079 static SupportedMetrics: typeof SupportedMetrics;
1080 /**
1081 * @group Characteristic Definitions
1082 */
1083 static SupportedRouterConfiguration: typeof SupportedRouterConfiguration;
1084 /**
1085 * @group Characteristic Definitions
1086 */
1087 static SupportedRTPConfiguration: typeof SupportedRTPConfiguration;
1088 /**
1089 * @group Characteristic Definitions
1090 */
1091 static SupportedSleepConfiguration: typeof SupportedSleepConfiguration;
1092 /**
1093 * @group Characteristic Definitions
1094 */
1095 static SupportedTransferTransportConfiguration: typeof SupportedTransferTransportConfiguration;
1096 /**
1097 * @group Characteristic Definitions
1098 */
1099 static SupportedVideoRecordingConfiguration: typeof SupportedVideoRecordingConfiguration;
1100 /**
1101 * @group Characteristic Definitions
1102 */
1103 static SupportedVideoStreamConfiguration: typeof SupportedVideoStreamConfiguration;
1104 /**
1105 * @group Characteristic Definitions
1106 */
1107 static SwingMode: typeof SwingMode;
1108 /**
1109 * @group Characteristic Definitions
1110 */
1111 static TapType: typeof TapType;
1112 /**
1113 * @group Characteristic Definitions
1114 */
1115 static TargetAirPurifierState: typeof TargetAirPurifierState;
1116 /**
1117 * @group Characteristic Definitions
1118 */
1119 static TargetControlList: typeof TargetControlList;
1120 /**
1121 * @group Characteristic Definitions
1122 */
1123 static TargetControlSupportedConfiguration: typeof TargetControlSupportedConfiguration;
1124 /**
1125 * @group Characteristic Definitions
1126 */
1127 static TargetDoorState: typeof TargetDoorState;
1128 /**
1129 * @group Characteristic Definitions
1130 */
1131 static TargetFanState: typeof TargetFanState;
1132 /**
1133 * @group Characteristic Definitions
1134 */
1135 static TargetHeaterCoolerState: typeof TargetHeaterCoolerState;
1136 /**
1137 * @group Characteristic Definitions
1138 */
1139 static TargetHeatingCoolingState: typeof TargetHeatingCoolingState;
1140 /**
1141 * @group Characteristic Definitions
1142 */
1143 static TargetHorizontalTiltAngle: typeof TargetHorizontalTiltAngle;
1144 /**
1145 * @group Characteristic Definitions
1146 */
1147 static TargetHumidifierDehumidifierState: typeof TargetHumidifierDehumidifierState;
1148 /**
1149 * @group Characteristic Definitions
1150 */
1151 static TargetMediaState: typeof TargetMediaState;
1152 /**
1153 * @group Characteristic Definitions
1154 */
1155 static TargetPosition: typeof TargetPosition;
1156 /**
1157 * @group Characteristic Definitions
1158 */
1159 static TargetRelativeHumidity: typeof TargetRelativeHumidity;
1160 /**
1161 * @group Characteristic Definitions
1162 */
1163 static TargetTemperature: typeof TargetTemperature;
1164 /**
1165 * @group Characteristic Definitions
1166 */
1167 static TargetTiltAngle: typeof TargetTiltAngle;
1168 /**
1169 * @group Characteristic Definitions
1170 */
1171 static TargetVerticalTiltAngle: typeof TargetVerticalTiltAngle;
1172 /**
1173 * @group Characteristic Definitions
1174 */
1175 static TargetVisibilityState: typeof TargetVisibilityState;
1176 /**
1177 * @group Characteristic Definitions
1178 */
1179 static TemperatureDisplayUnits: typeof TemperatureDisplayUnits;
1180 /**
1181 * @group Characteristic Definitions
1182 */
1183 static ThirdPartyCameraActive: typeof ThirdPartyCameraActive;
1184 /**
1185 * @group Characteristic Definitions
1186 */
1187 static ThreadControlPoint: typeof ThreadControlPoint;
1188 /**
1189 * @group Characteristic Definitions
1190 */
1191 static ThreadNodeCapabilities: typeof ThreadNodeCapabilities;
1192 /**
1193 * @group Characteristic Definitions
1194 */
1195 static ThreadOpenThreadVersion: typeof ThreadOpenThreadVersion;
1196 /**
1197 * @group Characteristic Definitions
1198 */
1199 static ThreadStatus: typeof ThreadStatus;
1200 /**
1201 * @group Characteristic Definitions
1202 */
1203 static Token: typeof Token;
1204 /**
1205 * @group Characteristic Definitions
1206 */
1207 static TransmitPower: typeof TransmitPower;
1208 /**
1209 * @group Characteristic Definitions
1210 */
1211 static TunnelConnectionTimeout: typeof TunnelConnectionTimeout;
1212 /**
1213 * @group Characteristic Definitions
1214 */
1215 static TunneledAccessoryAdvertising: typeof TunneledAccessoryAdvertising;
1216 /**
1217 * @group Characteristic Definitions
1218 */
1219 static TunneledAccessoryConnected: typeof TunneledAccessoryConnected;
1220 /**
1221 * @group Characteristic Definitions
1222 */
1223 static TunneledAccessoryStateNumber: typeof TunneledAccessoryStateNumber;
1224 /**
1225 * @group Characteristic Definitions
1226 */
1227 static ValveType: typeof ValveType;
1228 /**
1229 * @group Characteristic Definitions
1230 */
1231 static Version: typeof Version;
1232 /**
1233 * @group Characteristic Definitions
1234 */
1235 static VideoAnalysisActive: typeof VideoAnalysisActive;
1236 /**
1237 * @group Characteristic Definitions
1238 */
1239 static VOCDensity: typeof VOCDensity;
1240 /**
1241 * @group Characteristic Definitions
1242 */
1243 static Volume: typeof Volume;
1244 /**
1245 * @group Characteristic Definitions
1246 */
1247 static VolumeControlType: typeof VolumeControlType;
1248 /**
1249 * @group Characteristic Definitions
1250 */
1251 static VolumeSelector: typeof VolumeSelector;
1252 /**
1253 * @group Characteristic Definitions
1254 */
1255 static WakeConfiguration: typeof WakeConfiguration;
1256 /**
1257 * @group Characteristic Definitions
1258 */
1259 static WANConfigurationList: typeof WANConfigurationList;
1260 /**
1261 * @group Characteristic Definitions
1262 */
1263 static WANStatusList: typeof WANStatusList;
1264 /**
1265 * @group Characteristic Definitions
1266 */
1267 static WaterLevel: typeof WaterLevel;
1268 /**
1269 * @group Characteristic Definitions
1270 */
1271 static WiFiCapabilities: typeof WiFiCapabilities;
1272 /**
1273 * @group Characteristic Definitions
1274 */
1275 static WiFiConfigurationControl: typeof WiFiConfigurationControl;
1276 /**
1277 * @group Characteristic Definitions
1278 */
1279 static WiFiSatelliteStatus: typeof WiFiSatelliteStatus;
1280 displayName: string;
1281 UUID: string;
1282 iid: Nullable<number>;
1283 value: Nullable<CharacteristicValue>;
1284 /**
1285 * @private
1286 */
1287 statusCode: HAPStatus;
1288 props: CharacteristicProps;
1289 /**
1290 * The {@link Characteristic.onGet} handler
1291 */
1292 private getHandler?;
1293 /**
1294 * The {@link Characteristic.onSet} handler
1295 */
1296 private setHandler?;
1297 private subscriptions;
1298 /**
1299 * @private
1300 */
1301 additionalAuthorizationHandler?: AdditionalAuthorizationHandler;
1302 constructor(displayName: string, UUID: string, props: CharacteristicProps);
1303 /**
1304 * Accepts a function that will be called to retrieve the current value of a Characteristic.
1305 * The function must return a valid Characteristic value for the Characteristic type.
1306 * May optionally return a promise.
1307 *
1308 * @example
1309 * ```ts
1310 * Characteristic.onGet(async () => {
1311 * return true;
1312 * });
1313 * ```
1314 * @param handler
1315 */
1316 onGet(handler: CharacteristicGetHandler): Characteristic;
1317 /**
1318 * Removes the {@link CharacteristicGetHandler} handler which was configured using {@link onGet}.
1319 */
1320 removeOnGet(): Characteristic;
1321 /**
1322 * Accepts a function that will be called when setting the value of a Characteristic.
1323 * If the characteristic supports {@link Perms.WRITE_RESPONSE} and the request requests a write-response value,
1324 * the returned value will be used.
1325 * May optionally return a promise.
1326 *
1327 * @example
1328 * ```ts
1329 * Characteristic.onSet(async (value: CharacteristicValue) => {
1330 * console.log(value);
1331 * });
1332 * ```
1333 * @param handler
1334 */
1335 onSet(handler: CharacteristicSetHandler): Characteristic;
1336 /**
1337 * Removes the {@link CharacteristicSetHandler} which was configured using {@link onSet}.
1338 */
1339 removeOnSet(): Characteristic;
1340 /**
1341 * Updates the properties of this characteristic.
1342 * Properties passed via the parameter will be set. Any parameter set to null will be deleted.
1343 * See {@link CharacteristicProps}.
1344 *
1345 * @param props - Partial properties object with the desired updates.
1346 */
1347 setProps(props: PartialAllowingNull<CharacteristicProps>): Characteristic;
1348 /**
1349 * This method can be used to gain an Iterator to loop over all valid values defined for this characteristic.
1350 *
1351 * The range of valid values can be defined using three different ways via the {@link CharacteristicProps} object
1352 * (set via the {@link setProps} method):
1353 * * First method is to specifically list every valid value inside {@link CharacteristicProps.validValues}
1354 * * Second you can specify a range via {@link CharacteristicProps.minValue} and {@link CharacteristicProps.maxValue} (with optionally defining
1355 * {@link CharacteristicProps.minStep})
1356 * * And lastly you can specify a range via {@link CharacteristicProps.validValueRanges}
1357 * * Implicitly a valid value range is predefined for characteristics with Format {@link Formats.UINT8}, {@link Formats.UINT16},
1358 * {@link Formats.UINT32} and {@link Formats.UINT64}: starting by zero to their respective maximum number
1359 *
1360 * The method will automatically detect which type of valid values definition is used and provide
1361 * the correct Iterator for that case.
1362 *
1363 * Note: This method is (obviously) only valid for numeric characteristics.
1364 *
1365 * @example
1366 * ```ts
1367 * // use the iterator to loop over every valid value...
1368 * for (const value of characteristic.validValuesIterator()) {
1369 * // Insert logic to run for every
1370 * }
1371 *
1372 * // ... or collect them in an array for storage or manipulation
1373 * const validValues = Array.from(characteristic.validValuesIterator());
1374 * ```
1375 */
1376 validValuesIterator(): Iterable<number>;
1377 /**
1378 * This method can be used to set up additional authorization for a characteristic.
1379 * For one, it adds the {@link Perms.ADDITIONAL_AUTHORIZATION} permission to the characteristic
1380 * (if it wasn't already) to signal support for additional authorization to HomeKit.
1381 * Additionally, an {@link AdditionalAuthorizationHandler} is set up which is called
1382 * before a write request is performed.
1383 *
1384 * Additional Authorization Data can be added to SET request via a custom iOS App.
1385 * Before hap-nodejs executes a write request it will call the {@link AdditionalAuthorizationHandler}
1386 * with 'authData' supplied in the write request. The 'authData' is a base64 encoded string
1387 * (or undefined if no authData was supplied).
1388 * The {@link AdditionalAuthorizationHandler} must then return true or false to indicate if the write request
1389 * is authorized and should be accepted.
1390 *
1391 * @param handler - Handler called to check additional authorization data.
1392 */
1393 setupAdditionalAuthorization(handler: AdditionalAuthorizationHandler): void;
1394 /**
1395 * This updates the value by calling the {@link CharacteristicEventTypes.SET} event handler associated with the characteristic.
1396 * This acts the same way as when a HomeKit controller sends a `/characteristics` request to update the characteristic.
1397 * An event notification will be sent to all connected HomeKit controllers which are registered
1398 * to receive event notifications for this characteristic.
1399 *
1400 * This method behaves like a {@link updateValue} call with the addition that the own {@link CharacteristicEventTypes.SET}
1401 * event handler is called.
1402 *
1403 * @param value - The new value.
1404 *
1405 * Note: If you don't want the {@link CharacteristicEventTypes.SET} to be called, refer to {@link updateValue}.
1406 */
1407 setValue(value: CharacteristicValue): Characteristic;
1408 /**
1409 * Sets the state of the characteristic to an errored state.
1410 *
1411 * If a {@link onGet} or {@link CharacteristicEventTypes.GET} handler is set up,
1412 * the errored state will be ignored and the characteristic will always query the latest state by calling the provided handler.
1413 *
1414 * If a generic error object is supplied, the characteristic tries to extract a {@link HAPStatus} code
1415 * from the error message string. If not possible a generic {@link HAPStatus.SERVICE_COMMUNICATION_FAILURE} will be used.
1416 * If the supplied error object is an instance of {@link HapStatusError} the corresponding status will be used.
1417 *
1418 * This doesn't call any registered {@link onSet} or {@link CharacteristicEventTypes.SET} handlers.
1419 *
1420 * Have a look at the
1421 * {@link https://github.com/homebridge/HAP-NodeJS/wiki/Presenting-Erroneous-Accessory-State-to-the-User Presenting Erroneous Accessory State to the User}
1422 * guide for more information on how to present erroneous state to the user.
1423 *
1424 * @param error - The error object
1425 *
1426 * Note: Erroneous state is never **pushed** to the client side. Only, if the HomeKit client requests the current
1427 * state of the Characteristic, the corresponding {@link HapStatusError} is returned. As described above,
1428 * any {@link onGet} or {@link CharacteristicEventTypes.GET} handlers have precedence.
1429 */
1430 setValue(error: HapStatusError | Error): Characteristic;
1431 /**
1432 * This updates the value by calling the {@link CharacteristicEventTypes.SET} event handler associated with the characteristic.
1433 * This acts the same way as when a HomeKit controller sends a `/characteristics` request to update the characteristic.
1434 * An event notification will be sent to all connected HomeKit controllers which are registered
1435 * to receive event notifications for this characteristic.
1436 *
1437 * This method behaves like a {@link updateValue} call with the addition that the own {@link CharacteristicEventTypes.SET}
1438 * event handler is called.
1439 *
1440 * @param value - The new value.
1441 * @param context - Passed to the {@link CharacteristicEventTypes.SET} and {@link CharacteristicEventTypes.CHANGE} event handler.
1442 *
1443 * Note: If you don't want the {@link CharacteristicEventTypes.SET} to be called, refer to {@link updateValue}.
1444 */
1445 setValue(value: CharacteristicValue, context?: CharacteristicContext): Characteristic;
1446 /**
1447 * This updates the value of the characteristic. If the value changed, an event notification will be sent to all connected
1448 * HomeKit controllers which are registered to receive event notifications for this characteristic.
1449 *
1450 * @param value - The new value or a `Error` or {@link HapStatusError}.
1451 *
1452 * Note: Refer to the respective overloads for {@link CharacteristicValue} or {@link HapStatusError} for respective documentation.
1453 */
1454 updateValue(value: Nullable<CharacteristicValue> | Error | HapStatusError): Characteristic;
1455 /**
1456 * This updates the value of the characteristic. If the value changed, an event notification will be sent to all connected
1457 * HomeKit controllers which are registered to receive event notifications for this characteristic.
1458 *
1459 * @param value - The new value.
1460 */
1461 updateValue(value: Nullable<CharacteristicValue>): Characteristic;
1462 /**
1463 * Sets the state of the characteristic to an errored state.
1464 * If a {@link onGet} or {@link CharacteristicEventTypes.GET} handler is set up,
1465 * the errored state will be ignored and the characteristic will always query the latest state by calling the provided handler.
1466 *
1467 * If a generic error object is supplied, the characteristic tries to extract a {@link HAPStatus} code
1468 * from the error message string. If not possible a generic {@link HAPStatus.SERVICE_COMMUNICATION_FAILURE} will be used.
1469 * If the supplied error object is an instance of {@link HapStatusError} the corresponding status will be used.
1470 *
1471 * Have a look at the
1472 * {@link https://github.com/homebridge/HAP-NodeJS/wiki/Presenting-Erroneous-Accessory-State-to-the-User Presenting Erroneous Accessory State to the User}
1473 * guide for more information on how to present erroneous state to the user.
1474 *
1475 * @param error - The error object
1476 *
1477 * Note: Erroneous state is never **pushed** to the client side. Only, if the HomeKit client requests the current
1478 * state of the Characteristic, the corresponding {@link HapStatusError} is returned. As described above,
1479 * any {@link onGet} or {@link CharacteristicEventTypes.GET} handlers have precedence.
1480 */
1481 updateValue(error: Error | HapStatusError): Characteristic;
1482 /**
1483 * This updates the value of the characteristic. If the value changed, an event notification will be sent to all connected
1484 * HomeKit controllers which are registered to receive event notifications for this characteristic.
1485 *
1486 * @param value - The new value.
1487 * @param context - Passed to the {@link CharacteristicEventTypes.CHANGE} event handler.
1488 */
1489 updateValue(value: Nullable<CharacteristicValue>, context?: CharacteristicContext): Characteristic;
1490 /**
1491 * This method acts similarly to {@link updateValue} by setting the current value of the characteristic
1492 * without calling any {@link CharacteristicEventTypes.SET} or {@link onSet} handlers.
1493 * The difference is that this method forces an event notification sent (updateValue only sends one if the value changed).
1494 * This is especially useful for characteristics like {@link Characteristic.ButtonEvent} or {@link Characteristic.ProgrammableSwitchEvent}.
1495 *
1496 * @param value - The new value.
1497 * @param context - Passed to the {@link CharacteristicEventTypes.CHANGE} event handler.
1498 */
1499 sendEventNotification(value: CharacteristicValue, context?: CharacteristicContext): Characteristic;
1500 /**
1501 * Called when a HAP requests wants to know the current value of the characteristic.
1502 *
1503 * @param connection - The HAP connection from which the request originated from.
1504 * @param context - Deprecated parameter. There for backwards compatibility.
1505 * @private Used by the Accessory to load the characteristic value
1506 */
1507 handleGetRequest(connection?: HAPConnection, context?: CharacteristicContext): Promise<Nullable<CharacteristicValue>>;
1508 /**
1509 * Called when a HAP requests update the current value of the characteristic.
1510 *
1511 * @param value - The updated value
1512 * @param connection - The connection from which the request originated from
1513 * @param context - Deprecated parameter. There for backwards compatibility.
1514 * @returns Promise resolve to void in normal operation. When characteristic supports write-response, HAP
1515 * requests a write-response and the set handler returns a write-response value, the respective
1516 * write response value is resolved.
1517 * @private
1518 */
1519 handleSetRequest(value: CharacteristicValue, connection?: HAPConnection, context?: CharacteristicContext): Promise<CharacteristicValue | void>;
1520 /**
1521 * Called once a HomeKit controller subscribes to events of this characteristic.
1522 * @private
1523 */
1524 subscribe(): void;
1525 /**
1526 * Called once a HomeKit controller unsubscribe to events of this characteristic or a HomeKit controller
1527 * which was subscribed to this characteristic disconnects.
1528 * @private
1529 */
1530 unsubscribe(): void;
1531 protected getDefaultValue(): Nullable<CharacteristicValue>;
1532 /**
1533 * Checks if the value received from the HAP request is valid.
1534 * If returned false the received value is not valid and {@link HAPStatus.INVALID_VALUE_IN_REQUEST}
1535 * must be returned.
1536 * @param value - Value supplied by the HomeKit controller
1537 */
1538 private validateClientSuppliedValue;
1539 /**
1540 * Checks if the value received from the API call is valid.
1541 * It adjusts the value where it makes sense, prints a warning where values may be rejected with an error
1542 * in the future and throws an error which can't be converted to a valid value.
1543 *
1544 * @param value - The value received from the API call
1545 * @param warningType - Optionally defines the warning type to use when raising a {@link CharacteristicEventTypes.CHARACTERISTIC_WARNING}.
1546 */
1547 private validateUserInput;
1548 /**
1549 * @private used to assign iid to characteristic
1550 */
1551 _assignID(identifierCache: IdentifierCache, accessoryName: string, serviceUUID: string, serviceSubtype?: string): void;
1552 private characteristicWarning;
1553 /**
1554 * @param event
1555 * @private
1556 */
1557 removeAllListeners(event?: string | symbol): this;
1558 /**
1559 * @param characteristic
1560 * @private
1561 */
1562 replaceBy(characteristic: Characteristic): void;
1563 /**
1564 * Returns a JSON representation of this characteristic suitable for delivering to HAP clients.
1565 * @private used to generate response to /accessories query
1566 */
1567 toHAP(connection: HAPConnection, contactGetHandlers?: boolean): Promise<CharacteristicJsonObject>;
1568 /**
1569 * Returns a JSON representation of this characteristic without the value.
1570 * @private used to generate the config hash
1571 */
1572 internalHAPRepresentation(): CharacteristicJsonObject;
1573 /**
1574 * Serialize characteristic into json string.
1575 *
1576 * @param characteristic - Characteristic object.
1577 * @private used to store characteristic on disk
1578 */
1579 static serialize(characteristic: Characteristic): SerializedCharacteristic;
1580 /**
1581 * Deserialize characteristic from json string.
1582 *
1583 * @param json - Json string representing a characteristic.
1584 * @private used to recreate characteristic from disk
1585 */
1586 static deserialize(json: SerializedCharacteristic): Characteristic;
1587}
1588import "./definitions/CharacteristicDefinitions";
1589//# sourceMappingURL=Characteristic.d.ts.map
\No newline at end of file