Skip to content

Commit

Permalink
Update lnetatmo.py
Browse files Browse the repository at this point in the history
Added auto-test for HomesData and Homecoach
  • Loading branch information
JurgenLB authored Nov 3, 2023
1 parent 672f830 commit a2bf40f
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions lnetatmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1048,17 +1048,30 @@ def getStationMinMaxTH(station=None, module=None, home=None):
stderr.write("Library source missing identification arguments to check lnetatmo.py (user/password/etc...)")
exit(1)

authorization = ClientAuth() # Test authentication method
authorization = ClientAuth() # Test authentication method

try:
weatherStation = WeatherStationData(authorization) # Test DEVICELIST
except NoDevice:
logger.warning("No weather station available for testing")
else:
weatherStation.MinMaxTH() # Test GETMEASUR
weatherStation.MinMaxTH() # Test GETMEASUR

try:
homes = HomeData(authorization)
for k, v in homes.homes.items():
#print (v)
C = v.pop('cameras')
P = v.pop('persons')
S = v.pop('smokedetectors')
#
if C == [] and P == [] and S == []:
#print (v)
logger.info("No Cameras, Persons, Smokedetectors found")
#
else:
homeid = k
#
except NoDevice :
logger.warning("No home available for testing")

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

try:
# homesdata = lnetatmo.HomesData(authorization)
# ERROR ; Your current token scope do not allow access to Module ? - No Home ID given !
homesdata = HomesData(authorization, homeid)
except NoDevice:
logger.warning("No HomesData avaible for testing")

try:
Homecoach = HomeCoach(authorization)
except NoDevice:
logger.warning("No HomeCoach avaible for testing")

# If we reach this line, all is OK
logger.info("OK")

Expand Down

0 comments on commit a2bf40f

Please sign in to comment.