From 42b790ef10d4a01aff6e3709bbc6c33362987c54 Mon Sep 17 00:00:00 2001 From: Lars Finander Date: Mon, 22 Feb 2016 15:11:56 -0800 Subject: [PATCH] DVCSMP-1505 LIFX setColor() throws exception -Added empty return to command methods since sendEvent is used -Added null check for hex values --- .../lifx-color-bulb.src/lifx-color-bulb.groovy | 10 +++++++++- .../lifx-white-bulb.src/lifx-white-bulb.groovy | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/devicetypes/smartthings/lifx-color-bulb.src/lifx-color-bulb.groovy b/devicetypes/smartthings/lifx-color-bulb.src/lifx-color-bulb.groovy index 551389609fe..b93235e78fb 100644 --- a/devicetypes/smartthings/lifx-color-bulb.src/lifx-color-bulb.groovy +++ b/devicetypes/smartthings/lifx-color-bulb.src/lifx-color-bulb.groovy @@ -84,6 +84,7 @@ def setHue(percentage) { log.error("Bad setHue result: [${resp.status}] ${resp.data}") } } + return [] } def setSaturation(percentage) { @@ -97,6 +98,7 @@ def setSaturation(percentage) { log.error("Bad setSaturation result: [${resp.status}] ${resp.data}") } } + return [] } def setColor(Map color) { @@ -122,13 +124,15 @@ def setColor(Map color) { parent.logErrors(logObject:log) { def resp = parent.apiPUT("/lights/${selector()}/state", [color: attrs.join(" "), power: "on"]) if (resp.status < 300) { - sendEvent(name: "color", value: color.hex) + if (color.hex) + sendEvent(name: "color", value: color.hex) sendEvent(name: "switch", value: "on") events.each { sendEvent(it) } } else { log.error("Bad setColor result: [${resp.status}] ${resp.data}") } } + return [] } def setLevel(percentage) { @@ -150,6 +154,7 @@ def setLevel(percentage) { log.error("Bad setLevel result: [${resp.status}] ${resp.data}") } } + return [] } def setColorTemperature(kelvin) { @@ -165,6 +170,7 @@ def setColorTemperature(kelvin) { } } + return [] } def on() { @@ -174,6 +180,7 @@ def on() { sendEvent(name: "switch", value: "on") } } + return [] } def off() { @@ -183,6 +190,7 @@ def off() { sendEvent(name: "switch", value: "off") } } + return [] } def poll() { diff --git a/devicetypes/smartthings/lifx-white-bulb.src/lifx-white-bulb.groovy b/devicetypes/smartthings/lifx-white-bulb.src/lifx-white-bulb.groovy index 09107c0f045..54a78dfe589 100644 --- a/devicetypes/smartthings/lifx-white-bulb.src/lifx-white-bulb.groovy +++ b/devicetypes/smartthings/lifx-white-bulb.src/lifx-white-bulb.groovy @@ -84,6 +84,7 @@ def setLevel(percentage) { log.error("Bad setLevel result: [${resp.status}] ${resp.data}") } } + return [] } def setColorTemperature(kelvin) { @@ -99,6 +100,7 @@ def setColorTemperature(kelvin) { log.error("Bad setColorTemperature result: [${resp.status}] ${resp.data}") } } + return [] } def on() { @@ -108,6 +110,7 @@ def on() { sendEvent(name: "switch", value: "on") } } + return [] } def off() { @@ -117,6 +120,7 @@ def off() { sendEvent(name: "switch", value: "off") } } + return [] } def poll() {