mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
RFC: Deprecate auto target all for services and introduce entity_id: * (#19006)
* Deprecate auto target all * Match on word 'all'
This commit is contained in:
@@ -6,7 +6,7 @@ from os import path
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.auth.permissions.const import POLICY_CONTROL
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ENTITY_MATCH_ALL
|
||||
import homeassistant.core as ha
|
||||
from homeassistant.exceptions import TemplateError, Unauthorized, UnknownUser
|
||||
from homeassistant.helpers import template
|
||||
@@ -197,7 +197,12 @@ async def entity_service_call(hass, platforms, func, call):
|
||||
entity_perms = None
|
||||
|
||||
# Are we trying to target all entities
|
||||
target_all_entities = ATTR_ENTITY_ID not in call.data
|
||||
if ATTR_ENTITY_ID in call.data:
|
||||
target_all_entities = call.data[ATTR_ENTITY_ID] == ENTITY_MATCH_ALL
|
||||
else:
|
||||
_LOGGER.warning('Not passing an entity ID to a service to target all '
|
||||
'entities is deprecated. Use instead: entity_id: "*"')
|
||||
target_all_entities = True
|
||||
|
||||
if not target_all_entities:
|
||||
# A set of entities we're trying to target.
|
||||
|
||||
Reference in New Issue
Block a user