Skip to content

Commit

Permalink
Changed: Add device offline/unavailable scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
ualex73 committed Jul 9, 2019
1 parent b18af70 commit 1d9409f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
22 changes: 20 additions & 2 deletions goslideapi/goslideapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async def _dorequest(self, reqtype, urlsuffix, data=None):
# which isn't in our account
# 404 - Can't find API endpoint
# 424 - If one or multiple Slides are offline. The 'device_info'
# will contain '500 Device unavailable' for those slides
# will contain code=500, 'Device unavailable' for those slides
# aiohttp.client_exceptions.ClientConnectorError: No IP, timeout

async with aiohttp.request(reqtype,
Expand Down Expand Up @@ -128,6 +128,8 @@ async def login(self):
if 'access_token' in result:
self._authenticated = True
self._accesstoken = result['access_token']

# Token format is in UTC
if 'expires_at' in result:
self._expiretoken = \
datetime.strptime(result['expires_at'] + ' +0000',
Expand Down Expand Up @@ -173,7 +175,23 @@ async def slidesoverview(self):
# },
# "routines": [],
# },
# {...},
# {
# "id": 2,
# "device_name": "Study Room",
# "slide_setup": "middle",
# "curtain_type": "rail",
# "device_id": "slide_300000000001",
# "household_id": 1,
# "zone_id": 2,
# "touch_go": false,
# "device_info": {
# "message": "No response from device.",
# "code": 500
# },
# "routines": {
# "message": "No response from device.",
# "code": 500
# },
# {...},
# ]
# }
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setuptools.setup(
name='goslide-api',
version='0.0.2',
version='0.1.0',
url='https://github.com/ualex73/goslide-api',
license='Apache License 2.0',
author='Alexander Kuiper',
Expand Down

0 comments on commit 1d9409f

Please sign in to comment.