Skip to content

Commit 39dfbe1

Browse files
author
Nicholas Silva
committed
Handle Case of Module-Less Station
1 parent 35b7ee8 commit 39dfbe1

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lnetatmo.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,14 @@ def lastData(self, station=None, exclude=0):
154154
lastD[s['module_name']]['wifi_status'] = s['wifi_status']
155155

156156
for mod in s["modules"]:
157-
ds = mod['dashboard_data']
158-
if ds['time_utc'] > limit :
159-
lastD[mod['module_name']] = ds.copy()
160-
lastD[mod['module_name']]['When'] = lastD[mod['module_name']].pop("time_utc")
161-
# For potential use, add battery and radio coverage information to module data if present
162-
for i in ('battery_vp', 'rf_status') :
163-
if i in mod : lastD[mod['module_name']][i] = mod[i]
157+
if 'dashboard_data' in mod:
158+
ds = mod['dashboard_data']
159+
if ds['time_utc'] > limit :
160+
lastD[mod['module_name']] = ds.copy()
161+
lastD[mod['module_name']]['When'] = lastD[mod['module_name']].pop("time_utc")
162+
# For potential use, add battery and radio coverage information to module data if present
163+
for i in ('battery_vp', 'rf_status') :
164+
if i in mod : lastD[mod['module_name']][i] = mod[i]
164165
return lastD
165166

166167
def checkNotUpdated(self, station=None, delay=3600):

0 commit comments

Comments
 (0)