From c6de437e86f94d1953bfb787d091de4be9028b07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20St=C3=A5hl?= Date: Mon, 19 Oct 2020 22:23:21 +0200 Subject: [PATCH] Only forward config entry to each platform once Fixes #94 --- custom_components/localtuya/__init__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/custom_components/localtuya/__init__.py b/custom_components/localtuya/__init__.py index f60908d..d2c17cf 100644 --- a/custom_components/localtuya/__init__.py +++ b/custom_components/localtuya/__init__.py @@ -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()