mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-27 21:20:03 +00:00
Set default occupancy timeout to 60 seconds. #27
This commit is contained in:
@@ -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};
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user