mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-25 10:17:23 +00:00
Add automatic backup event entity (#39151)
This commit is contained in:
parent
68aee9ce90
commit
62b307da6c
@ -2,6 +2,7 @@
|
|||||||
title: Backup
|
title: Backup
|
||||||
description: Allow creating backups of container and core installations.
|
description: Allow creating backups of container and core installations.
|
||||||
ha_category:
|
ha_category:
|
||||||
|
- Event
|
||||||
- Other
|
- Other
|
||||||
- Sensor
|
- Sensor
|
||||||
ha_release: 2022.4
|
ha_release: 2022.4
|
||||||
@ -12,6 +13,7 @@ ha_codeowners:
|
|||||||
ha_iot_class: Calculated
|
ha_iot_class: Calculated
|
||||||
ha_platforms:
|
ha_platforms:
|
||||||
- diagnostics
|
- diagnostics
|
||||||
|
- event
|
||||||
- sensor
|
- sensor
|
||||||
ha_integration_type: service
|
ha_integration_type: service
|
||||||
related:
|
related:
|
||||||
@ -76,6 +78,8 @@ action: backup.create
|
|||||||
This is a YAML example for an automation that initiate a backup every night
|
This is a YAML example for an automation that initiate a backup every night
|
||||||
at 3 AM:
|
at 3 AM:
|
||||||
|
|
||||||
|
{% raw %}
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
automation:
|
automation:
|
||||||
- alias: "Backup Home Assistant every night at 3 AM"
|
- alias: "Backup Home Assistant every night at 3 AM"
|
||||||
@ -87,10 +91,49 @@ automation:
|
|||||||
action: backup.create
|
action: backup.create
|
||||||
```
|
```
|
||||||
|
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
## Restoring a backup
|
## Restoring a backup
|
||||||
|
|
||||||
To restore a backup, follow the steps described in [Restoring a backup](/common-tasks/general/#restoring-a-backup).
|
To restore a backup, follow the steps described in [Restoring a backup](/common-tasks/general/#restoring-a-backup).
|
||||||
|
|
||||||
|
## Event entity
|
||||||
|
|
||||||
|
The **Backup** {% term integration %} provides an {% term "Event entity" %} which represents the state of the last automatic backup (_completed, in progress, failed_). It also provides several event attributes which can be used in automations.
|
||||||
|
|
||||||
|
| Attribute | Description |
|
||||||
|
| --- | --- |
|
||||||
|
| `event_type` | The translated state of the last automatic backup task (_possible states: completed, in progress, failed_)
|
||||||
|
| `backup_stage` | The current automatic backup stage (_is `None` when `event_type` is not in progress_) |
|
||||||
|
| `failed_reason` | The reason for a failed automatic backup (_is `None` when `event_type` is completed or in progress_) |
|
||||||
|
|
||||||
|
### Usage examples
|
||||||
|
|
||||||
|
Send notification to mobile app, when an automatic backup failed.
|
||||||
|
|
||||||
|
{% raw %}
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
alias: Backup failed
|
||||||
|
triggers:
|
||||||
|
- trigger: state
|
||||||
|
entity_id:
|
||||||
|
- event.backup_automatic_backup
|
||||||
|
conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: event.backup_automatic_backup
|
||||||
|
attribute: event_type
|
||||||
|
state: failed
|
||||||
|
actions:
|
||||||
|
- data:
|
||||||
|
title: Automatic backup failed
|
||||||
|
message: The last automatic backup failed due to {{ state_attr('event.backup_automatic_backup', 'failed_reason') }}
|
||||||
|
action: notify.mobile-app
|
||||||
|
mode: single
|
||||||
|
```
|
||||||
|
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
## Sensors
|
## Sensors
|
||||||
|
|
||||||
The **Backup** {% term integration %} provides several sensors.
|
The **Backup** {% term integration %} provides several sensors.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user