Update light-follows-me.groovy
[smartapps.git] / official / light-follows-me.groovy
index ddc1a0af4fe8bfe2466b23f64bb27739ab2384d4..83a295cf29cba25bf53f3d9d50b6fb953606dba3 100755 (executable)
@@ -59,14 +59,14 @@ def motionHandler(evt) {
 def scheduleCheck() {
        log.debug "schedule check"
        def motionState = motion1.currentState("motion")
-    if (motionState.value == "inactive") {
-        def elapsed = now() - motionState.rawDateCreated.time
-       def threshold = 1000 * 60 * minutes1 - 1000
-       if (elapsed >= threshold) {
-            log.debug "Motion has stayed inactive long enough since last check ($elapsed ms):  turning lights off"
+    if (motionState == "inactive") {
+        //def elapsed = now() - motionState.rawDateCreated.time
+       //def threshold = 1000 * 60 * minutes1 - 1000
+       if (/*elapsed >= threshold*/true) {
+            log.debug "Motion has stayed inactive long enough since last check:  turning lights off"
             switches.off()
        } else {
-               log.debug "Motion has not stayed inactive long enough since last check ($elapsed ms):  doing nothing"
+               log.debug "Motion has not stayed inactive long enough since last check:  doing nothing"
         }
     } else {
        log.debug "Motion is active, do nothing and wait for inactive"