Move group helpers into their own module (#106924)

This gets rid of the legacy need to use bind_hass, and
the expand function no longer looses typing.
This commit is contained in:
J. Nick Koston 2024-01-04 06:34:56 -10:00 committed by GitHub
parent 6a02cadc13
commit 0695bf8988
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 181 additions and 61 deletions

View file

@ -53,6 +53,7 @@ from . import (
template,
translation,
)
from .group import expand_entity_ids
from .selector import TargetSelector
from .typing import ConfigType, TemplateVarsType
@ -459,9 +460,9 @@ def async_extract_referenced_entity_ids(
if not selector.has_any_selector:
return selected
entity_ids = selector.entity_ids
entity_ids: set[str] | list[str] = selector.entity_ids
if expand_group:
entity_ids = hass.components.group.expand_entity_ids(entity_ids)
entity_ids = expand_entity_ids(hass, entity_ids)
selected.referenced.update(entity_ids)