def scheduleCheck() {
log.debug "scheduled check"
def motionState = motionSensor.currentState("motion")
- if (motionState.value == "inactive") {
- def elapsed = now() - motionState.rawDateCreated.time
- def threshold = 1000 * 60 * delayMins - 1000
- if (elapsed >= threshold) {
+ if (motionState == "inactive") {
+ //def elapsed = now() - motionState.rawDateCreated.time
+ //def threshold = 1000 * 60 * delayMins - 1000
+ if (/*elapsed >= threshold*/true) {
if (!isActivePresence()) {
- log.debug "Motion has stayed inactive since last check ($elapsed ms) and no presence: turning lights off"
+ log.debug "Motion has stayed inactive since last check and no presence: turning lights off"
switches.off()
} else {
log.debug "Presence is active: do nothing"
}
} else {
- log.debug "Motion has not stayed inactive long enough since last check ($elapsed ms): do nothing"
+ log.debug "Motion has not stayed inactive long enough since last check: do nothing"
}
} else {
log.debug "Motion is active: do nothing"
}
-}
\ No newline at end of file
+}