Run API watchdog only if core is running (#2961)

* Run API watchdog only if core is running

* negate

* fix comment
This commit is contained in:
Pascal Vizeli 2021-06-16 11:45:06 +02:00 committed by GitHub
parent de8a241e72
commit 3b1ad5c0cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -204,9 +204,9 @@ class Tasks(CoreSysAttributes):
Try 2 times to call API before we restart Home-Assistant. Maybe we had
a delay in our system.
"""
# If Home-Assistant is active
# Home-Assistant is active/running
if (
await self.sys_homeassistant.core.is_failed()
not await self.sys_homeassistant.core.is_running()
or not self.sys_homeassistant.watchdog
or self.sys_homeassistant.error_state
):
@ -215,7 +215,7 @@ class Tasks(CoreSysAttributes):
# Init cache data
retry_scan = self._cache.get(HASS_WATCHDOG_API, 0)
# If Home-Assistant API is up
# Home-Assistant API is up
if (
self.sys_homeassistant.core.in_progress
or await self.sys_homeassistant.api.check_api_state()