Skip to content

Commit

Permalink
Make backup config update a callback (#138925)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinHjelmare authored and frenck committed Feb 21, 2025
1 parent ba1650b commit 3d2ab3b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion homeassistant/components/backup/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ def load(self, stored_config: StoredBackupConfig) -> None:
self.data.retention.apply(self._manager)
self.data.schedule.apply(self._manager)

async def update(
@callback
def update(
self,
*,
agents: dict[str, AgentParametersDict] | UndefinedType = UNDEFINED,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/backup/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1870,7 +1870,7 @@ async def async_validate_config(self, *, config: BackupConfig) -> None:
and "hassio.local" in create_backup.agent_ids
):
automatic_agents = [self._local_agent_id, *automatic_agents]
await config.update(
config.update(
create_backup=CreateBackupParametersDict(
agent_ids=automatic_agents,
include_addons=None,
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/backup/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ async def handle_config_info(
)


@callback
@websocket_api.require_admin
@websocket_api.websocket_command(
{
Expand Down Expand Up @@ -387,8 +388,7 @@ async def handle_config_info(
),
}
)
@websocket_api.async_response
async def handle_config_update(
def handle_config_update(
hass: HomeAssistant,
connection: websocket_api.ActiveConnection,
msg: dict[str, Any],
Expand All @@ -398,7 +398,7 @@ async def handle_config_update(
changes = dict(msg)
changes.pop("id")
changes.pop("type")
await manager.config.update(**changes)
manager.config.update(**changes)
connection.send_result(msg["id"])


Expand Down

0 comments on commit 3d2ab3b

Please sign in to comment.