Print error instead of warning for custom platforms in legacy format (#22486)

* Legacy platform format prints error

* Enforce no partial overlays
This commit is contained in:
Paulus Schoutsen 2019-03-27 20:52:28 -07:00 committed by GitHub
parent 7741ec4d5a
commit a69080ba73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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