From 7fe3b31eeff9b99ab2cfc762868da41df766eb8b Mon Sep 17 00:00:00 2001 From: Christian Weimann Date: Mon, 1 Jan 2024 17:54:56 +0100 Subject: [PATCH] Add watch trigger to set CCTVs HomeMode dependiong on the status of the residents --- equipmentMgr.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/equipmentMgr.js b/equipmentMgr.js index 1b17d97..4bae9be 100644 --- a/equipmentMgr.js +++ b/equipmentMgr.js @@ -137,6 +137,18 @@ class Car extends Equipment { class CCTV extends Equipment { constructor(equipmentItem) { super(equipmentItem); + + // Watch + this.watch['AP_ResidentsAreHome'] = new watch.Watch('AP_ResidentsAreHome'); + this.watch['AP_ResidentsAreHome'].add({ + targetState: 'ON', + alertFunc: () => { this.setHomeMode('ON'); } + }); + this.watch['AP_ResidentsAreHome'].add({ + targetState: 'OFF', + alertFunc: () => { this.setHomeMode('OFF'); }, + alertDelay: 'PT1M' + }); } setHomeMode(mode) {