From 1218127d8372d3792abbd6546f375bed12221463 Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Mon, 21 Jan 2019 01:33:11 +0100 Subject: [PATCH] Fix 'all' entity_id in service call extraction (#20281) --- homeassistant/helpers/entity_component.py | 5 +++-- tests/helpers/test_entity_component.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/helpers/entity_component.py b/homeassistant/helpers/entity_component.py index ce876991097..21634121cd2 100644 --- a/homeassistant/helpers/entity_component.py +++ b/homeassistant/helpers/entity_component.py @@ -7,7 +7,8 @@ import logging from homeassistant import config as conf_util from homeassistant.setup import async_prepare_setup_platform from homeassistant.const import ( - ATTR_ENTITY_ID, CONF_SCAN_INTERVAL, CONF_ENTITY_NAMESPACE, MATCH_ALL) + ATTR_ENTITY_ID, CONF_SCAN_INTERVAL, CONF_ENTITY_NAMESPACE, + ENTITY_MATCH_ALL) from homeassistant.core import callback from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import config_per_platform, discovery @@ -163,7 +164,7 @@ class EntityComponent: """ data_ent_id = service.data.get(ATTR_ENTITY_ID) - if data_ent_id in (None, MATCH_ALL): + if data_ent_id in (None, ENTITY_MATCH_ALL): if data_ent_id is None: self.logger.warning( 'Not passing an entity ID to a service to target all ' diff --git a/tests/helpers/test_entity_component.py b/tests/helpers/test_entity_component.py index 8f54f0ee5bc..27e33a4fe7d 100644 --- a/tests/helpers/test_entity_component.py +++ b/tests/helpers/test_entity_component.py @@ -479,7 +479,7 @@ async def test_extract_all_use_match_all(hass, caplog): MockEntity(name='test_2'), ]) - call = ha.ServiceCall('test', 'service', {'entity_id': '*'}) + call = ha.ServiceCall('test', 'service', {'entity_id': 'all'}) assert ['test_domain.test_1', 'test_domain.test_2'] == \ sorted(ent.entity_id for ent in