UNPKG

2.57 kBTypeScriptView Raw
1import { EventTriggerOption } from "../camera";
2import { Service } from "../Service";
3import { CameraController, CameraControllerOptions, CameraControllerServiceMap } from "./CameraController";
4import { ControllerServiceMap } from "./Controller";
5/**
6 * Options which are additionally supplied for a {@link DoorbellController}.
7 *
8 * @group Doorbell
9 */
10export interface DoorbellOptions {
11 /**
12 * Name used to for the {@link Service.Doorbell} service.
13 */
14 name?: string;
15 /**
16 * This property may be used to supply an external {@link Service.Doorbell}.
17 * This is particularly handy when one is migrating from an existing implementation
18 * to a `DoorbellController` and want to avoid loosing users automation by removing and deleting the service.
19 *
20 * NOTE: You are responsible for managing the service yourself (e.g. creation, restoring, adding to accessory, ...)
21 */
22 externalDoorbellService?: Service;
23}
24/**
25 * The `DoorbellController` to efficiently manage doorbell implementations with HAP-NodeJS.
26 *
27 * NOTICE: We subclass from the {@link CameraController} here and deliberately do not introduce/set an
28 * own/custom ControllerType for Doorbells, as Cameras and Doorbells are pretty much the same thing
29 * and would collide otherwise.
30 * As the possibility exists, both the CameraController and DoorbellController are written to support migration
31 * from one to another. Meaning a serialized CameraController can be initialized as a DoorbellController
32 * (on startup in {@link initWithServices}) and vice versa.
33 *
34 * @group Doorbell
35 */
36export declare class DoorbellController extends CameraController {
37 private doorbellService?;
38 private doorbellServiceExternallySupplied;
39 /**
40 * Temporary storage. Erased after init.
41 */
42 private doorbellOptions?;
43 /**
44 * Initializes a new `DoorbellController`.
45 * @param options - The {@link CameraControllerOptions} and optional {@link DoorbellOptions}.
46 */
47 constructor(options: CameraControllerOptions & DoorbellOptions);
48 /**
49 * Call this method to signal a doorbell button press.
50 */
51 ringDoorbell(): void;
52 constructServices(): CameraControllerServiceMap;
53 initWithServices(serviceMap: CameraControllerServiceMap): void | CameraControllerServiceMap;
54 protected migrateFromDoorbell(serviceMap: ControllerServiceMap): boolean;
55 protected retrieveEventTriggerOptions(): Set<EventTriggerOption>;
56 handleControllerRemoved(): void;
57 configureServices(): void;
58}
59//# sourceMappingURL=DoorbellController.d.ts.map
\No newline at end of file