Only forward config entry to each platform once

Fixes #94
This commit is contained in:
Pierre Ståhl
2020-10-19 22:23:21 +02:00
parent 3f854337ad
commit c6de437e86

View File

@@ -190,12 +190,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
}
async def setup_entities():
platforms = set(entity[CONF_PLATFORM] for entity in entry.data[CONF_ENTITIES])
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_setup(
entry, entity[CONF_PLATFORM]
)
for entity in entry.data[CONF_ENTITIES]
hass.config_entries.async_forward_entry_setup(entry, platform)
for platform in platforms
]
)
device.connect()