From 3657144a5349dbdfe3159b4ba1a47a6a2723f002 Mon Sep 17 00:00:00 2001 From: Uladzimir Kazakevich Date: Mon, 16 Jul 2018 23:59:48 +0300 Subject: [PATCH] Fix 'modules' error in case there is only main station module configured --- smart_home/WeatherStation.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/smart_home/WeatherStation.py b/smart_home/WeatherStation.py index 2e7ea0a75..6b3fec90d 100644 --- a/smart_home/WeatherStation.py +++ b/smart_home/WeatherStation.py @@ -26,6 +26,8 @@ def __init__(self, authData): self.stations = { d['_id'] : d for d in self.rawData } self.modules = dict() for i in range(len(self.rawData)): + if 'modules' not in self.rawData[i]: + self.rawData[i]['modules'] = [ self.rawData[i] ] for m in self.rawData[i]['modules']: if 'module_name' not in m: continue @@ -190,4 +192,4 @@ class DeviceList(WeatherStationData): """ warnings.warn("The 'DeviceList' class was renamed 'WeatherStationData'", DeprecationWarning ) - pass \ No newline at end of file + pass