Skip to content

Commit

Permalink
Print error instead of warning for custom platforms in legacy format (#…
Browse files Browse the repository at this point in the history
…22486)

* Legacy platform format prints error

* Enforce no partial overlays
  • Loading branch information
balloob committed Mar 28, 2019
1 parent 7741ec4 commit a69080b
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions homeassistant/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down

0 comments on commit a69080b

Please sign in to comment.