diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml index 2ef857f97b3..f5788757efb 100644 --- a/.github/workflows/builder.yml +++ b/.github/workflows/builder.yml @@ -320,6 +320,15 @@ jobs: exit 1 fi + - name: Wait for Home Assistant Core to start + run: | + echo "Waiting for Home Assistant Core to start" + timeout 10m ha supervisor logs -f -n 10000 -b 0 | grep -q "Detect a running Home Assistant instance" + if [ "$?" != "0" ]; then + echo "Home Assistant Core did not start within 10 minutes" + exit 1 + fi + - name: Create full backup id: backup run: | diff --git a/supervisor/homeassistant/module.py b/supervisor/homeassistant/module.py index 9f2cba6b25c..f5e0b91798e 100644 --- a/supervisor/homeassistant/module.py +++ b/supervisor/homeassistant/module.py @@ -371,6 +371,12 @@ async def begin_backup(self) -> None: _LOGGER.error, ) from err + if not resp: + raise HomeAssistantBackupError( + "Preparing backup of Home Assistant Core failed. No response from HA Core.", + _LOGGER.error, + ) + if resp and not resp.get(ATTR_SUCCESS): raise HomeAssistantBackupError( f"Preparing backup of Home Assistant Core failed due to: {resp.get(ATTR_ERROR, {}).get(ATTR_MESSAGE, '')}. Check HA Core logs.", diff --git a/supervisor/homeassistant/websocket.py b/supervisor/homeassistant/websocket.py index 6f8f2faf12f..52dd0ab87a7 100644 --- a/supervisor/homeassistant/websocket.py +++ b/supervisor/homeassistant/websocket.py @@ -225,6 +225,10 @@ async def _can_send(self, message: dict[str, Any]) -> bool: # since it makes a new socket connection and we already have one. if not connected and not await self.sys_homeassistant.api.check_api_state(): # No core access, don't try. + _LOGGER.debug( + "Home Assistant API is not accessible. Not sending WS message: %s", + message, + ) return False if not self._client: