From: amiraj Date: Thu, 8 Aug 2019 18:47:23 +0000 (-0700) Subject: Add a method to SwitchLevel class! X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5661e02c23e94167de4f76e3ba0eb53e2d69fc94;p=smartthings-infrastructure.git Add a method to SwitchLevel class! --- diff --git a/SwitchLevel/SwitchLevel.groovy b/SwitchLevel/SwitchLevel.groovy index 32ae591..7db6a16 100644 --- a/SwitchLevel/SwitchLevel.groovy +++ b/SwitchLevel/SwitchLevel.groovy @@ -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) { diff --git a/SwitchLevel/SwitchLevels.groovy b/SwitchLevel/SwitchLevels.groovy index 5d02053..d9d2e26 100644 --- a/SwitchLevel/SwitchLevels.groovy +++ b/SwitchLevel/SwitchLevels.groovy @@ -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) {