From 67865ecf0bd93162b5bfec80fdcad7154d1c8c1a Mon Sep 17 00:00:00 2001 From: Andreas Holstenson Date: Thu, 25 Jan 2018 20:22:32 +0100 Subject: [PATCH] Restoring use of _report for motion sensors --- lib/devices/gateway/motion.js | 9 ++++----- lib/devices/gateway/motion2.js | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/devices/gateway/motion.js b/lib/devices/gateway/motion.js index 43b2f9e..2bbb638 100644 --- a/lib/devices/gateway/motion.js +++ b/lib/devices/gateway/motion.js @@ -15,14 +15,13 @@ module.exports = class extends SubDevice.with(Motion, Voltage) { this.updateMotion(false); - this.defineProperty('status'); } - propertyChanged(key, value, oldValue) { - if(key === 'status' && value === 'motion') { + _report(data) { + super._report(data); + + if(typeof data.status !== 'undefined' && data.status === 'motion') { this.updateMotion(true, '1m'); } - - super.propertyChanged(key, value, oldValue); } }; diff --git a/lib/devices/gateway/motion2.js b/lib/devices/gateway/motion2.js index dc24e30..99ed78b 100644 --- a/lib/devices/gateway/motion2.js +++ b/lib/devices/gateway/motion2.js @@ -21,11 +21,11 @@ module.exports = class extends SubDevice.with(Motion, Illuminance, Voltage) { }); } - propertyChanged(key, value, oldValue) { - if(key === 'status' && value === 'motion') { + _report(data) { + super._report(data); + + if(typeof data.status !== 'undefined' && data.status === 'motion') { this.updateMotion(true, '1m'); } - - super.propertyChanged(key, value, oldValue); } };