diff --git a/homeassistant/helpers/script.py b/homeassistant/helpers/script.py index 717e9c3980c..05808d3bcd5 100644 --- a/homeassistant/helpers/script.py +++ b/homeassistant/helpers/script.py @@ -850,7 +850,7 @@ class Script: entity_ids = data.get(ATTR_ENTITY_ID) - if entity_ids is None: + if entity_ids is None or isinstance(entity_ids, template.Template): continue if isinstance(entity_ids, str): diff --git a/tests/helpers/test_script.py b/tests/helpers/test_script.py index 0bd353e1fa0..936866b4306 100644 --- a/tests/helpers/test_script.py +++ b/tests/helpers/test_script.py @@ -1332,6 +1332,10 @@ async def test_referenced_entities(hass): "service": "test.script", "data": {"entity_id": ["light.service_list"]}, }, + { + "service": "test.script", + "data": {"entity_id": "{{ 'light.service_template' }}"}, + }, { "condition": "state", "entity_id": "sensor.condition",