55
66from homeassistant .components .ffmpeg import CONF_EXTRA_ARGUMENTS
77from homeassistant .config_entries import SOURCE_IMPORT , ConfigEntry
8- from homeassistant .const import CONF_HOST
8+ from homeassistant .const import (
9+ CONF_HOST ,
10+ CONF_NAME ,
11+ CONF_PASSWORD ,
12+ CONF_PORT ,
13+ CONF_USERNAME ,
14+ )
915from homeassistant .core import HomeAssistant
1016from homeassistant .helpers import config_per_platform
1117
1218from .const import (
13- CONF_PROFILE ,
1419 CONF_RTSP_TRANSPORT ,
1520 DEFAULT_ARGUMENTS ,
16- DEFAULT_PROFILE ,
21+ DEFAULT_NAME ,
22+ DEFAULT_PASSWORD ,
23+ DEFAULT_PORT ,
24+ DEFAULT_USERNAME ,
1725 DOMAIN ,
1826 RTSP_TRANS_PROTOCOLS ,
1927)
@@ -32,12 +40,14 @@ async def async_setup(hass: HomeAssistant, config: dict):
3240 continue
3341
3442 config = p_config .copy ()
35- profile = config .get (CONF_PROFILE , DEFAULT_PROFILE )
3643 if config [CONF_HOST ] not in configs .keys ():
37- configs [config [CONF_HOST ]] = config
38- configs [config [CONF_HOST ]][CONF_PROFILE ] = [profile ]
39- else :
40- configs [config [CONF_HOST ]][CONF_PROFILE ].append (profile )
44+ configs [config [CONF_HOST ]] = {
45+ CONF_HOST : config [CONF_HOST ],
46+ CONF_NAME : config .get (CONF_NAME , DEFAULT_NAME ),
47+ CONF_PASSWORD : config .get (CONF_PASSWORD , DEFAULT_PASSWORD ),
48+ CONF_PORT : config .get (CONF_PORT , DEFAULT_PORT ),
49+ CONF_USERNAME : config .get (CONF_USERNAME , DEFAULT_USERNAME ),
50+ }
4151
4252 for conf in configs .values ():
4353 hass .async_create_task (
@@ -64,7 +74,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
6474
6575async def async_unload_entry (hass : HomeAssistant , entry : ConfigEntry ):
6676 """Unload a config entry."""
67- unload_ok = all (
77+ return all (
6878 await asyncio .gather (
6979 * [
7080 hass .config_entries .async_forward_entry_unload (entry , component )
@@ -73,8 +83,6 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
7383 )
7484 )
7585
76- return unload_ok
77-
7886
7987async def async_populate_options (hass , entry ):
8088 """Populate default options for device."""
0 commit comments