Custom component loading cleanup (#14211)
* Clean up custom component loading * Fix some tests * Fix some stuff * Make imports work again * Fix tests * Remove debug print * Lint
This commit is contained in:
parent
5d96751168
commit
83d300fd11
50 changed files with 315 additions and 392 deletions
|
@ -12,7 +12,6 @@ from typing import Any, Union, TypeVar, Callable, Sequence, Dict
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.loader import get_platform
|
||||
from homeassistant.const import (
|
||||
CONF_PLATFORM, CONF_SCAN_INTERVAL, TEMP_CELSIUS, TEMP_FAHRENHEIT,
|
||||
CONF_ALIAS, CONF_ENTITY_ID, CONF_VALUE_TEMPLATE, WEEKDAYS,
|
||||
|
@ -283,19 +282,6 @@ def match_all(value):
|
|||
return value
|
||||
|
||||
|
||||
def platform_validator(domain):
|
||||
"""Validate if platform exists for given domain."""
|
||||
def validator(value):
|
||||
"""Test if platform exists."""
|
||||
if value is None:
|
||||
raise vol.Invalid('platform cannot be None')
|
||||
if get_platform(domain, str(value)):
|
||||
return value
|
||||
raise vol.Invalid(
|
||||
'platform {} does not exist for {}'.format(value, domain))
|
||||
return validator
|
||||
|
||||
|
||||
def positive_timedelta(value: timedelta) -> timedelta:
|
||||
"""Validate timedelta is positive."""
|
||||
if value < timedelta(0):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue