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:
parent
7741ec4d5a
commit
a69080ba73
1 changed files with 12 additions and 9 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue