mirror of
https://github.com/home-assistant/core.git
synced 2025-11-13 13:00:11 +00:00
Raise if referenced entity does not support service (#68394)
This commit is contained in:
@@ -527,7 +527,7 @@ def async_set_service_schema(
|
||||
|
||||
|
||||
@bind_hass
|
||||
async def entity_service_call(
|
||||
async def entity_service_call( # noqa: C901
|
||||
hass: HomeAssistant,
|
||||
platforms: Iterable[EntityPlatform],
|
||||
func: str | Callable[..., Any],
|
||||
@@ -646,6 +646,12 @@ async def entity_service_call(
|
||||
for feature_set in required_features
|
||||
)
|
||||
):
|
||||
# If entity explicitly referenced, raise an error
|
||||
if referenced is not None and entity.entity_id in referenced.referenced:
|
||||
raise HomeAssistantError(
|
||||
f"Entity {entity.entity_id} does not support this service."
|
||||
)
|
||||
|
||||
continue
|
||||
|
||||
entities.append(entity)
|
||||
|
||||
Reference in New Issue
Block a user