Fix connection loose

This commit is contained in:
Andre Basche 2023-03-11 00:28:23 +01:00
parent 6b346f766f
commit fe4f6e766e
2 changed files with 4 additions and 3 deletions

View File

@ -92,9 +92,10 @@ class HonConnection:
}
url = f"{const.API_URL}/commands/v1/context"
async with self._session.get(url, params=params, headers=await self._headers) as response:
if response.status >= 400 and not loop:
if response.status == 403 and not loop:
_LOGGER.error("%s - Error %s - %s", url, response.status, await response.text())
await self.setup()
self._request_headers.pop("cognito-token", None)
self._request_headers.pop("id-token", None)
return await self.load_attributes(device, loop=True)
return (await response.json()).get("payload", {})

View File

@ -7,7 +7,7 @@ with open("README.md", "r") as f:
setup(
name="pyhOn",
version="0.3.3",
version="0.3.4",
author="Andre Basche",
description="Control hOn devices with python",
long_description=long_description,