config_entry forwarded only to proper platform; DOMAIN imported from component

This commit is contained in:
rospogrigio
2020-09-15 10:59:06 +02:00
parent 97ada3de4f
commit 386d59b497
5 changed files with 18 additions and 20 deletions

View File

@@ -75,10 +75,12 @@ async def async_setup(hass: HomeAssistant, config: dict):
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up LocalTuya integration from a config entry."""
for component in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
)
for platform in PLATFORMS:
# print("ASE*** [{}] [{}]".format(entry.data["entities"][0][CONF_PLATFORM], platform))
if entry.data["entities"][0][CONF_PLATFORM] == platform:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True