Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """The Fully Kiosk Browser integration."""
2 
3 from homeassistant.config_entries import ConfigEntry
4 from homeassistant.const import Platform
5 from homeassistant.core import HomeAssistant
6 from homeassistant.helpers import config_validation as cv
7 from homeassistant.helpers.typing import ConfigType
8 
9 from .const import DOMAIN
10 from .coordinator import FullyKioskDataUpdateCoordinator
11 from .services import async_setup_services
12 
13 type FullyKioskConfigEntry = ConfigEntry[FullyKioskDataUpdateCoordinator]
14 
15 PLATFORMS = [
16  Platform.BINARY_SENSOR,
17  Platform.BUTTON,
18  Platform.CAMERA,
19  Platform.IMAGE,
20  Platform.MEDIA_PLAYER,
21  Platform.NOTIFY,
22  Platform.NUMBER,
23  Platform.SENSOR,
24  Platform.SWITCH,
25 ]
26 
27 CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
28 
29 
30 async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
31  """Set up Fully Kiosk Browser."""
32 
33  await async_setup_services(hass)
34 
35  return True
36 
37 
38 async def async_setup_entry(hass: HomeAssistant, entry: FullyKioskConfigEntry) -> bool:
39  """Set up Fully Kiosk Browser from a config entry."""
40 
41  coordinator = FullyKioskDataUpdateCoordinator(hass, entry)
42  await coordinator.async_config_entry_first_refresh()
43 
44  entry.runtime_data = coordinator
45 
46  await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
47  coordinator.async_update_listeners()
48 
49  return True
50 
51 
52 async def async_unload_entry(hass: HomeAssistant, entry: FullyKioskConfigEntry) -> bool:
53  """Unload a config entry."""
54  return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_setup(HomeAssistant hass, ConfigType config)
Definition: __init__.py:30
bool async_setup_entry(HomeAssistant hass, FullyKioskConfigEntry entry)
Definition: __init__.py:38
bool async_unload_entry(HomeAssistant hass, FullyKioskConfigEntry entry)
Definition: __init__.py:52
None async_setup_services(HomeAssistant hass)
Definition: __init__.py:72