From 5661e02c23e94167de4f76e3ba0eb53e2d69fc94 Mon Sep 17 00:00:00 2001 From: amiraj Date: Thu, 8 Aug 2019 11:47:23 -0700 Subject: [PATCH] Add a method to SwitchLevel class! --- SwitchLevel/SwitchLevel.groovy | 5 +++++ SwitchLevel/SwitchLevels.groovy | 5 +++++ 2 files changed, 10 insertions(+) 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) { -- 2.34.1