Compare commits

...

3 Commits

Author SHA1 Message Date
Stefan Agner
5d9d33c9fa Wait for Home Assistant Core to start 2025-10-27 12:36:48 +01:00
Stefan Agner
e4959b4f10 Log rejected WebSocket messages to Home Assistant Core 2025-10-27 11:46:04 +01:00
Stefan Agner
78353220de Reject Core Backup if sending backup start WebSocket message fails
If sending the WebSocket message to Home Assistant Core to inform it
about the start of a backup fails, we should reject the backup process
entirely. This prevents taking a backup without Home Assistant Core
being aware of it.

As a side effect, this likely prevents situation where Core does not
learn about the backup progress since we also won't be able to send
WebSocket messages about Job progress updates.
2025-10-27 11:36:25 +01:00
3 changed files with 19 additions and 0 deletions

View File

@@ -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: |

View File

@@ -371,6 +371,12 @@ class HomeAssistant(FileConfiguration, CoreSysAttributes):
_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.",

View File

@@ -225,6 +225,10 @@ class HomeAssistantWebSocket(CoreSysAttributes):
# 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: