Handle empty service in script action gracefully (#27467)
* Handle empty service in script action gracefully * Add test
This commit is contained in:
parent
ee8b72fb71
commit
42691b783e
2 changed files with 20 additions and 0 deletions
|
@ -386,6 +386,7 @@ def remove_falsy(value: List[T]) -> List[T]:
|
|||
def service(value):
|
||||
"""Validate service."""
|
||||
# Services use same format as entities so we can use same helper.
|
||||
value = string(value).lower()
|
||||
if valid_entity_id(value):
|
||||
return value
|
||||
raise vol.Invalid("Service {} does not match format <domain>.<name>".format(value))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue