1 """Support for Agent."""
3 from agent
import AgentError
4 from agent.a
import Agent
13 from .const
import DOMAIN
as AGENT_DOMAIN, SERVER_URL
15 ATTRIBUTION =
"ispyconnect.com"
16 DEFAULT_BRAND =
"Agent DVR by ispyconnect.com"
18 PLATFORMS = [Platform.ALARM_CONTROL_PANEL, Platform.CAMERA]
20 AgentDVRConfigEntry = ConfigEntry[Agent]
24 hass: HomeAssistant, config_entry: AgentDVRConfigEntry
26 """Set up the Agent component."""
27 server_origin = config_entry.data[SERVER_URL]
31 await agent_client.update()
32 except AgentError
as err:
33 await agent_client.close()
34 raise ConfigEntryNotReady
from err
36 if not agent_client.is_available:
37 raise ConfigEntryNotReady
39 config_entry.async_on_unload(agent_client.close)
41 await agent_client.get_devices()
43 config_entry.runtime_data = agent_client
45 device_registry = dr.async_get(hass)
47 device_registry.async_get_or_create(
48 config_entry_id=config_entry.entry_id,
49 identifiers={(AGENT_DOMAIN, agent_client.unique)},
50 manufacturer=
"iSpyConnect",
51 name=f
"Agent {agent_client.name}",
53 sw_version=agent_client.version,
56 await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
62 hass: HomeAssistant, config_entry: AgentDVRConfigEntry
64 """Unload a config entry."""
65 return await hass.config_entries.async_unload_platforms(config_entry, PLATFORMS)
bool async_unload_entry(HomeAssistant hass, AgentDVRConfigEntry config_entry)
bool async_setup_entry(HomeAssistant hass, AgentDVRConfigEntry config_entry)
aiohttp.ClientSession async_get_clientsession(HomeAssistant hass, bool verify_ssl=True, socket.AddressFamily family=socket.AF_UNSPEC, ssl_util.SSLCipherList ssl_cipher=ssl_util.SSLCipherList.PYTHON_DEFAULT)