Update gentle-wake-up.groovy
authorSeyed Amir Hossein Aqajari <amiraj.95@uci.edu>
Mon, 5 Aug 2019 23:02:59 +0000 (16:02 -0700)
committerGitHub Enterprise <noreply@github.uci.edu>
Mon, 5 Aug 2019 23:02:59 +0000 (16:02 -0700)
official/gentle-wake-up.groovy

index d8c346f463ea83fabbcfadb20b94621f2fc6827d..d4d0c7209d9c697127a8efcf1ff11283df318f15 100755 (executable)
@@ -295,13 +295,13 @@ private initialize() {
                subscribe(dimmers, "switch.off", stopDimmersHandler)
        }
 
                subscribe(dimmers, "switch.off", stopDimmersHandler)
        }
 
-       if (!getAllChildDevices()) {
+       /*if (!getAllChildDevices()) {
                // create controller device and set name to the label used here
                def dni = "${new Date().getTime()}"
                log.debug "app.label: ${app.label}"
                addChildDevice("smartthings", "Gentle Wake Up Controller", dni, null, ["label": app.label])
                state.controllerDni = dni
                // create controller device and set name to the label used here
                def dni = "${new Date().getTime()}"
                log.debug "app.label: ${app.label}"
                addChildDevice("smartthings", "Gentle Wake Up Controller", dni, null, ["label": app.label])
                state.controllerDni = dni
-       }
+       }*/
 }
 
 def appHandler(evt) {
 }
 
 def appHandler(evt) {
@@ -564,17 +564,14 @@ def updateDimmers(percentComplete) {
 
                        def shouldChangeColors = (colorize && colorize != "false")
 
 
                        def shouldChangeColors = (colorize && colorize != "false")
 
-                       if (shouldChangeColors && hasSetColorCommand(dimmer)) {
+                       if (shouldChangeColors/*&& hasSetColorCommand(dimmer)*/) {
                                def hue = getHue(dimmer, nextLevel)
                                log.debug "Setting ${deviceLabel(dimmer)} level to ${nextLevel} and hue to ${hue}"
                                dimmer.setColor([hue: hue, saturation: 100, level: nextLevel])
                                def hue = getHue(dimmer, nextLevel)
                                log.debug "Setting ${deviceLabel(dimmer)} level to ${nextLevel} and hue to ${hue}"
                                dimmer.setColor([hue: hue, saturation: 100, level: nextLevel])
-                       } else if (hasSetLevelCommand(dimmer)) {
+                       } else {
                                log.debug "Setting ${deviceLabel(dimmer)} level to ${nextLevel}"
                                dimmer.setLevel(nextLevel)
                                log.debug "Setting ${deviceLabel(dimmer)} level to ${nextLevel}"
                                dimmer.setLevel(nextLevel)
-                       } else {
-                               log.warn "${deviceLabel(dimmer)} does not have setColor or setLevel commands."
                        }
                        }
-
                }
        }
 
                }
        }