Backup

The Backup integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] is used for Home Assistant CoreHome Assistant Core is the heart of Home Assistant itself. It is a Python program that powers every installation type, but can be installed standalone. [Learn more] and Home Assistant ContainerHome Assistant Container is a standalone container-based installation of Home Assistant Core. Any OCI compatible runtime can be used, but the documentation focus is on Docker. [Learn more] installations to create and download backups. This backup file can be used if you migrate to Home Assistant Operating SystemHome Assistant OS, the Home Assistant Operating System, is an embedded, minimalistic, operating system designed to run the Home Assistant ecosystem. It is the recommended installation method for most users. [Learn more].

Note: If you use Home Assistant Operating SystemHome Assistant OS, the Home Assistant Operating System, is an embedded, minimalistic, operating system designed to run the Home Assistant ecosystem. It is the recommended installation method for most users. [Learn more] or Home Assistant SupervisedHome Assistant Supervised is the full Home Assistant ecosystem, without the Home Assistant Operating System. [Learn more] installation, this page is not for you. Instead, refer to the documentation on using the built-in back up.

Actions

The Backup integration exposes an action that can be used to automate the backup process.

Action backup.create

The backup.create action can be used to create a backup for your Home Assistant instance.

The action has no additional options or parameters.

Example action:

action: backup.create

Example: Backing up every night at 3:00 AM

This is a YAML example for an automation that initiate a backup every night at 3 AM:

automation:
  - alias: "Backup Home Assistant every night at 3 AM"
    triggers:
      - trigger: time
        at: "03:00:00"
    actions:
      - alias: "Create backup now"
        action: backup.create

Restoring a backup

Backups created via the Backup integration are in a subdirectory backups, located in your configuration directory. The Home Assistant ContainerHome Assistant Container is a standalone container-based installation of Home Assistant Core. Any OCI compatible runtime can be used, but the documentation focus is on Docker. [Learn more] installation typically mounts this directory via docker-compose.yml or docker run to a directory of your choice.

The steps on recovering from a backup depend on the installation type and use case. Follow one of these steps:

  1. If you use Home Assistant Operating SystemHome Assistant OS, the Home Assistant Operating System, is an embedded, minimalistic, operating system designed to run the Home Assistant ecosystem. It is the recommended installation method for most users. [Learn more] or Home Assistant SupervisedHome Assistant Supervised is the full Home Assistant ecosystem, without the Home Assistant Operating System. [Learn more]:

  2. If you use a Home Assistant CoreHome Assistant Core is the heart of Home Assistant itself. It is a Python program that powers every installation type, but can be installed standalone. [Learn more] or Home Assistant ContainerHome Assistant Container is a standalone container-based installation of Home Assistant Core. Any OCI compatible runtime can be used, but the documentation focus is on Docker. [Learn more] installation:

    • A Home Assistant backup is just a tar file of the configuration directory, plus some metadata.

    • To manually restore a backup, use the following command:

         tar -xOf <backup_tar_file> "./homeassistant.tar.gz" | tar --strip-components=1 -zxf - -C <restore_directory>
      
  3. If you migrate from a Home Assistant CoreHome Assistant Core is the heart of Home Assistant itself. It is a Python program that powers every installation type, but can be installed standalone. [Learn more] or Home Assistant ContainerHome Assistant Container is a standalone container-based installation of Home Assistant Core. Any OCI compatible runtime can be used, but the documentation focus is on Docker. [Learn more] installation to Home Assistant Operating SystemHome Assistant OS, the Home Assistant Operating System, is an embedded, minimalistic, operating system designed to run the Home Assistant ecosystem. It is the recommended installation method for most users. [Learn more]:

    • You can use these backup files during onboarding to recover your installation from backup.