1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Warn when using custom components (#15172)

* Warn when using custom components

* Update text
This commit is contained in:
Paulus Schoutsen
2018-06-27 15:21:32 -04:00
committed by GitHub
parent c0b6a857f7
commit 742144f401
2 changed files with 19 additions and 1 deletions

View File

@@ -81,7 +81,7 @@ def get_component(hass, comp_or_platform) -> Optional[ModuleType]:
potential_paths = ['custom_components.{}'.format(comp_or_platform),
'homeassistant.components.{}'.format(comp_or_platform)]
for path in potential_paths:
for index, path in enumerate(potential_paths):
try:
module = importlib.import_module(path)
@@ -100,6 +100,14 @@ def get_component(hass, comp_or_platform) -> Optional[ModuleType]:
cache[comp_or_platform] = module
if index == 0:
_LOGGER.warning(
'You are using a custom component for %s which has not '
'been tested by Home Assistant. This component might '
'cause stability problems, be sure to disable it if you '
'do experience issues with Home Assistant.',
comp_or_platform)
return module
except ImportError as err: