Fix dev branch (#22493)

This commit is contained in:
Jason Hu 2019-03-28 03:09:12 -07:00 committed by Pascal Vizeli
parent 4db224ceb5
commit 8d86722c0e
4 changed files with 16 additions and 5 deletions

View file

@ -83,7 +83,11 @@ def get_platform(hass, # type: HomeAssistant
"""
# If the platform has a component, we will limit the platform loading path
# to be the same source (custom/built-in).
component = _load_file(hass, platform_name, LOOKUP_PATHS)
if domain not in ['automation', 'mqtt', 'telegram_bot']:
component = _load_file(hass, platform_name, LOOKUP_PATHS)
else:
# avoid load component for legacy platform
component = None
# Until we have moved all platforms under their component/own folder, it
# can be that the component is None.
@ -99,6 +103,14 @@ def get_platform(hass, # type: HomeAssistant
if platform is not None:
return platform
# Legacy platform check for automation: components/automation/event.py
if component is None and domain in ['automation', 'mqtt', 'telegram_bot']:
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: