UNPKG

homebridge-tapo-camera

Version:

Homebridge plugin for TP-Link TAPO security cameras

90 lines (89 loc) 2.75 kB
import { Logging } from "homebridge"; import { CameraConfig } from "./cameraAccessory"; import { OnvifCamera } from "./onvifCamera"; import type { TAPOBasicInfo, TAPOCameraSetRequest } from "./types/tapo"; export type Status = { eyes: boolean | undefined; alarm: boolean | undefined; notifications: boolean | undefined; motionDetection: boolean | undefined; led: boolean | undefined; }; export declare class TAPOCamera extends OnvifCamera { protected readonly log: Logging; protected readonly config: CameraConfig; private readonly kStreamPort; private readonly fetchAgent; private readonly hashedPassword; private readonly hashedSha256Password; private passwordEncryptionMethod; private isSecureConnectionValue; private stokPromise; private readonly cnonce; private lsk; private ivb; private seq; private stok; constructor(log: Logging, config: CameraConfig); private getUsername; private getHeaders; private getHashedPassword; private fetch; private generateEncryptionToken; getAuthenticatedStreamUrl(lowQuality?: boolean): string; private generateCnonce; private validateDeviceConfirm; refreshStok(loginRetryCount?: number): Promise<void>; isSecureConnection(): Promise<boolean>; getStok(loginRetryCount?: number): Promise<string>; private getAuthenticatedAPIURL; encryptRequest(request: string): Buffer<ArrayBuffer>; private encryptPad; private decryptResponse; private encryptUnpad; private getTapoTag; private pendingAPIRequests; private apiRequest; static SERVICE_MAP: Record<keyof Status, (value: boolean) => TAPOCameraSetRequest>; setStatus(service: keyof Status, value: boolean): Promise<object | { msg_alarm: { chn1_msg_alarm_info: { light_type: "1"; alarm_type: "1"; alarm_mode: ["sound", "light"]; enabled: "on" | "off"; }; }; } | { lens_mask: { lens_mask_info: { enabled: "on" | "off"; }; }; } | { msg_push: { chn1_msg_push_info: { notification_enabled: "on" | "off"; rich_notification_enabled: "on" | "off"; }; }; } | { motion_detection: { motion_det: { enabled: "on" | "off"; }; }; } | { led: { config: { enabled: "on" | "off"; }; }; } | { device_info: { basic_info: TAPOBasicInfo; }; }>; getBasicInfo(): Promise<TAPOBasicInfo>; getStatus(): Promise<Status>; }