Add scaffold template for backup (#68961)
This commit is contained in:
parent
400943ce99
commit
f7c936e842
3 changed files with 34 additions and 2 deletions
|
@ -2,6 +2,10 @@
|
||||||
from .model import Info
|
from .model import Info
|
||||||
|
|
||||||
DATA = {
|
DATA = {
|
||||||
|
"backup": {
|
||||||
|
"title": "Backup",
|
||||||
|
"docs": "https://developers.home-assistant.io/docs/core/platform/backup",
|
||||||
|
},
|
||||||
"config_flow": {
|
"config_flow": {
|
||||||
"title": "Config Flow",
|
"title": "Config Flow",
|
||||||
"docs": "https://developers.home-assistant.io/docs/en/config_entries_config_flow_handler.html",
|
"docs": "https://developers.home-assistant.io/docs/en/config_entries_config_flow_handler.html",
|
||||||
|
@ -36,12 +40,12 @@ DATA = {
|
||||||
},
|
},
|
||||||
"reproduce_state": {
|
"reproduce_state": {
|
||||||
"title": "Reproduce State",
|
"title": "Reproduce State",
|
||||||
"docs": "https://developers.home-assistant.io/docs/en/reproduce_state_index.html",
|
"docs": "https://developers.home-assistant.io/docs/core/platform/reproduce_state",
|
||||||
"extra": "You will now need to update the code to make sure that every attribute that can occur in the state will cause the right service to be called.",
|
"extra": "You will now need to update the code to make sure that every attribute that can occur in the state will cause the right service to be called.",
|
||||||
},
|
},
|
||||||
"significant_change": {
|
"significant_change": {
|
||||||
"title": "Significant Change",
|
"title": "Significant Change",
|
||||||
"docs": "https://developers.home-assistant.io/docs/en/significant_change_index.html",
|
"docs": "https://developers.home-assistant.io/docs/core/platform/significant_change",
|
||||||
"extra": "You will now need to update the code to make sure that entities with different device classes are correctly considered.",
|
"extra": "You will now need to update the code to make sure that entities with different device classes are correctly considered.",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
10
script/scaffold/templates/backup/integration/backup.py
Normal file
10
script/scaffold/templates/backup/integration/backup.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
"""Backup platform for the NEW_NAME integration."""
|
||||||
|
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."""
|
18
script/scaffold/templates/backup/tests/test_backup.py
Normal file
18
script/scaffold/templates/backup/tests/test_backup.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
"""Test the NEW_NAME backup platform."""
|
||||||
|
from homeassistant.components.NEW_DOMAIN.backup import (
|
||||||
|
async_post_backup,
|
||||||
|
async_pre_backup,
|
||||||
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
|
|
||||||
|
async def test_async_post_backup(hass: HomeAssistant) -> None:
|
||||||
|
"""Verify async_post_backup."""
|
||||||
|
# TODO: verify that the async_post_backup function executes as expected
|
||||||
|
assert await async_post_backup(hass)
|
||||||
|
|
||||||
|
|
||||||
|
async def test_async_pre_backup(hass: HomeAssistant) -> None:
|
||||||
|
"""Verify async_pre_backup."""
|
||||||
|
# TODO: verify that the async_pre_backup function executes as expected
|
||||||
|
assert await async_pre_backup(hass)
|
Loading…
Add table
Add a link
Reference in a new issue