Skip to content

Commit a2bf40f

Browse files
authored
Update lnetatmo.py
Added auto-test for HomesData and Homecoach
1 parent 672f830 commit a2bf40f

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

lnetatmo.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,17 +1048,30 @@ def getStationMinMaxTH(station=None, module=None, home=None):
10481048
stderr.write("Library source missing identification arguments to check lnetatmo.py (user/password/etc...)")
10491049
exit(1)
10501050

1051-
authorization = ClientAuth() # Test authentication method
1051+
authorization = ClientAuth() # Test authentication method
10521052

10531053
try:
10541054
weatherStation = WeatherStationData(authorization) # Test DEVICELIST
10551055
except NoDevice:
10561056
logger.warning("No weather station available for testing")
10571057
else:
1058-
weatherStation.MinMaxTH() # Test GETMEASUR
1058+
weatherStation.MinMaxTH() # Test GETMEASUR
10591059

10601060
try:
10611061
homes = HomeData(authorization)
1062+
for k, v in homes.homes.items():
1063+
#print (v)
1064+
C = v.pop('cameras')
1065+
P = v.pop('persons')
1066+
S = v.pop('smokedetectors')
1067+
#
1068+
if C == [] and P == [] and S == []:
1069+
#print (v)
1070+
logger.info("No Cameras, Persons, Smokedetectors found")
1071+
#
1072+
else:
1073+
homeid = k
1074+
#
10621075
except NoDevice :
10631076
logger.warning("No home available for testing")
10641077

@@ -1067,6 +1080,18 @@ def getStationMinMaxTH(station=None, module=None, home=None):
10671080
except NoDevice:
10681081
logger.warning("No thermostat avaible for testing")
10691082

1083+
try:
1084+
# homesdata = lnetatmo.HomesData(authorization)
1085+
# ERROR ; Your current token scope do not allow access to Module ? - No Home ID given !
1086+
homesdata = HomesData(authorization, homeid)
1087+
except NoDevice:
1088+
logger.warning("No HomesData avaible for testing")
1089+
1090+
try:
1091+
Homecoach = HomeCoach(authorization)
1092+
except NoDevice:
1093+
logger.warning("No HomeCoach avaible for testing")
1094+
10701095
# If we reach this line, all is OK
10711096
logger.info("OK")
10721097

0 commit comments

Comments
 (0)