diff --git a/homeassistant/helpers/script.py b/homeassistant/helpers/script.py index 378a6016c20..1cac4679d82 100644 --- a/homeassistant/helpers/script.py +++ b/homeassistant/helpers/script.py @@ -201,6 +201,10 @@ class Script: continue entity_ids = data.get(ATTR_ENTITY_ID) + + if entity_ids is None: + continue + if isinstance(entity_ids, str): entity_ids = [entity_ids] diff --git a/tests/helpers/test_script.py b/tests/helpers/test_script.py index b226ed15720..5e748e3adfe 100644 --- a/tests/helpers/test_script.py +++ b/tests/helpers/test_script.py @@ -1043,6 +1043,7 @@ async def test_referenced_entities(): "entity_id": "sensor.condition", "state": "100", }, + {"service": "test.script", "data": {"without": "entity_id"}}, {"scene": "scene.hello"}, {"event": "test_event"}, {"delay": "{{ delay_period }}"},