Skip to content

Commit

Permalink
Add timeout check as failsave in registration flow
Browse files Browse the repository at this point in the history
  • Loading branch information
fsaris committed Nov 18, 2023
1 parent 3d9a5fb commit 4ff2bd5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion custom_components/zonneplan_one/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"issue_tracker": "https://github.com/fsaris/home-assistant-zonneplan-one/issues",
"requirements": [],
"ssdp": [],
"version": "0.0.19",
"version": "0.0.20",
"zeroconf": []
}
11 changes: 8 additions & 3 deletions custom_components/zonneplan_one/zonneplan_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ async def async_request_temp_pass(self, email: str) -> str:
_LOGGER.debug("ZonneplanAPI response header: %s", response.headers)
_LOGGER.debug("ZonneplanAPI response status: %s", response.status)

response.raise_for_status()
try:
with async_timeout.timeout(10):
response.raise_for_status()

response_json = await response.json()
_LOGGER.debug("ZonneplanAPI response body : %s", response_json)
response_json = await response.json()
_LOGGER.debug("ZonneplanAPI response body : %s", response_json)
except asyncio.TimeoutError:
_LOGGER.error("Failed to extract body")
return None

return response_json["data"]["uuid"]

Expand Down

0 comments on commit 4ff2bd5

Please sign in to comment.