Skip to content

Dev tools/Service calls with target.label_id set do not work when label is attached to specific entites #115608

Description

@kquinsland

The problem

After the 2024.04 update, it is now possible to select labels as "targets" of service calls like so!

In the screenshot below, I've selected a label called regime/night and a specific entity.

ha_issue01

The equivalent yaml:

service: button.press
target:
  label_id: regime_night
  entity_id: button.kitchen_switch_nighttime_mode
data: {}

The above works. The issue is when the specific entity is removed and only the label is used for targeting:

ha_issue02

service: button.press
target:
  label_id: regime_night
data: {}

In this case, clicking the "call" button does nothing. But the entity button.kitchen_switch_nighttime_mode does have the regime_night label applied:

ha_issue03

I believe this is an issue with backed and not front-end because in both cases, clicking the Call Service button yields this in my logs:

INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script                                                                                 │
INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service          

And the button briefly changes to a green checkmark to indicate no errors.

A workaround

It is possible to work around this issue by explicitly resolving the list of entities with the label and passing that list in via target.entity_id like so:

service: button.press
target:
  entity_id: "{{ label_entities('regime_night') }}"

But this has the downside of not being able to use the UI. Depending on the service being called, loosing the UI for quickly customizing all the possible arguments can be rather frustrating.

Additional Information:

Version 	core-2024.4.3
Installation Type 	Unknown
Development 	false
Supervisor 	false
Docker 	false
User 	root
Virtual Environment 	false
Python Version 	3.12.2
Operating System Family 	Linux
Operating System Version 	5.15.0-101-generic
CPU Architecture 	x86_64
Timezone 	America/Los_Angeles
Configuration Directory 	/config

What version of Home Assistant Core has the issue?

core-2024.4.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions