Add backup documentation and restructure platforms (#1259)

This commit is contained in:
Joakim Sørensen 2022-03-30 21:40:23 +02:00 committed by GitHub
parent e0bea16846
commit da18c9cbdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 29 deletions

View File

@ -0,0 +1,24 @@
---
title: "Backup"
---
When Home Assistant is creating a backup, there might be a need to pause certain operations in the integration, or dumping data so it can properly be restored.
This is done by adding 2 functions (`async_pre_backup` and `async_post_backup`) to `backup.py`
## Adding support
The quickest way to add backup support to a new integration is by using our built-in scaffold template. From a Home Assistant dev environment, run `python3 -m script.scaffold backup` and follow the instructions.
If you prefer to go the manual route, create a new file in your integration folder called `backup.py` and implement the following method:
```python
from homeassistant.core import HomeAssistant
async def async_pre_backup(hass: HomeAssistant) -> None:
"""Perform operations before a backup starts."""
async def async_post_backup(hass: HomeAssistant) -> None:
"""Perform operations after a backup finishes."""
```

View File

@ -1,5 +1,5 @@
---
title: "Supporting Scenes"
title: "Reproduce State"
---
Home Assistant has support for scenes. Scenes are a collection of (partial) entity states. When a scene is activated, Home Assistant will try to call the right services to get the specified scenes in their specified state.

View File

@ -1,5 +1,5 @@
---
title: "Significant Change Support"
title: "Significant Change"
---
Home Assistant doesn't only collect data, it also exports data to various services. Not all of these services are interested in every change. To help these services filter insignificant changes, your entity integration can add significant change support.

View File

@ -137,10 +137,6 @@ module.exports = {
"integration_events",
"network_discovery",
],
"Building Entity Integrations": [
"reproduce_state_index",
"significant_change_index",
],
"Development Checklist": [
"development_checklist",
"creating_component_code_review",
@ -155,29 +151,16 @@ module.exports = {
],
Entities: [
"core/entity",
"core/entity/air-quality",
"core/entity/alarm-control-panel",
"core/entity/binary-sensor",
"core/entity/button",
"core/entity/camera",
"core/entity/climate",
"core/entity/cover",
"core/entity/device-tracker",
"core/entity/fan",
"core/entity/humidifier",
"core/entity/light",
"core/entity/lock",
"core/entity/media-player",
"core/entity/number",
"core/entity/remote",
"core/entity/select",
"core/entity/sensor",
"core/entity/siren",
"core/entity/switch",
"core/entity/update",
"core/entity/vacuum",
"core/entity/water-heater",
"core/entity/weather",
{
type: 'autogenerated',
dirName: 'core/entity',
},
],
Platforms: [
{
type: 'autogenerated',
dirName: 'core/platform',
},
],
"Device Automations": [
"device_automation_index",

View File

@ -62,6 +62,9 @@
/docs/lovelace_custom_card /docs/frontend/custom-ui/lovelace-custom-card
/docs/supervisor/developing /docs/supervisor/development
/docs/dev_101_index /docs/dev_101_hass
/docs/reproduce_state_index /docs/core/platform/reproduce_state
/docs/significant_change_index /docs/core/platform/significant_change
# Tidying moved pages
/docs/creating_platform_example_sensor https://github.com/home-assistant/example-custom-config/tree/master/custom_components/example_sensor