From 40514b8f55884eca3481206ef51d9cb31228482b Mon Sep 17 00:00:00 2001 From: David Hastings Date: Thu, 15 Jun 2017 15:03:45 -0500 Subject: [PATCH] Correct scope of value variable The scope of `value` was incorrect, thus leading to incorrect "empty" values. --- .../sticks18/dresden-fls-pp.src/dresden-fls-pp.groovy | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/devicetypes/sticks18/dresden-fls-pp.src/dresden-fls-pp.groovy b/devicetypes/sticks18/dresden-fls-pp.src/dresden-fls-pp.groovy index 85c15e5..9b710ed 100644 --- a/devicetypes/sticks18/dresden-fls-pp.src/dresden-fls-pp.groovy +++ b/devicetypes/sticks18/dresden-fls-pp.src/dresden-fls-pp.groovy @@ -197,13 +197,14 @@ def parse(String description) { } } else { - def name = description?.startsWith("on/off: ") ? "switch" : null + def name = description?.startsWith("on/off: ") ? "switch" : "unknown" + def value = null if (name == "switch") { - def value = (description?.endsWith(" 1") ? "on" : "off") + value = (description?.endsWith(" 1") ? "on" : "off") log.debug value sendEvent(name: "switchColor", value: (value == "off" ? "off" : device.currentValue("colorName")), displayed: false) } - else { def value = null } + else { value = null } def result = createEvent(name: name, value: value) log.debug "Parse returned ${result?.descriptionText}" return result