Update groveStreams.groovy
[smartapps.git] / official / lighting-director.groovy
index a73c496f603d5aa634b0a8217307a9a5ce43cc9c..5f42ace64ba39a3d369c64a5a046842cd109b0fa 100755 (executable)
@@ -263,19 +263,20 @@ def initialize() {
        midNightReset()
 
        if(A_motion) {
-               subscribe(settings.A_motion, "motion", onEventA)
+               //subscribe(A_motion, "motion", onEventA)
+               subscribe(A_motion, "motion", onEventA)
        }
 
        if(A_acceleration) {
-               subscribe(settings.A_acceleration, "acceleration", onEventA)
+               subscribe(A_acceleration, "acceleration", onEventA)
        }
 
        if(A_contact) {
-               subscribe(settings.A_contact, "contact", onEventA)
+               subscribe(A_contact, "contact", onEventA)
        }
 
        if(A_lock) {
-               subscribe(settings.A_lock, "lock", onEventA)
+               subscribe(A_lock, "lock", onEventA)
        }
 
        if(A_switchDisable) {
@@ -287,8 +288,8 @@ def initialize() {
 
 def onEventA(evt) {
 
-if ((!A_triggerOnce || (A_triggerOnce && !state.A_triggered)) && (!A_switchDisable || (A_switchDisable && !state.A_triggered))) { //Checks to make sure this scenario should be triggered more then once in a day
-if ((!A_mode || A_mode.contains(location.mode)) && getTimeOk (A_timeStart, A_timeEnd) && getDayOk(A_day)) { //checks to make sure we are not opperating outside of set restrictions.
+if (/*(!A_triggerOnce || (A_triggerOnce && !state.A_triggered)) && (!A_switchDisable || (A_switchDisable && !state.A_triggered))*/true) { //Checks to make sure this scenario should be triggered more then once in a day
+if ((!A_mode || A_mode.contains(location.mode)) && true/*getTimeOk (A_timeStart, A_timeEnd) && getDayOk(A_day)*/) { //checks to make sure we are not opperating outside of set restrictions.
 if ((!A_luxSensors) || (A_luxSensors.latestValue("illuminance") <= A_turnOnLux)){ //checks to make sure illimunance is either not cared about or if the value is within the restrictions
 def A_levelOn = A_level as Integer
 
@@ -344,9 +345,9 @@ def delayTurnOffA(){
 
 //when physical switch is actuated disable the scenario
 def onPressA(evt) {
-if ((!A_mode || A_mode.contains(location.mode)) && getTimeOk (A_timeStart, A_timeEnd) && getDayOk(A_day)) { //checks to make sure we are not opperating outside of set restrictions.
+if ((!A_mode || A_mode.contains(location.mode)) && /*getTimeOk (A_timeStart, A_timeEnd) && getDayOk(A_day)*/true) { //checks to make sure we are not opperating outside of set restrictions.
 if ((!A_luxSensors) || (A_luxSensors.latestValue("illuminance") <= A_turnOnLux)){ 
-if ((!A_triggerOnce || (A_triggerOnce && !state.A_triggered)) && (!A_switchDisable || (A_switchDisable && !state.A_triggered))) {    
+if (/*(!A_triggerOnce || (A_triggerOnce && !state.A_triggered)) && (!A_switchDisable || (A_switchDisable && !state.A_triggered))*/true) {    
     if (evt.physical){
        state.A_triggered = true
         unschedule(delayTurnOffA)
@@ -414,7 +415,7 @@ def getDesc(scenario) {
 
 
 def getMidnight() {
-       def midnightToday = timeToday("2000-01-01T23:59:59.999-0000", location.timeZone)
+       def midnightToday = timeToday("23:59", location.timeZone)
        midnightToday
 }
 
@@ -428,13 +429,13 @@ def unlockDetected = false
 def result = false
 
 if (motion) {
-       if (motion.latestValue("motion").contains("active")) {
+       if (motion.latestValue("motion") == "active") {
                motionDetected = true
        }
 }
 
 if (acceleration) {
-       if (acceleration.latestValue("acceleration").contains("active")) {
+       if (acceleration.latestValue("acceleration") == "active") {
                accelerationDetected = true
        }
 }