Fix failure to register services in dynalite (#93069)

* fixed bug that fails to register services when there is no YAML config

* style improvement per thecode's suggestion
This commit is contained in:
Ziv 2023-05-17 14:05:36 +03:00 committed by GitHub
parent c522ea855d
commit f564a0ca24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,19 +43,11 @@ CONFIG_SCHEMA = vol.Schema(
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Dynalite platform."""
conf = config.get(DOMAIN)
conf = config.get(DOMAIN, {})
LOGGER.debug("Setting up dynalite component config = %s", conf)
if conf is None:
conf = {}
hass.data[DOMAIN] = {}
# User has configured bridges
if CONF_BRIDGES not in conf:
return True
bridges = conf[CONF_BRIDGES]
bridges = conf.get(CONF_BRIDGES, [])
for bridge_conf in bridges:
host = bridge_conf[CONF_HOST]