mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
Add support for custom weekly backup schedule (#136079)
* Add support for custom weekly backup schedule * Rename the new flag to custom_days * Make the store change backwards compatible * Improve comments
This commit is contained in:
@@ -8,7 +8,7 @@ from homeassistant.components import websocket_api
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
|
||||
from .config import ScheduleState
|
||||
from .config import Day, ScheduleRecurrence
|
||||
from .const import DATA_MANAGER, LOGGER
|
||||
from .manager import (
|
||||
DecryptOnDowloadNotSupported,
|
||||
@@ -320,13 +320,17 @@ async def handle_config_info(
|
||||
) -> None:
|
||||
"""Send the stored backup config."""
|
||||
manager = hass.data[DATA_MANAGER]
|
||||
config = manager.config.data.to_dict()
|
||||
# Remove state from schedule, it's not needed in the frontend
|
||||
# mypy doesn't like deleting from TypedDict, ignore it
|
||||
del config["schedule"]["state"] # type: ignore[misc]
|
||||
connection.send_result(
|
||||
msg["id"],
|
||||
{
|
||||
"config": manager.config.data.to_dict()
|
||||
"config": config
|
||||
| {
|
||||
"next_automatic_backup": manager.config.data.schedule.next_automatic_backup
|
||||
},
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
@@ -358,7 +362,12 @@ async def handle_config_info(
|
||||
),
|
||||
vol.Optional("schedule"): vol.Schema(
|
||||
{
|
||||
vol.Optional("state"): vol.All(str, vol.Coerce(ScheduleState)),
|
||||
vol.Optional("days"): vol.Any(
|
||||
vol.All([vol.Coerce(Day)], vol.Unique()),
|
||||
),
|
||||
vol.Optional("recurrence"): vol.All(
|
||||
str, vol.Coerce(ScheduleRecurrence)
|
||||
),
|
||||
vol.Optional("time"): vol.Any(cv.time, None),
|
||||
}
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user