Add a method to SwitchLevel class!
authoramiraj <amiraj.95@uci.edu>
Thu, 8 Aug 2019 18:47:23 +0000 (11:47 -0700)
committeramiraj <amiraj.95@uci.edu>
Thu, 8 Aug 2019 18:47:23 +0000 (11:47 -0700)
SwitchLevel/SwitchLevel.groovy
SwitchLevel/SwitchLevels.groovy

index 32ae591..7db6a16 100644 (file)
@@ -47,6 +47,11 @@ public class SwitchLevel {
                        sendEvent([name: "saturation", value: "$saturation", deviceId: this.id, descriptionText: "",
                                   displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
                }
+       }
+
+       def setLevel(String level) {
+               def newLevel = level.toInteger()
+               setLevel(newLevel)
        }       
 
        def setLevel(int level) {
index 5d02053..d9d2e26 100644 (file)
@@ -76,6 +76,11 @@ public class SwitchLevels {
                        switchLevels[0].setColor(metaData)
                }
        }
+       
+       def setLevel(String level) {
+               def newLevel = level.toInteger()
+               setLevel(newLevel)
+       }
 
        def setLevel(int level) {
                if (this.level != level) {