diff --git a/homeassistant/loader.py b/homeassistant/loader.py index e36ad5451c1..7f0d50f93d4 100644 --- a/homeassistant/loader.py +++ b/homeassistant/loader.py @@ -99,10 +99,14 @@ def get_platform(hass, # type: HomeAssistant if platform is not None: return platform - # Legacy platform check: light/hue.py - platform = _load_file( - hass, PLATFORM_FORMAT.format(domain=platform_name, platform=domain), - base_paths) + # Legacy platform check for custom: custom_components/light/hue.py + # Only check if the component was also in custom components. + if component is None or base_paths[0] == PACKAGE_CUSTOM_COMPONENTS: + platform = _load_file( + hass, + PLATFORM_FORMAT.format(domain=platform_name, platform=domain), + [PACKAGE_CUSTOM_COMPONENTS] + ) if platform is None: if component is None: @@ -113,11 +117,10 @@ def get_platform(hass, # type: HomeAssistant _LOGGER.error("Unable to find platform %s.%s", platform_name, extra) return None - if platform.__name__.startswith(PACKAGE_CUSTOM_COMPONENTS): - _LOGGER.warning( - "Integrations need to be in their own folder. Change %s/%s.py to " - "%s/%s.py. This will stop working soon.", - domain, platform_name, platform_name, domain) + _LOGGER.error( + "Integrations need to be in their own folder. Change %s/%s.py to " + "%s/%s.py. This will stop working soon.", + domain, platform_name, platform_name, domain) return platform