@@ -376,7 +376,7 @@ def getEcobeeDevices() {
376376
377377Map sensorsDiscovered () {
378378 def map = [:]
379- def remoteSensors = state. remoteSensors2
379+ def remoteSensors = state. remoteSensors2 ?: [:]
380380 remoteSensors. each { key , sensors ->
381381 map[key] = sensors. name
382382 }
@@ -385,7 +385,7 @@ Map sensorsDiscovered() {
385385
386386def switchesDiscovered () {
387387 def map = [:]
388- def switches = state. switchList
388+ def switches = state. switchList ?: [:]
389389 switches. each { key , ecobeeSwitch ->
390390 map[key] = ecobeeSwitch. name
391391 }
@@ -416,9 +416,9 @@ def updated() {
416416}
417417
418418def initialize () {
419- def thermostatList = state. thermostats
420- def remoteSensors = state. remoteSensors2
421- def switchList = state. switchList
419+ def thermostatList = state. thermostats ?: [:]
420+ def remoteSensors = state. remoteSensors2 ?: [:]
421+ def switchList = state. switchList ?: [:]
422422 def childThermostats = thermostats. collect { dni ->
423423 def d = getChildDevice(dni)
424424 if (! d) {
@@ -496,9 +496,9 @@ def initialize() {
496496
497497def purgeChildDevice (childDevice ) {
498498 def dni = childDevice. device. deviceNetworkId
499- def thermostatList = state. thermostats
500- def remoteSensors = state. remoteSensors2
501- def switchList = state. switchList
499+ def thermostatList = state. thermostats ?: [:]
500+ def remoteSensors = state. remoteSensors2 ?: [:]
501+ def switchList = state. switchList ?: [:]
502502 if (thermostatList[dni]) {
503503 thermostatList. remove(dni)
504504 state. thermostats = thermostatList
0 commit comments