Merge pull request #1315 from larsfinander/DVCSMP-2101_Philips_Hue_Exception_lights_removed__staging

DVCSMP-2101 Philips Hue: Exception if lights removed outside of ST
This commit is contained in:
Lars Finander
2016-10-05 13:34:50 -06:00
committed by GitHub

View File

@@ -1194,7 +1194,7 @@ private poll() {
} }
private isOnline(id) { private isOnline(id) {
return (state.bulbs[id].online != null && state.bulbs[id].online) || state.bulbs[id].online == null return (state.bulbs[id]?.online != null && state.bulbs[id]?.online) || state.bulbs[id]?.online == null
} }
private put(path, body) { private put(path, body) {
@@ -1261,7 +1261,7 @@ def convertBulbListToMap() {
try { try {
if (state.bulbs instanceof java.util.List) { if (state.bulbs instanceof java.util.List) {
def map = [:] def map = [:]
state.bulbs.unique {it.id}.each { bulb -> state.bulbs?.unique {it.id}.each { bulb ->
map << ["${bulb.id}":["id":bulb.id, "name":bulb.name, "type": bulb.type, "modelid": bulb.modelid, "hub":bulb.hub, "online": bulb.online]] map << ["${bulb.id}":["id":bulb.id, "name":bulb.name, "type": bulb.type, "modelid": bulb.modelid, "hub":bulb.hub, "online": bulb.online]]
} }
state.bulbs = map state.bulbs = map