Skip to content

Commit

Permalink
Update lnetatmo.py
Browse files Browse the repository at this point in the history
some rewrite for successful selftest
  • Loading branch information
JurgenLB authored Nov 11, 2024
1 parent af6ed09 commit afe6d46
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lnetatmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
'NSD' : ["smoke sensor", 'Home + Security'],
'NHC' : ["home coach", 'Aircare'],
'NIS' : ["indoor sirene", 'Home + Security'],
'NDL' : ["Doorlock", 'Home + Security'],

'NLC' : ["Cable Outlet", 'Home+Control'],
'NLE' : ["Ecometer", 'Home+Control'],
Expand Down Expand Up @@ -643,26 +644,24 @@ def __init__(self, authData, home=None):
resp = postRequest("Home data", _GETHOMEDATA_REQ, postParams)
self.rawData = resp['body']
# Collect homes
self.homes = { d['id'] : d for d in self.rawData['homes'] }
# FIXME : Doesn't use the home parameter to select the appropriate home !
for k, v in self.homes.items():
self.homeid = k
C = v.get('cameras')
P = v.get('persons')
S = v.get('smokedetectors')
self.homes = self.rawData['homes'][0]
for d in self.rawData['homes'] :
if home == d['name']:
self.homes = d
else:
pass
#
#print (self.homes.keys())
#dict_keys(['id', 'name', 'persons', 'place', 'cameras', 'smokedetectors', 'events'])
self.homeid = self.homes['id']
C = self.homes['cameras']
P = self.homes['persons']
S = self.homes['smokedetectors']
E = None
# events not always in self.homes
if 'events' in self.homes.keys():
E = v.get('events')
#
if not S:
logger.warning('No smoke detector found')
if not C:
Expand All @@ -674,7 +673,7 @@ def __init__(self, authData, home=None):
# if not (C or P or S or E):
# raise NoDevice("No device found in home %s" % k)
if S or C or P or E:
self.default_home = home or list(self.homes.values())[0]['name']
self.default_home = home or self.homes['name']
# Split homes data by category
self.persons = {}
self.events = {}
Expand Down Expand Up @@ -1169,6 +1168,9 @@ def getStationMinMaxTH(station=None, module=None, home=None):
thermostat = ThermostatData(authorization)
Default_relay = thermostat.Relay_Plug()
Default_thermostat = thermostat.Thermostat_Data()
thermostat.getThermostat()
print (thermostat.moduleNamesList())
#print (thermostat.getModuleByName(name))
except NoDevice:
logger.warning("No thermostat avaible for testing")

Expand Down

0 comments on commit afe6d46

Please sign in to comment.