Update lighting-director.groovy
authorSeyed Amir Hossein Aqajari <amiraj.95@uci.edu>
Tue, 6 Aug 2019 00:05:33 +0000 (17:05 -0700)
committerGitHub Enterprise <noreply@github.uci.edu>
Tue, 6 Aug 2019 00:05:33 +0000 (17:05 -0700)
official/lighting-director.groovy

index d9ddfc30275344434ed60590c9866b705e0bad94..29dea73c36868d2d0c13994668093308f52d8774 100755 (executable)
@@ -51,11 +51,14 @@ definition(
     iconX3Url: "https://raw.githubusercontent.com/MichaelStruck/SmartThings/master/Other-SmartApps/Lighting-Director/LightingDirector@2x.png")
 
 preferences {
+    page(name: "timeIntervalInputA", title: "Only during a certain time", refreshAfterSelection:true) {
+               section {
+                       input "A_timeStart", "time", title: "Starting", required: false, refreshAfterSelection:true
+                       input "A_timeEnd", "time", title: "Ending", required: false, refreshAfterSelection:true
+               }
+        }
     page name:"pageSetup"
     page name:"pageSetupScenarioA"
-    page name:"pageSetupScenarioB"
-    page name:"pageSetupScenarioC"
-    page name:"pageSetupScenarioD"
 }
 
 // Show setup page
