Handle empty service in script action gracefully (#27467)

* Handle empty service in script action gracefully

* Add test
This commit is contained in:
Erik Montnemery 2019-10-12 21:28:47 +02:00 committed by Paulus Schoutsen
parent ee8b72fb71
commit 42691b783e
2 changed files with 20 additions and 0 deletions

View file

@ -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))