2019-03-19 06:07:39 +00:00
|
|
|
"""The generic component."""
|
2020-08-28 14:44:51 +00:00
|
|
|
|
2022-03-28 19:08:00 +00:00
|
|
|
from homeassistant.config_entries import ConfigEntry
|
2021-12-28 20:13:20 +00:00
|
|
|
from homeassistant.const import Platform
|
2022-03-28 19:08:00 +00:00
|
|
|
from homeassistant.core import HomeAssistant
|
2021-12-28 20:13:20 +00:00
|
|
|
|
2020-08-28 14:44:51 +00:00
|
|
|
DOMAIN = "generic"
|
2021-12-28 20:13:20 +00:00
|
|
|
PLATFORMS = [Platform.CAMERA]
|
2022-03-28 19:08:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def _async_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|
|
|
"""Handle options update."""
|
|
|
|
await hass.config_entries.async_reload(entry.entry_id)
|
|
|
|
|
|
|
|
|
|
|
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|
|
|
"""Set up generic IP camera from a config entry."""
|
|
|
|
|
|
|
|
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
|
|
|
|
|
|
|
|
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|
|
|
"""Unload a config entry."""
|
|
|
|
|
|
|
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|