Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """Component to configure Home Assistant via an API."""
2 
3 from __future__ import annotations
4 
5 from homeassistant.components import frontend
6 from homeassistant.const import EVENT_COMPONENT_LOADED
7 from homeassistant.core import HomeAssistant
8 from homeassistant.helpers import config_validation as cv
9 from homeassistant.helpers.typing import ConfigType
10 from homeassistant.setup import EventComponentLoaded
11 
12 from . import (
13  area_registry,
14  auth,
15  auth_provider_homeassistant,
16  automation,
17  category_registry,
18  config_entries,
19  core,
20  device_registry,
21  entity_registry,
22  floor_registry,
23  label_registry,
24  scene,
25  script,
26 )
27 from .const import DOMAIN
28 
29 SECTIONS = (
30  area_registry,
31  auth,
32  auth_provider_homeassistant,
33  automation,
34  category_registry,
35  config_entries,
36  core,
37  device_registry,
38  entity_registry,
39  floor_registry,
40  label_registry,
41  script,
42  scene,
43 )
44 
45 
46 CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)
47 
48 
49 async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
50  """Set up the config component."""
51  frontend.async_register_built_in_panel(
52  hass, "config", "config", "hass:cog", require_admin=True
53  )
54 
55  for panel in SECTIONS:
56  if panel.async_setup(hass):
57  name = panel.__name__.split(".")[-1]
58  key = f"{DOMAIN}.{name}"
59  hass.bus.async_fire(
60  EVENT_COMPONENT_LOADED, EventComponentLoaded(component=key)
61  )
62 
63  return True
bool async_setup(HomeAssistant hass, ConfigType config)
Definition: __init__.py:49