mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-08 05:31:56 +00:00
Merge pull request #542 from larsfinander/lifxExceptionFix
DVCSMP-1505 LIFX setColor() throws exception
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user