@@ -71,9 +74,6 @@ def pageSetup() {
        return dynamicPage(pageProperties) {
         section("Setup Menu") {
             href "pageSetupScenarioA", title: getTitle(settings.ScenarioNameA), description: getDesc(settings.ScenarioNameA), state: greyOut(settings.ScenarioNameA)
-            href "pageSetupScenarioB", title: getTitle(settings.ScenarioNameB), description: getDesc(settings.ScenarioNameB), state: greyOut(settings.ScenarioNameB)
-            href "pageSetupScenarioC", title: getTitle(settings.ScenarioNameC), description: getDesc(settings.ScenarioNameC), state: greyOut(settings.ScenarioNameC)
-                       href "pageSetupScenarioD", title: getTitle(settings.ScenarioNameD), description: getDesc(settings.ScenarioNameD), state: greyOut(settings.ScenarioNameD)
             }
         section([title:"Options", mobileOnly:true]) {
             label title:"Assign a name", required:false
@@ -200,8 +200,7 @@ def pageSetupScenarioA() {
         type:       "text",
         title:      "Scenario Name",
         multiple:   false,
-        required:   false,
-        defaultValue: empty
+        required:   false
     ]
     
     def pageProperties = [
@@ -244,486 +243,7 @@ section("Help") {
     
 }
 
-def pageSetupScenarioB() {
-
-    def inputLightsB = [
-        name:       "B_switches",
-        type:       "capability.switch",
-        title:      "Control the following switches...",
-        multiple:   true,
-        required:   false
-    ]
-    def inputDimmersB = [
-        name:       "B_dimmers",
-        type:       "capability.switchLevel",
-        title:      "Dim the following...",
-        multiple:   true,
-        required:   false
-    ]
-    
-    def inputTurnOnLuxB = [
-        name:       "B_turnOnLux",
-        type:       "number",
-        title:      "Only run this scenario if lux is below...",
-        multiple:   false,
-        required:   false
-    ]
-    
-    def inputLuxSensorsB = [
-        name:       "B_luxSensors",
-        type:       "capability.illuminanceMeasurement",
-        title:      "On these lux sensors",
-        multiple:   false,
-        required:   false
-    ]
-
-    def inputMotionB = [
-        name:       "B_motion",
-        type:       "capability.motionSensor",
-        title:      "Using these motion sensors...",
-        multiple:   true,
-        required:   false
-    ]
-    
-       def inputAccelerationB = [
-               name:       "B_acceleration",
-               type:       "capability.accelerationSensor",
-               title:      "Or using these acceleration sensors...",
-               multiple:   true,
-               required:   false
-       ]
-    def inputContactB = [
-        name:       "B_contact",
-        type:       "capability.contactSensor",
-        title:      "Or using these contact sensors...",
-        multiple:   true,
-        required:   false
-    ]
-    
-    def inputTriggerOnceB = [
-       name:       "B_triggerOnce",
-        type:       "bool",
-        title:      "Trigger only once per day...",
-        defaultValue:false
-    ]
-    
-    def inputSwitchDisableB = [
-       name:       "B_switchDisable",
-        type:       "bool",
-        title:      "Stop triggering if physical switches/dimmers are turned off...",
-        defaultValue:false
-    ]
-    
-    def inputLockB = [
-        name:       "B_lock",
-        type:       "capability.lock",
-        title:      "Or using these locks...",
-        multiple:   true,
-        required:   false
-    ]
-    
-    def inputModeB = [
-        name:       "B_mode",
-        type:       "mode",
-        title:      "Only during the following modes...",
-        multiple:   true,
-        required:   false
-    ]
-    
-    def inputDayB = [
-        name:       "B_day",
-        type:       "enum",
-        options: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
-        title:      "Only on certain days of the week...",
-        multiple:   true,
-        required:   false
-    ]
-    
-    def inputLevelB = [
-        name:       "B_level",
-        type:       "enum",
-        options: [[10:"10%"],[20:"20%"],[30:"30%"],[40:"40%"],[50:"50%"],[60:"60%"],[70:"70%"],[80:"80%"],[90:"90%"],[100:"100%"]],
-        title:      "Set dimmers to this level",
-        multiple:   false,
-        required:   false
-    ]
-    
-    def inputTurnOffB = [
-        name:       "B_turnOff",
-        type:       "number",
-        title:      "Turn off this scenario after motion stops or doors close/lock (minutes)...",
-        multiple:   false,
-        required:   false
-    ]
-    
-    def inputScenarioNameB = [
-        name:       "ScenarioNameB",
-        type:       "text",
-        title:      "Scenario Name",
-        multiple:   false,
-        required:   false,
-        defaultValue: empty
-    ]
-    
-    def pageProperties = [
-        name:       "pageSetupScenarioB",
-    ]
-
-    return dynamicPage(pageProperties) {
-section("Name your scenario") {
-            input inputScenarioNameB
-        }
-
-section("Devices included in the scenario") {
-            input inputMotionB
-                       input inputAccelerationB
-                       input inputContactB
-            input inputLockB
-            input inputLightsB
-            input inputDimmersB
-            }
-
-section("Scenario settings") {
-            input inputLevelB
-            input inputTurnOnLuxB
-            input inputLuxSensorsB
-            input inputTurnOffB
-            }
-            
-section("Scenario restrictions") {    
-                       input inputTriggerOnceB
-            input inputSwitchDisableB
-            href "timeIntervalInputB", title: "Only during a certain time...", description: getTimeLabel(B_timeStart, B_timeEnd), state: greyedOutTime(B_timeStart, B_timeEnd), refreshAfterSelection:true
-            input inputDayB
-            input inputModeB
-            }
-
-section("Help") {
-            paragraph helpText()
-            }
-    }
-}
-
-def pageSetupScenarioC() {
-
-    def inputLightsC = [
-        name:       "C_switches",
-        type:       "capability.switch",
-        title:      "Control the following switches...",
-        multiple:   true,
-        required:   false
-    ]
-    def inputDimmersC = [
-        name:       "C_dimmers",
-        type:       "capability.switchLevel",
-        title:      "Dim the following...",
-        multiple:   true,
-        required:   false
-    ]
-
-    def inputMotionC = [
-        name:       "C_motion",
-        type:       "capability.motionSensor",
-        title:      "Using these motion sensors...",
-        multiple:   true,
-        required:   false
-    ]
-    
-       def inputAccelerationC = [
-               name:       "C_acceleration",
-               type:       "capability.accelerationSensor",
-               title:      "Or using these acceleration sensors...",
-               multiple:   true,
-               required:   false
-       ]
-    def inputContactC = [
-        name:       "C_contact",
-        type:       "capability.contactSensor",
-        title:      "Or using these contact sensors...",
-        multiple:   true,
-        required:   false
-    ]
-    
-    def inputTriggerOnceC = [
-       name:       "C_triggerOnce",
-        type:       "bool",
-        title:      "Trigger only once per day...",
-        defaultValue:false
-    ]
-    
-    def inputSwitchDisableC = [
-       name:       "C_switchDisable",
-        type:       "bool",
-        title:      "Stop triggering if physical switches/dimmers are turned off...",
-        defaultValue:false
-    ]
-    
-    def inputLockC = [
-        name:       "C_lock",
-        type:       "capability.lock",
-        title:      "Or using these locks...",
-        multiple:   true,
-        required:   false
-    ]
-    
-    def inputModeC = [
-        name:       "C_mode",
-        type:       "mode",
-        title:      "Only during the following modes...",
-        multiple:   true,
-        required:   false
-    ]
-    
-    def inputDayC = [
-        name:       "C_day",
-        type:       "enum",
-        options: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
-        title:      "Only on certain days of the week...",
-        multiple:   true,
-        required:   false
-    ]
-    
-    def inputLevelC = [
-        name:       "C_level",
-        type:       "enum",
-        options: [[10:"10%"],[20:"20%"],[30:"30%"],[40:"40%"],[50:"50%"],[60:"60%"],[70:"70%"],[80:"80%"],[90:"90%"],[100:"100%"]],
-        title:      "Set dimmers to this level",
-        multiple:   false,
-        required:   false
-    ]
-    
-    def inputTurnOffC = [
-        name:       "C_turnOff",
-        type:       "number",
-        title:      "Turn off this scenario after motion stops or doors close/lock (minutes)...",
-        multiple:   false,
-        required:   false
-    ]
-    
-    def inputScenarioNameC = [
-        name:       "ScenarioNameC",
-        type:       "text",
-        title:      "Scenario Name",
-        multiple:   false,
-        required:   false,
-        defaultValue: empty
-    ]
-    
-    def inputTurnOnLuxC = [
-        name:       "C_turnOnLux",
-        type:       "number",
-        title:      "Only run this scenario if lux is below...",
-        multiple:   false,
-        required:   false
-    ]
-    
-    def inputLuxSensorsC = [
-        name:       "C_luxSensors",
-        type:       "capability.illuminanceMeasurement",
-        title:      "On these lux sensors",
-        multiple:   false,
-        required:   false
-    ]
-    
-    def pageProperties = [
-        name:       "pageSetupScenarioC",
-    ]
-
-    return dynamicPage(pageProperties) {
-        section("Name your scenario") {
-            input inputScenarioNameC
-        }
-
-section("Devices included in the scenario") {
-            input inputMotionC
-                       input inputAccelerationC
-            input inputContactC
-            input inputLockC
-            input inputLightsC
-            input inputDimmersC
-            }
-
-section("Scenario settings") {
-            input inputLevelC
-            input inputTurnOnLuxC
-            input inputLuxSensorsC
-            input inputTurnOffC
-                       }
-            
-section("Scenario restrictions") { 
-                       input inputTriggerOnceC
-            input inputSwitchDisableC
-            href "timeIntervalInputC", title: "Only during a certain time...", description: getTimeLabel(C_timeStart, C_timeEnd), state: greyedOutTime(C_timeStart, C_timeEnd), refreshAfterSelection:true
-            input inputDayC
-            input inputModeC
-            }
-
-section("Help") {
-            paragraph helpText()
-            }
-    }
-}
-
-def pageSetupScenarioD() {
-
-    def inputLightsD = [
-        name:       "D_switches",
-        type:       "capability.switch",
-        title:      "Control the following switches...",
-        multiple:   true,
-        required:   false
-    ]
-    def inputDimmersD = [
-        name:       "D_dimmers",
-        type:       "capability.switchLevel",
-        title:      "Dim the following...",
-        multiple:   true,
-        required:   false
-    ]
-
-    def inputMotionD = [
-        name:       "D_motion",
-        type:       "capability.motionSensor",
-        title:      "Using these motion sensors...",
-        multiple:   true,
-        required:   false
-    ]
-    
-       def inputAccelerationD = [
-               name:       "D_acceleration",
-               type:       "capability.accelerationSensor",
-               title:      "Or using these acceleration sensors...",
-               multiple:   true,
-               required:   false
-       ]
-    def inputContactD = [
-        name:       "D_contact",
-        type:       "capability.contactSensor",
-        title:      "Or using these contact sensors...",
-        multiple:   true,
-        required:   false
-    ]
-    
-    def inputLockD = [
-        name:       "D_lock",
-        type:       "capability.lock",
-        title:      "Or using these locks...",
-        multiple:   true,
-        required:   false
-    ]
-    
-    def inputModeD = [
-        name:       "D_mode",
-        type:       "mode",
-        title:      "Only during the following modes...",
-        multiple:   true,
-        required:   false
-    ]
-    
-    def inputTriggerOnceD = [
-       name:       "D_triggerOnce",
-        type:       "bool",
-        title:      "Trigger only once per day...",
-        defaultValue:false
-    ]
-    
-    def inputSwitchDisableD = [
-       name:       "D_switchDisable",
-        type:       "bool",
-        title:      "Stop triggering if physical switches/dimmers are turned off...",
-        defaultValue:false
-    ]
-    
-    def inputDayD = [
-        name:       "D_day",
-        type:       "enum",
-        options: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
-        title:      "Only on certain days of the week...",
-        multiple:   true,
-        required:   false
-    ]
-    
-    
-    def inputLevelD = [
-        name:       "D_level",
-        type:       "enum",
-        options: [[10:"10%"],[20:"20%"],[30:"30%"],[40:"40%"],[50:"50%"],[60:"60%"],[70:"70%"],[80:"80%"],[90:"90%"],[100:"100%"]],
-        title:      "Set dimmers to this level",
-        multiple:   false,
-        required:   false
-    ]
-    
-    def inputTurnOffD = [
-        name:       "D_turnOff",
-        type:       "number",
-        title:      "Turn off this scenario after motion stops, doors close or close/lock (minutes)...",
-        multiple:   false,
-        required:   false
-    ]
-    
-    def inputScenarioNameD = [
-        name:       "ScenarioNameD",
-        type:       "text",
-        title:      "Scenario Name",
-        multiple:   false,
-        required:   false,
-        defaultValue: empty
-    ]
-    
-    def inputTurnOnLuxD = [
-        name:       "D_turnOnLux",
-        type:       "number",
-        title:      "Only run this scenario if lux is below...",
-        multiple:   false,
-        required:   false
-    ]
-    
-    def inputLuxSensorsD = [
-        name:       "D_luxSensors",
-        type:       "capability.illuminanceMeasurement",
-        title:      "On these lux sensors",
-        multiple:   false,
-        required:   false
-    ]
-
-    def pageProperties = [
-        name:       "pageSetupScenarioD",
-    ]
-
-    return dynamicPage(pageProperties) {
-        section("Name your scenario") {
-            input inputScenarioNameD
-        }
-
-section("Devices included in the scenario") {
-            input inputMotionD
-                       input inputAccelerationD
-               input inputContactD
-            input inputLockD
-            input inputLightsD
-            input inputDimmersD
-            }
 
-section("Scenario settings") {
-            input inputLevelD
-            input inputTurnOnLuxD
-            input inputLuxSensorsD
-            input inputTurnOffD
-                       }
-            
-section("Scenario restrictions") {    
-                       input inputTriggerOnceD
-            input inputSwitchDisableD
-            href "timeIntervalInputD", title: "Only during a certain time", description: getTimeLabel(D_timeStart, D_timeEnd), state: greyedOutTime(D_timeStart, D_timeEnd), refreshAfterSelection:true
-            input inputDayD
-            input inputModeD
-            }
-
-section("Help") {
-            paragraph helpText()
-            }
-    }
-}
 
 def installed() {
     initialize()
@@ -737,107 +257,28 @@ def updated() {
 
 def initialize() {
 
-midNightReset()
-
-if(A_motion) {
-       subscribe(settings.A_motion, "motion", onEventA)
-}
-
-if(A_acceleration) {
-       subscribe(settings.A_acceleration, "acceleration", onEventA)
-}
-
-if(A_contact) {
-       subscribe(settings.A_contact, "contact", onEventA)
-}
-
-if(A_lock) {
-       subscribe(settings.A_lock, "lock", onEventA)
-}
-
-if(A_switchDisable) {
-       subscribe(A_switches, "switch.off", onPressA)
-    subscribe(A_dimmers, "switch.off", onPressA)
-}
-
-if(A_mode) {
-    subscribe(location, onEventA)
-}
-
-if(B_motion) {
-       subscribe(settings.B_motion, "motion", onEventB)
-}
-
-if(B_acceleration) {
-       subscribe(settings.B_acceleration, "acceleration", onEventB)
-}
-
-if(B_contact) {
-       subscribe(settings.B_contact, "contact", onEventB)
-}
-
-if(B_lock) {
-       subscribe(settings.B_lock, "lock", onEventB)
-}
-
-if(B_switchDisable) {
-       subscribe(B_switches, "switch.off", onPressB)
-    subscribe(B_dimmers, "switch.off", onPressB)
-}
-
-if(B_mode) {
-    subscribe(location, onEventB)
-}
-
-if(C_motion) {
-       subscribe(settings.C_motion, "motion", onEventC)
-}
-
-if(C_acceleration) {
-       subscribe(settings.C_acceleration, "acceleration", onEventC)
-}
-
-if(C_contact) {
-       subscribe(settings.C_contact, "contact", onEventC)
-}
+       midNightReset()
 
-if(C_lock) {
-       subscribe(settings.C_lock, "lock", onEventC)
-}
-
-if(C_switchDisable) {
-       subscribe(C_switches, "switch.off", onPressC)
-    subscribe(C_dimmers, "switch.off", onPressC)
-}
-
-if(C_mode) {
-    subscribe(location, onEventC)
-}
-
-if(D_motion) {
-       subscribe(settings.D_motion, "motion", onEventD)
-}
-
-if(D_acceleration) {
-       subscribe(settings.D_acceleration, "acceleration", onEventD)
-}
+       if(A_motion) {
+               subscribe(settings.A_motion, "motion", onEventA)
+       }
 
-if(D_contact) {
-       subscribe(settings.D_contact, "contact", onEventD)
-}
+       if(A_acceleration) {
+               subscribe(settings.A_acceleration, "acceleration", onEventA)
+       }
 
-if(D_lock) {
-       subscribe(settings.D_lock, "lock", onEventD)
-}
+       if(A_contact) {
+               subscribe(settings.A_contact, "contact", onEventA)
+       }
 
-if(D_switchDisable) {
-       subscribe(D_switches, "switch.off", onPressD)
-    subscribe(D_dimmers, "switch.off", onPressD)
-}
+       if(A_lock) {
+               subscribe(settings.A_lock, "lock", onEventA)
+       }
 
-if(D_mode) {
-    subscribe(location, onEventD)
-}
+       if(A_switchDisable) {
+               subscribe(A_switches, "switch.off", onPressA)
+           subscribe(A_dimmers, "switch.off", onPressA)
+       }
 
 }
 
@@ -912,219 +353,6 @@ if ((!A_triggerOnce || (A_triggerOnce && !state.A_triggered)) && (!A_switchDisab
 }
 }}}
 
-def onEventB(evt) {
-
-if ((!B_triggerOnce || (B_triggerOnce && !state.B_triggered)) && (!B_switchDisable || (B_switchDisable && !state.B_triggered))) { //Checks to make sure this scenario should be triggered more then once in a day
-if ((!B_mode ||B_mode.contains(location.mode)) && getTimeOk (B_timeStart, B_timeEnd) && getDayOk(B_day)) { //checks to make sure we are not opperating outside of set restrictions.
-if ((!B_luxSensors) || (B_luxSensors.latestValue("illuminance") <= B_turnOnLux)) { //checks to make sure illimunance is either not cared about or if the value is within the restrictions
-def B_levelOn = B_level as Integer
-
-//Check states of each device to see if they are to be ignored or if they meet the requirments of the app to produce an action.
-if (getInputOk(B_motion, B_contact, B_lock, B_acceleration)) {
-               
-               log.debug("Motion, Door Open or Unlock Detected Running '${ScenarioNameB}'")
-                       settings.B_dimmers?.setLevel(B_levelOn)
-            settings.B_switches?.on()
-            if (B_triggerOnce){
-               state.B_triggered = true
-                if (!B_turnOff) {
-                                       runOnce (getMidnight(), midNightReset)
-                }
-            }
-               if (state.B_timerStart) {
-               unschedule(delayTurnOffB)
-               state.B_timerStart = false
-               }
-}
-
-//if none of the above paramenters meet the expectation of the app then turn off
-else {
-       if (settings.B_turnOff) {
-                       runIn(B_turnOff * 60, "delayTurnOffB")
-               state.B_timerStart = true
-        }
-        
-        else {
-               settings.B_switches?.off()
-                       settings.B_dimmers?.setLevel(0)
-            if (state.B_triggered) {
-                       runOnce (getMidnight(), midNightReset)
-               }
-        }
-       
-}
-}
-}
-else{
-log.debug("Motion, Contact or Unlock detected outside of mode or time/day restriction.  Not running scenario.")
-}
-}
-}
-
-def delayTurnOffB(){
-       settings.B_switches?.off()
-       settings.B_dimmers?.setLevel(0)
-       state.B_timerStart = false
-    if (state.B_triggered) {
-       runOnce (getMidnight(), midNightReset) 
-       }
-}
-
-//when physical switch is actuated disable the scenario
-def onPressB(evt) {
-if ((!B_mode ||B_mode.contains(location.mode)) && getTimeOk (B_timeStart, B_timeEnd) && getDayOk(B_day)) {  //checks to make sure we are not opperating outside of set restrictions.
-if ((!B_luxSensors) || (B_luxSensors.latestValue("illuminance") <= B_turnOnLux)) {
-if ((!B_triggerOnce || (B_triggerOnce && !state.B_triggered)) && (!B_switchDisable || (B_switchDisable && !state.B_triggered))) {
-       if (evt.physical){
-       state.B_triggered = true
-        unschedule(delayTurnOffB)
-        runOnce (getMidnight(), midNightReset)
-        log.debug "Physical switch in '${ScenarioNameB}' pressed. Triggers for this scenario disabled."
-       }
-}
-}}}
-
-def onEventC(evt) {
-
-if ((!C_triggerOnce || (C_triggerOnce && !state.C_triggered)) && (!C_switchDisable || (C_switchDisable && !state.C_triggered))) { //Checks to make sure this scenario should be triggered more then once in a day
-if ((!C_mode || C_mode.contains(location.mode)) && getTimeOk (C_timeStart, C_timeEnd) && getDayOk(C_day) && !state.C_triggered){ //checks to make sure we are not opperating outside of set restrictions.
-if ((!C_luxSensors) || (C_luxSensors.latestValue("illuminance") <= C_turnOnLux)){ //checks to make sure illimunance is either not cared about or if the value is within the restrictions
-def C_levelOn = settings.C_level as Integer
-
-//Check states of each device to see if they are to be ignored or if they meet the requirments of the app to produce an action.
-if (getInputOk(C_motion, C_contact, C_lock, C_acceleration)) {
-               log.debug("Motion, Door Open or Unlock Detected Running '${ScenarioNameC}'")
-            settings.C_dimmers?.setLevel(C_levelOn)
-            settings.C_switches?.on()
-            if (C_triggerOnce){
-               state.C_triggered = true
-                if (!C_turnOff) {
-                                       runOnce (getMidnight(), midNightReset)
-                }
-            }
-               if (state.C_timerStart){
-               unschedule(delayTurnOffC)
-               state.C_timerStart = false
-               }
-}
-
-//if none of the above paramenters meet the expectation of the app then turn off
-else {
-       if (settings.C_turnOff) {
-               runIn(C_turnOff * 60, "delayTurnOffC")
-        state.C_timerStart = true
-        }
-        else {
-        settings.C_switches?.off()
-               settings.C_dimmers?.setLevel(0)
-               if (state.C_triggered) {
-                       runOnce (getMidnight(), midNightReset)
-               }
-        }
-       
-}
-}
-}
-else{
-log.debug("Motion, Contact or Unlock detected outside of mode or time/day restriction.  Not running scenario.")
-}
-}
-}
-
-def delayTurnOffC(){
-       settings.C_switches?.off()
-       settings.C_dimmers?.setLevel(0)
-       state.C_timerStart = false
-       if (state.C_triggered) {
-       runOnce (getMidnight(), midNightReset)
-    }
-
-}
-
-//when physical switch is actuated disable the scenario
-def onPressC(evt) {
-if ((!C_mode || C_mode.contains(location.mode)) && getTimeOk (C_timeStart, C_timeEnd) && getDayOk(C_day) && !state.C_triggered){
-if ((!C_luxSensors) || (C_luxSensors.latestValue("illuminance") <= C_turnOnLux)){
-if ((!C_triggerOnce || (C_triggerOnce && !state.C_triggered)) && (!C_switchDisable || (C_switchDisable && !state.C_triggered))) {
-       if (evt.physical){
-       state.C_triggered = true
-        unschedule(delayTurnOffC)
-        runOnce (getMidnight(), midNightReset)
-        log.debug "Physical switch in '${ScenarioNameC}' pressed. Triggers for this scenario disabled."
-       }
-}
-}}}
-
-def onEventD(evt) {
-
-if ((!D_triggerOnce || (D_triggerOnce && !state.D_triggered)) && (!D_switchDisable || (D_switchDisable && !state.D_triggered))) { //Checks to make sure this scenario should be triggered more then once in a day
-if ((!D_mode || D_mode.contains(location.mode)) && getTimeOk (D_timeStart, D_timeEnd) && getDayOk(D_day) && !state.D_triggered){ //checks to make sure we are not opperating outside of set restrictions.
-if ((!D_luxSensors) || (D_luxSensors.latestValue("illuminance") <= D_turnOnLux)){ //checks to make sure illimunance is either not cared about or if the value is within the restrictions
-def D_levelOn = D_level as Integer
-
-//Check states of each device to see if they are to be ignored or if they meet the requirments of the app to produce an action.
-if (getInputOk(D_motion, D_contact, D_lock, D_acceleration)) {
-               log.debug("Motion, Door Open or Unlock Detected Running '${ScenarioNameD}'")
-            settings.D_dimmers?.setLevel(D_levelOn)
-            settings.D_switches?.on()
-            if (D_triggerOnce){
-               state.D_triggered = true
-                if (!D_turnOff) {
-                                       runOnce (getMidnight(), midNightReset)
-                }
-            }
-               if (state.D_timerStart){
-               unschedule(delayTurnOffD)
-               state.D_timerStart = false
-               }
-}
-
-//if none of the above paramenters meet the expectation of the app then turn off
-else {
-       if (settings.D_turnOff) {
-               runIn(D_turnOff * 60, "delayTurnOffD")
-        state.D_timerStart = true
-        }
-        else {
-        settings.D_switches?.off()
-               settings.D_dimmers?.setLevel(0)
-               if (state.D_triggered) {
-                       runOnce (getMidnight(), midNightReset)
-               }
-        }
-}
-}
-}
-else{
-log.debug("Motion, Contact or Unlock detected outside of mode or time/day restriction.  Not running scenario.")
-}
-}
-}
-
-def delayTurnOffD(){
-       settings.D_switches?.off()
-       settings.D_dimmers?.setLevel(0)
-       state.D_timerStart = false
-       if (state.D_triggered) {
-       runOnce (getMidnight(), midNightReset)
-    }
-
-}
-
-//when physical switch is actuated disable the scenario
-def onPressD(evt) {
-if ((!D_mode || D_mode.contains(location.mode)) && getTimeOk (D_timeStart, D_timeEnd) && getDayOk(D_day) && !state.D_triggered){ //checks to make sure we are not opperating outside of set restrictions.
-if ((!D_luxSensors) || (D_luxSensors.latestValue("illuminance") <= D_turnOnLux)){
-if ((!D_triggerOnce || (D_triggerOnce && !state.D_triggered)) && (!D_switchDisable || (D_switchDisable && !state.D_triggered))) {  
-       if (evt.physical){
-       state.D_triggered = true
-        unschedule(delayTurnOffD)
-        runOnce (getMidnight(), midNightReset)
-        log.debug "Physical switch in '${ScenarioNameD}' pressed. Triggers for this scenario disabled."
-       }
-}
-}}}
-
 //Common Methods
 
 //resets once a day trigger at midnight so trigger can be ran again the next day.
@@ -1283,29 +511,3 @@ private getDayOk(dayList) {
        }
     result
 }
-
-
-page(name: "timeIntervalInputA", title: "Only during a certain time", refreshAfterSelection:true) {
-               section {
-                       input "A_timeStart", "time", title: "Starting", required: false, refreshAfterSelection:true
-                       input "A_timeEnd", "time", title: "Ending", required: false, refreshAfterSelection:true
-               }
-        }  
-page(name: "timeIntervalInputB", title: "Only during a certain time", refreshAfterSelection:true) {
-               section {
-                       input "B_timeStart", "time", title: "Starting", required: false, refreshAfterSelection:true
-                       input "B_timeEnd", "time", title: "Ending", required: false, refreshAfterSelection:true
-               }
-        }  
-page(name: "timeIntervalInputC", title: "Only during a certain time", refreshAfterSelection:true) {
-               section {
-                       input "C_timeStart", "time", title: "Starting", required: false, refreshAfterSelection:true
-                       input "C_timeEnd", "time", title: "Ending", required: false, refreshAfterSelection:true
-               }
-        }         
-page(name: "timeIntervalInputD", title: "Only during a certain time", refreshAfterSelection:true) {
-               section {
-                       input "D_timeStart", "time", title: "Starting", required: false, refreshAfterSelection:true
-                       input "D_timeEnd", "time", title: "Ending", required: false, refreshAfterSelection:true
-               }
-        }
\ No newline at end of file