From 9493f17de6794da6683bb04febe721d7b2c1b2f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20St=C3=A5hl?= Date: Tue, 15 Sep 2020 12:29:07 +0200 Subject: [PATCH] Forward config entry only to used platforms --- custom_components/localtuya/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/localtuya/__init__.py b/custom_components/localtuya/__init__.py index 022bffb..78ec375 100644 --- a/custom_components/localtuya/__init__.py +++ b/custom_components/localtuya/__init__.py @@ -16,7 +16,7 @@ from homeassistant.const import ( import homeassistant.helpers.config_validation as cv from . import pytuya -from .const import CONF_LOCAL_KEY, CONF_PROTOCOL_VERSION, DOMAIN, PLATFORMS +from .const import CONF_LOCAL_KEY, CONF_PROTOCOL_VERSION, DOMAIN DEFAULT_ID = "1" @@ -75,7 +75,7 @@ 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: + for component in set(entity[CONF_PLATFORM] for entity in entry.data[CONF_ENTITIES]): hass.async_create_task( hass.config_entries.async_forward_entry_setup(entry, component) )