Skip to content

Commit

Permalink
refactor: deprecate download_path option
Browse files Browse the repository at this point in the history
DEPRECATED: `download_path` option is deprecated as Home Assistant now supports custom backup locations using the `location` option. This new option also supports auto-purging backups from the remote location. If enough people still see value in this option I may un-deprecate it.
  • Loading branch information
jcwillox committed Jul 29, 2023
1 parent 41b0363 commit 6354f9f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 29 deletions.
41 changes: 24 additions & 17 deletions custom_components/auto_backup/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,29 +94,36 @@
vol.Optional(ATTR_ADDONS, default=[]): SCHEMA_LIST_STRING,
}

SCHEMA_BACKUP_FULL = SCHEMA_BACKUP_BASE.extend(
{vol.Optional(ATTR_EXCLUDE): SCHEMA_ADDONS_FOLDERS}
SCHEMA_BACKUP_FULL = vol.All(
cv.deprecated(ATTR_DOWNLOAD_PATH),
SCHEMA_BACKUP_BASE.extend({vol.Optional(ATTR_EXCLUDE): SCHEMA_ADDONS_FOLDERS}),
)

SCHEMA_BACKUP_PARTIAL = SCHEMA_BACKUP_BASE.extend(SCHEMA_ADDONS_FOLDERS)
SCHEMA_BACKUP_PARTIAL = vol.All(
cv.deprecated(ATTR_DOWNLOAD_PATH), SCHEMA_BACKUP_BASE.extend(SCHEMA_ADDONS_FOLDERS)
)

SCHEMA_BACKUP = vol.Any(
SCHEMA_BACKUP_BASE.extend(
{
vol.Optional(ATTR_INCLUDE): SCHEMA_ADDONS_FOLDERS,
vol.Optional(ATTR_EXCLUDE): SCHEMA_ADDONS_FOLDERS,
}
),
SCHEMA_BACKUP_BASE.extend(
{
vol.Optional(ATTR_INCLUDE_ADDONS): SCHEMA_LIST_STRING,
vol.Optional(ATTR_INCLUDE_FOLDERS): SCHEMA_LIST_STRING,
vol.Optional(ATTR_EXCLUDE_ADDONS): SCHEMA_LIST_STRING,
vol.Optional(ATTR_EXCLUDE_FOLDERS): SCHEMA_LIST_STRING,
}
SCHEMA_BACKUP = vol.All(
cv.deprecated(ATTR_DOWNLOAD_PATH),
vol.Any(
SCHEMA_BACKUP_BASE.extend(
{
vol.Optional(ATTR_INCLUDE): SCHEMA_ADDONS_FOLDERS,
vol.Optional(ATTR_EXCLUDE): SCHEMA_ADDONS_FOLDERS,
}
),
SCHEMA_BACKUP_BASE.extend(
{
vol.Optional(ATTR_INCLUDE_ADDONS): SCHEMA_LIST_STRING,
vol.Optional(ATTR_INCLUDE_FOLDERS): SCHEMA_LIST_STRING,
vol.Optional(ATTR_EXCLUDE_ADDONS): SCHEMA_LIST_STRING,
vol.Optional(ATTR_EXCLUDE_FOLDERS): SCHEMA_LIST_STRING,
}
),
),
)


MAP_SERVICES = {
SERVICE_BACKUP: SCHEMA_BACKUP,
SERVICE_BACKUP_FULL: SCHEMA_BACKUP_FULL,
Expand Down
12 changes: 0 additions & 12 deletions custom_components/auto_backup/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,6 @@ backup:
step: 0.01
unit_of_measurement: days
mode: box
download_path: &download_path
name: Download path
description: Locations to download the backup to after creation.
example: "[/usb_drive]"
advanced: true
selector:
select:
multiple: true
custom_value: true
options: []
location: &location
name: Location
description: Name of a backup network storage to put backup (or /backup)
Expand Down Expand Up @@ -115,7 +105,6 @@ backup_full:
object:
password: *password
keep_days: *keep_days
download_path: *download_path
location: *location
compressed: *compressed

Expand Down Expand Up @@ -152,7 +141,6 @@ backup_partial:
value: addons
password: *password
keep_days: *keep_days
download_path: *download_path
location: *location
compressed: *compressed

Expand Down

0 comments on commit 6354f9f

Please sign in to comment.