Skip to content

Commit

Permalink
Merge pull request SmartThingsCommunity#982 from rohandesai/netatmo-h…
Browse files Browse the repository at this point in the history
…otfix

NPE fix for NetAtmo
  • Loading branch information
workingmonk committed Jun 9, 2016
2 parents 8d8b039 + e861d3c commit a94a62d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions smartapps/dianoga/netatmo-connect.src/netatmo-connect.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,10 @@ def initialize() {

settings.devices.each {
def deviceId = it
def detail = state.deviceDetail[deviceId]
def detail = state?.deviceDetail[deviceId]

try {
switch(detail.type) {
switch(detail?.type) {
case 'NAMain':
log.debug "Base station"
createChildDevice("Netatmo Basestation", deviceId, "${detail.type}.${deviceId}", detail.module_name)
Expand Down Expand Up @@ -487,12 +487,12 @@ def poll() {
log.debug "State: ${state.deviceState}"

settings.devices.each { deviceId ->
def detail = state.deviceDetail[deviceId]
def data = state.deviceState[deviceId]
def child = children.find { it.deviceNetworkId == deviceId }
def detail = state?.deviceDetail[deviceId]
def data = state?.deviceState[deviceId]
def child = children?.find { it.deviceNetworkId == deviceId }

log.debug "Update: $child";
switch(detail.type) {
switch(detail?.type) {
case 'NAMain':
log.debug "Updating NAMain $data"
child?.sendEvent(name: 'temperature', value: cToPref(data['Temperature']) as float, unit: getTemperatureScale())
Expand Down

0 comments on commit a94a62d

Please sign in to comment.