Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions homeassistant/helpers/entity_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,24 +172,13 @@ async def async_unload_entry(self, config_entry):
async def async_extract_from_service(self, service, expand_group=True):
"""Extract all known and available entities from a service call.

Will return all entities if no entities specified in call.
Will return an empty list if entities specified but unknown.

This method must be run in the event loop.
"""
data_ent_id = service.data.get(ATTR_ENTITY_ID)

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 "
"entities is deprecated. Update your call to %s.%s to be "
"instead: entity_id: %s",
service.domain,
service.service,
ENTITY_MATCH_ALL,
)

if data_ent_id in (ENTITY_MATCH_ALL):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a bug. you now check if data_ent_id is a valid subscring of ENTITY_MATCH_ALL

Suggested change
if data_ent_id in (ENTITY_MATCH_ALL):
if data_ent_id == ENTITY_MATCH_ALL:

return [entity for entity in self.entities if entity.available]

entity_ids = await async_extract_entity_ids(self.hass, service, expand_group)
Expand Down
9 changes: 2 additions & 7 deletions homeassistant/helpers/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,8 @@ async def entity_service_call(
else:
# Remove the service_name parameter along with this warning
_LOGGER.warning(
"Not passing an entity ID to a service to target all "
"entities is deprecated. Update your call to %s to be "
"instead: entity_id: %s",
service_name,
ENTITY_MATCH_ALL,
)
target_all_entities = True
'Not passing an entity ID to a service to target all '
'entities is not supported.', service_name, ENTITY_MATCH_ALL)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment above this logging statement mentions that the service_name function parameter was only used for this warning and should be removed along with it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still want a warning? or should I drop the warning all together.


if not target_all_entities:
# A set of entities we're trying to target.
Expand Down