Add domain key config validation (#104242)
* Drop use of regex in helpers.extract_domain_configs * Update test * Revert test update * Add domain_from_config_key helper * Add validator * Address review comment * Update snapshots * Inline domain_from_config_key in validator
This commit is contained in:
parent
25bea91683
commit
3bcc6194ef
19 changed files with 144 additions and 9 deletions
|
@ -27,6 +27,7 @@ from .const import (
|
|||
from .exceptions import HomeAssistantError
|
||||
from .helpers import (
|
||||
area_registry,
|
||||
config_validation as cv,
|
||||
device_registry,
|
||||
entity,
|
||||
entity_registry,
|
||||
|
@ -473,7 +474,9 @@ async def async_mount_local_lib_path(config_dir: str) -> str:
|
|||
def _get_domains(hass: core.HomeAssistant, config: dict[str, Any]) -> set[str]:
|
||||
"""Get domains of components to set up."""
|
||||
# Filter out the repeating and common config section [homeassistant]
|
||||
domains = {key.partition(" ")[0] for key in config if key != core.DOMAIN}
|
||||
domains = {
|
||||
domain for key in config if (domain := cv.domain_key(key)) != core.DOMAIN
|
||||
}
|
||||
|
||||
# Add config entry domains
|
||||
if not hass.config.recovery_mode:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue