UNPKG

@vandubois/homebridge-virtual-switch

Version:

Creation of virtual switches, triggered independently and by keywords appearing in the Homebridge log file.

62 lines (61 loc) 2.04 kB
import { API, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig, Service, Characteristic } from 'homebridge'; interface DeviceConfig { Name: string; NormallyClosed: boolean; SwitchStayOn: boolean; Time: number; UseCustomTime: boolean; TimeDays: number; TimeHours: number; TimeMinutes: number; TimeSeconds: number; TimerPersistent: boolean; UseLogFile: boolean; LogFilePath: string; Keywords: string[]; EnableStartupDelay: boolean; UseCustomStartupDelay: boolean; StartupDelay: number; StartupDelayDays: number; StartupDelayHours: number; StartupDelayMinutes: number; StartupDelaySeconds: number; RememberState: boolean; } interface TimerState { targetTime: number; isRunning: boolean; } export declare class HomebridgeVirtualSwitchesPlatform implements DynamicPlatformPlugin { readonly log: Logger; readonly config: PlatformConfig; readonly api: API; readonly Service: typeof Service; readonly Characteristic: typeof Characteristic; readonly accessories: PlatformAccessory[]; private accessoryInstances; private tailProcesses; private timerStates; private spawn; private stripAnsi; constructor(log: Logger, config: PlatformConfig, api: API); private loadDependencies; configureAccessory(accessory: PlatformAccessory): void; discoverDevices(): void; startLogMonitoring(device: DeviceConfig, uuid: string): void; private checkKeywords; private isPluginLogMessage; private escapeSpecialChars; private removeAnsiCodes; saveSwitchState(name: string, state: boolean): void; private loadSwitchState; saveTimerState(name: string, targetTime: number, isRunning: boolean): void; loadTimerState(name: string): TimerState | null; clearTimerState(name: string): void; calculateTargetTime(device: DeviceConfig): { targetTime: number; duration: number; }; hasReachedTargetTime(targetTime: number): boolean; } export {};