Add HACS, Themes
This commit is contained in:
36
custom_components/hacs/tasks/activate_categories.py
Normal file
36
custom_components/hacs/tasks/activate_categories.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""Starting setup task: extra stores."""
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from ..base import HacsBase
|
||||
from ..enums import HacsCategory, 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):
|
||||
"""Set up extra stores in HACS if enabled in Home Assistant."""
|
||||
|
||||
stages = [HacsStage.SETUP]
|
||||
|
||||
async def async_execute(self) -> None:
|
||||
"""Execute the task."""
|
||||
self.hacs.common.categories = set()
|
||||
for category in (HacsCategory.INTEGRATION, HacsCategory.PLUGIN):
|
||||
self.hacs.enable_hacs_category(HacsCategory(category))
|
||||
|
||||
if HacsCategory.PYTHON_SCRIPT in self.hacs.hass.config.components:
|
||||
self.hacs.enable_hacs_category(HacsCategory.PYTHON_SCRIPT)
|
||||
|
||||
if self.hacs.hass.services.has_service("frontend", "reload_themes"):
|
||||
self.hacs.enable_hacs_category(HacsCategory.THEME)
|
||||
|
||||
if self.hacs.configuration.appdaemon:
|
||||
self.hacs.enable_hacs_category(HacsCategory.APPDAEMON)
|
||||
if self.hacs.configuration.netdaemon:
|
||||
self.hacs.enable_hacs_category(HacsCategory.NETDAEMON)
|
||||
Reference in New Issue
Block a user