Explicitly log when API requests timeout (#4861)

Currently a timeout leads to a log entry which simply states:
"Error on call http://172.30.32.1:8123/api/core/state: ". From this,
it is not immeaditly clear what the problem is. This commit adds
a log entry which explicitly states that the request timed out.
This commit is contained in:
Stefan Agner 2024-01-31 16:17:24 +01:00 committed by GitHub
parent 7e20502379
commit 765265723c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -107,7 +107,10 @@ class HomeAssistantAPI(CoreSysAttributes):
continue continue
yield resp yield resp
return return
except (TimeoutError, aiohttp.ClientError) as err: except TimeoutError:
_LOGGER.error("Timeout on call %s.", url)
break
except aiohttp.ClientError as err:
_LOGGER.error("Error on call %s: %s", url, err) _LOGGER.error("Error on call %s: %s", url, err)
break break