From 17aba009af9e84314d60ef6a103547cc6b3d5b15 Mon Sep 17 00:00:00 2001 From: Koenkk Date: Tue, 15 May 2018 18:00:06 +0200 Subject: [PATCH] Set default occupancy timeout to 60 seconds. #27 --- lib/converters/zigbee2mqtt.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/converters/zigbee2mqtt.js b/lib/converters/zigbee2mqtt.js index 2c91e0154..059fa6b4b 100644 --- a/lib/converters/zigbee2mqtt.js +++ b/lib/converters/zigbee2mqtt.js @@ -21,6 +21,8 @@ const QBKG03LM = { 3: 'l2', }; +const occupancyTimeout = 60; // In seconds + const toPercentage = (value, min, max) => { if (value > max) { value = max; @@ -177,8 +179,6 @@ const parsers = [ convert: (msg, publish) => { // The occupancy sensor only sends a message when motion detected. // Therefore we need to publish the no_motion detected by ourselves. - // no_motion is triggered after 3 minutes of no motion. - const noMotionTimeout = 3; // in minutes const deviceID = msg.endpoints[0].device.ieeeAddr; // Stop existing timer because motion is detected and set a new one. @@ -190,7 +190,7 @@ const parsers = [ store[deviceID] = setTimeout(() => { publish({occupancy: false}) store[deviceID] = null; - }, noMotionTimeout * 60 * 1000); + }, occupancyTimeout * 1000); return {occupancy: true}; } },