Skip to content

Commit afe6d46

Browse files
authored
Update lnetatmo.py
some rewrite for successful selftest
1 parent af6ed09 commit afe6d46

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lnetatmo.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
'NSD' : ["smoke sensor", 'Home + Security'],
132132
'NHC' : ["home coach", 'Aircare'],
133133
'NIS' : ["indoor sirene", 'Home + Security'],
134+
'NDL' : ["Doorlock", 'Home + Security'],
134135

135136
'NLC' : ["Cable Outlet", 'Home+Control'],
136137
'NLE' : ["Ecometer", 'Home+Control'],
@@ -643,26 +644,24 @@ def __init__(self, authData, home=None):
643644
resp = postRequest("Home data", _GETHOMEDATA_REQ, postParams)
644645
self.rawData = resp['body']
645646
# Collect homes
646-
self.homes = { d['id'] : d for d in self.rawData['homes'] }
647-
# FIXME : Doesn't use the home parameter to select the appropriate home !
648-
for k, v in self.homes.items():
649-
self.homeid = k
650-
C = v.get('cameras')
651-
P = v.get('persons')
652-
S = v.get('smokedetectors')
647+
self.homes = self.rawData['homes'][0]
653648
for d in self.rawData['homes'] :
654649
if home == d['name']:
655650
self.homes = d
656651
else:
657652
pass
658653
#
654+
#print (self.homes.keys())
655+
#dict_keys(['id', 'name', 'persons', 'place', 'cameras', 'smokedetectors', 'events'])
656+
self.homeid = self.homes['id']
659657
C = self.homes['cameras']
660658
P = self.homes['persons']
661659
S = self.homes['smokedetectors']
662660
E = None
663661
# events not always in self.homes
664662
if 'events' in self.homes.keys():
665663
E = v.get('events')
664+
#
666665
if not S:
667666
logger.warning('No smoke detector found')
668667
if not C:
@@ -674,7 +673,7 @@ def __init__(self, authData, home=None):
674673
# if not (C or P or S or E):
675674
# raise NoDevice("No device found in home %s" % k)
676675
if S or C or P or E:
677-
self.default_home = home or list(self.homes.values())[0]['name']
676+
self.default_home = home or self.homes['name']
678677
# Split homes data by category
679678
self.persons = {}
680679
self.events = {}
@@ -1169,6 +1168,9 @@ def getStationMinMaxTH(station=None, module=None, home=None):
11691168
thermostat = ThermostatData(authorization)
11701169
Default_relay = thermostat.Relay_Plug()
11711170
Default_thermostat = thermostat.Thermostat_Data()
1171+
thermostat.getThermostat()
1172+
print (thermostat.moduleNamesList())
1173+
#print (thermostat.getModuleByName(name))
11721174
except NoDevice:
11731175
logger.warning("No thermostat avaible for testing")
11741176

0 commit comments

Comments
 (0)