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

@@ -23,6 +23,7 @@ from homeassistant.const import (
)
from homeassistant.components.light import (
LightEntity,
DOMAIN,
PLATFORM_SCHEMA,
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
@@ -38,8 +39,6 @@ from .pytuya import TuyaDevice
_LOGGER = logging.getLogger(__name__)
PLATFORM = "light"
MIN_MIRED = 153
MAX_MIRED = 370
UPDATE_RETRY_LIMIT = 3
@@ -55,7 +54,7 @@ def flow_schema(dps):
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Setup a Tuya switch based on a config entry."""
device, entities_to_setup = prepare_setup_entities(
config_entry, PLATFORM
config_entry, DOMAIN
)
if not entities_to_setup:
return
@@ -75,7 +74,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up of the Tuya switch."""
return import_from_yaml(hass, config, PLATFORM)
return import_from_yaml(hass, config, DOMAIN)
class TuyaCache: