Home Assistant Unofficial Reference 2024.12.1
__init__.py
Go to the documentation of this file.
1 """The MJPEG IP Camera integration."""
2 
3 from homeassistant.config_entries import ConfigEntry
4 from homeassistant.core import HomeAssistant
5 from homeassistant.helpers import config_validation as cv
6 from homeassistant.helpers.typing import ConfigType
7 
8 from .camera import MjpegCamera
9 from .const import CONF_MJPEG_URL, CONF_STILL_IMAGE_URL, DOMAIN, PLATFORMS
10 from .util import filter_urllib3_logging
11 
12 __all__ = [
13  "CONF_MJPEG_URL",
14  "CONF_STILL_IMAGE_URL",
15  "MjpegCamera",
16  "filter_urllib3_logging",
17 ]
18 
19 CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
20 
21 
22 async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
23  """Set up the MJPEG IP Camera integration."""
25  return True
26 
27 
28 async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
29  """Set up from a config entry."""
30  await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
31 
32  # Reload entry when its updated.
33  entry.async_on_unload(entry.add_update_listener(async_reload_entry))
34 
35  return True
36 
37 
38 async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
39  """Unload a config entry."""
40  return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
41 
42 
43 async def async_reload_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
44  """Reload the config entry when it changed."""
45  await hass.config_entries.async_reload(entry.entry_id)
bool async_setup_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:28
bool async_setup(HomeAssistant hass, ConfigType config)
Definition: __init__.py:22
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:38
None async_reload_entry(HomeAssistant hass, ConfigEntry entry)
Definition: __init__.py:43