Add new parameters to config schema.

This commit is contained in:
dennis committed 2026-03-09 21:29:53 +01:00
1 parent 62465b1deb
commit 3ef3435417
3 files changed
+44 -3

No files matched your search

+24
View File
@@ -3,14 +3,19 @@ import { PlatformConfig } from 'homebridge';
const DEFAULT_NUM_OF_CONFIGURED_SCENES = 5;
const DEFAULT_TRIGGER_TIMEOUT = 10;
const DEFAULT_RESET_AFTER_SWITCH_OFF = false;
const DEFAULT_TRIGGER_SCENE_AFTER_SWITCH_OFF = false;
const DEFAULT_TRIGGER_SCENE_OFF = 0;
const DEFAULT_LOGGING = false;
const DEFAULT_DEBOUNCE_TIMEOUT_MS = 150;
export interface PluginDeviceConfig {
readonly name: string;
readonly numberConfiguredScenes?: number;
readonly triggerTimeout?: number;
readonly resetAfterSwitchOff?: boolean;
readonly triggerSceneAfterSwitchOff?: boolean;
readonly logging?: boolean;
readonly debounceTimerMs?: number;
}
export class PluginConfig {
@@ -50,10 +55,29 @@ export class DeviceConfig {
|| DEFAULT_RESET_AFTER_SWITCH_OFF;
}
isTriggerSceneWhenOff(): boolean {
return this.device.triggerSceneAfterSwitchOff
|| DEFAULT_TRIGGER_SCENE_AFTER_SWITCH_OFF;
}
// When triggerSceneAfterSwitchOff is 'true', start at 1, otherwise 0 (normal behavior)
FirstTriggerScene(): number {
return this.isTriggerSceneWhenOff() ? 1 : 0;
}
TriggerOffSceneIndex(): number {
return DEFAULT_TRIGGER_SCENE_OFF;
}
isLogging(): boolean {
return this.device.logging
|| DEFAULT_LOGGING;
}
DebounceTimeoutMs(): number {
return this.device.debounceTimerMs
|| DEFAULT_DEBOUNCE_TIMEOUT_MS;
}
}
export interface AccessoryState {