mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-08 21:02:56 +00:00
Merge pull request #2094 from unixbeast/iotevent_786
IOTEVENT-786 check for null/empty values before sending events
This commit is contained in:
@@ -300,15 +300,21 @@ def setColor(value) {
|
|||||||
value.hex = "#${hex(value.red)}${hex(value.green)}${hex(value.blue)}"
|
value.hex = "#${hex(value.red)}${hex(value.green)}${hex(value.blue)}"
|
||||||
}
|
}
|
||||||
|
|
||||||
sendEvent(name: "hue", value: value.hue, displayed: false)
|
if(value.hue) {
|
||||||
sendEvent(name: "saturation", value: value.saturation, displayed: false)
|
sendEvent(name: "hue", value: value.hue, displayed: false)
|
||||||
sendEvent(name: "color", value: value.hex, displayed: false)
|
}
|
||||||
if (value.level) {
|
if(value.saturation) {
|
||||||
sendEvent(name: "level", value: value.level)
|
sendEvent(name: "saturation", value: value.saturation, displayed: false)
|
||||||
}
|
}
|
||||||
if (value.switch) {
|
if(value.hex?.trim()) {
|
||||||
sendEvent(name: "switch", value: value.switch)
|
sendEvent(name: "color", value: value.hex, displayed: false)
|
||||||
}
|
}
|
||||||
|
if (value.level) {
|
||||||
|
sendEvent(name: "level", value: value.level)
|
||||||
|
}
|
||||||
|
if (value.switch?.trim()) {
|
||||||
|
sendEvent(name: "switch", value: value.switch)
|
||||||
|
}
|
||||||
|
|
||||||
sendRGB(value.rh, value.gh, value.bh)
|
sendRGB(value.rh, value.gh, value.bh)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user