Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """The Thread integration."""
2 
3 from __future__ import annotations
4 
5 from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
6 from homeassistant.core import HomeAssistant
7 from homeassistant.helpers import config_validation as cv
8 from homeassistant.helpers.typing import ConfigType
9 
10 from .const import DOMAIN
11 from .dataset_store import (
12  DatasetEntry,
13  async_add_dataset,
14  async_get_dataset,
15  async_get_preferred_dataset,
16 )
17 from .websocket_api import async_setup as async_setup_ws_api
18 
19 __all__ = [
20  "DOMAIN",
21  "DatasetEntry",
22  "async_add_dataset",
23  "async_get_dataset",
24  "async_get_preferred_dataset",
25 ]
26 
27 CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)
28 
29 
30 async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
31  """Set up the Thread integration."""
32  if not hass.config_entries.async_entries(DOMAIN):
33  hass.async_create_task(
34  hass.config_entries.flow.async_init(
35  DOMAIN, context={"source": SOURCE_IMPORT}
36  )
37  )
38  async_setup_ws_api(hass)
39  hass.data[DOMAIN] = {}
40  return True
41 
42 
43 async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
44  """Set up a config entry."""
45 
46  return True
47 
48 
49 async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
50  """Unload a config entry."""
51  return True
bool async_setup(HomeAssistant hass, ConfigType config)
Definition: __init__.py:30
bool async_setup_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:43
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:49