Skip to content

Commit cf5d4ab

Browse files
lasotejabesq
authored andcommitted
Avoid duplicated module names
1 parent fda00a4 commit cf5d4ab

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

smart_home/WeatherStation.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(self, authData, urlReq=None):
1818
self.urlReq = urlReq or _GETMEASURE_REQ
1919
self.getAuthToken = authData.accessToken
2020
postParams = {
21-
"access_token" : self.getAuthToken
21+
"access_token": self.getAuthToken
2222
}
2323
resp = postRequest(self.urlReq, postParams)
2424
self.rawData = resp['body']['devices']
@@ -36,13 +36,13 @@ def __init__(self, authData, urlReq=None):
3636
self.default_station = list(self.stations.values())[0]['station_name']
3737

3838
def modulesNamesList(self, station=None):
39-
res = [m['module_name'] for m in self.modules.values()]
39+
res = set([m['module_name'] for m in self.modules.values()])
4040
if station:
41-
res.append(self.stationByName(station)['module_name'])
41+
res.add(self.stationByName(station)['module_name'])
4242
else:
4343
for id,station in self.stations.items():
44-
res.append(station['module_name'])
45-
return res
44+
res.add(station['module_name'])
45+
return list(res)
4646

4747
def stationByName(self, station=None):
4848
if not station : station = self.default_station

0 commit comments

Comments
 (0)