From 38d132addd66c8be1ba400ec16adcfabced69a8a Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sat, 3 Oct 2020 20:55:59 +0200 Subject: [PATCH] Fix referenced entity extraction when service call entity contains a template (#41107) --- homeassistant/helpers/script.py | 2 +- tests/helpers/test_script.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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",