Make async_extract_entities generic (#78490)
parent
635ed562ee
commit
8300f8234c
|
@ -186,7 +186,7 @@ class EntityComponent(Generic[_EntityT]):
|
|||
|
||||
This method must be run in the event loop.
|
||||
"""
|
||||
return await service.async_extract_entities( # type: ignore[return-value]
|
||||
return await service.async_extract_entities(
|
||||
self.hass, self.entities, service_call, expand_group
|
||||
)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ from collections.abc import Awaitable, Callable, Iterable
|
|||
import dataclasses
|
||||
from functools import partial, wraps
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, Any, TypedDict
|
||||
from typing import TYPE_CHECKING, Any, TypedDict, TypeVar
|
||||
|
||||
from typing_extensions import TypeGuard
|
||||
import voluptuous as vol
|
||||
|
@ -48,6 +48,8 @@ if TYPE_CHECKING:
|
|||
from .entity import Entity
|
||||
from .entity_platform import EntityPlatform
|
||||
|
||||
_EntityT = TypeVar("_EntityT", bound=Entity)
|
||||
|
||||
|
||||
CONF_SERVICE_ENTITY_ID = "entity_id"
|
||||
CONF_SERVICE_DATA_TEMPLATE = "data_template"
|
||||
|
@ -276,10 +278,10 @@ def extract_entity_ids(
|
|||
@bind_hass
|
||||
async def async_extract_entities(
|
||||
hass: HomeAssistant,
|
||||
entities: Iterable[Entity],
|
||||
entities: Iterable[_EntityT],
|
||||
service_call: ServiceCall,
|
||||
expand_group: bool = True,
|
||||
) -> list[Entity]:
|
||||
) -> list[_EntityT]:
|
||||
"""Extract a list of entity objects from a service call.
|
||||
|
||||
Will convert group entity ids to the entity ids it represents.
|
||||
|
|
Loading…
Reference in New Issue