Merge pull request #116 from juano2310/PR_hue

atomicState to state
This commit is contained in:
Juan Pablo Risso
2015-09-10 15:11:23 -04:00

View File

@@ -64,9 +64,10 @@ def bridgeDiscovery(params=[:])
def options = bridges ?: [] def options = bridges ?: []
def numFound = options.size() ?: 0 def numFound = options.size() ?: 0
if (numFound == 0 && state.bridgeRefreshCount > 5) { if (numFound == 0 && state.bridgeRefreshCount > 25) {
log.trace "Cleaning old bridges memory" log.trace "Cleaning old bridges memory"
atomicState.bridges = [:] state.bridges = [:]
state.bridgeRefreshCount = 0
} }
subscribe(location, null, locationHandler, [filterEvents:false]) subscribe(location, null, locationHandler, [filterEvents:false])
@@ -216,11 +217,11 @@ Map bulbsDiscovered() {
} }
def getHueBulbs() { def getHueBulbs() {
atomicState.bulbs = atomicState.bulbs ?: [:] state.bulbs = state.bulbs ?: [:]
} }
def getHueBridges() { def getHueBridges() {
atomicState.bridges = atomicState.bridges ?: [:] state.bridges = state.bridges ?: [:]
} }
def getVerifiedHueBridges() { def getVerifiedHueBridges() {
@@ -258,7 +259,7 @@ def manualRefresh() {
} }
def uninstalled(){ def uninstalled(){
atomicState.bridges = [:] state.bridges = [:]
state.username = null state.username = null
} }
@@ -275,8 +276,8 @@ def bulbListHandler(hub, data) {
if (v instanceof Map) if (v instanceof Map)
bulbs[k] = [id: k, name: v.name, type: v.type, hub:hub] bulbs[k] = [id: k, name: v.name, type: v.type, hub:hub]
} }
atomicState.bulbs = bulbs state.bulbs = bulbs
msg = "${bulbs.size()} bulbs found. $atomicState.bulbs" msg = "${bulbs.size()} bulbs found. $state.bulbs"
} }
return msg return msg
} }