Add HACS, Themes
This commit is contained in:
24
custom_components/hacs/tasks/restore_data.py
Normal file
24
custom_components/hacs/tasks/restore_data.py
Normal file
@@ -0,0 +1,24 @@
|
||||
""""Starting setup task: Restore"."""
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from ..base import HacsBase
|
||||
from ..enums import HacsDisabledReason, HacsStage
|
||||
from .base import HacsTask
|
||||
|
||||
|
||||
async def async_setup_task(hacs: HacsBase, hass: HomeAssistant) -> Task:
|
||||
"""Set up this task."""
|
||||
return Task(hacs=hacs, hass=hass)
|
||||
|
||||
|
||||
class Task(HacsTask):
|
||||
"""Restore HACS data."""
|
||||
|
||||
stages = [HacsStage.SETUP]
|
||||
|
||||
async def async_execute(self) -> None:
|
||||
"""Execute the task."""
|
||||
if not await self.hacs.data.restore():
|
||||
self.hacs.disable_hacs(HacsDisabledReason.RESTORE)
|
||||
Reference in New Issue
Block a user