homebridge-virtual-accessories
Version:
Virtual HomeKit accessories for Homebridge.
23 lines • 954 B
JavaScript
import { BinarySensor } from '../binarySensor.js';
import { Trigger } from './trigger.js';
import { Utils } from '../../utils/utils.js';
/**
* StartupTrigger - Trigger implementation
*/
export class StartupTrigger extends Trigger {
constructor(sensor, name) {
super(sensor, name);
// Hardcode reset delay
const resetDelayMillis = 3 * 1000; // 3 second reset delay
this.start(resetDelayMillis);
}
async start(resetDelayMillis) {
await Utils.delay(3000, this.accessoryName, this.log); // 3 second delay
this.log.debug(`[${this.accessoryName}] Triggering sensor`);
this.sensor.triggerSensorState(BinarySensor.TRIGGERED, this);
await Utils.delay(resetDelayMillis, this.accessoryName, this.log);
this.log.debug(`[${this.accessoryName}] Resetting sensor`);
this.sensor.triggerSensorState(BinarySensor.NORMAL, this);
}
}
//# sourceMappingURL=triggerStartup.js.map