Compare commits

...

4 Commits

Author SHA1 Message Date
Erik
707f37a81a Fix grammar 2026-03-18 16:52:25 +01:00
Erik
140571fd27 Further improve comment 2026-03-18 15:51:05 +01:00
Erik
94f026dfbd Improve comment and docstring 2026-03-18 15:47:11 +01:00
Erik
19d0fc0e59 Adjust inheritance tree of EntitySelectorConfig 2026-03-18 14:33:13 +01:00

View File

@@ -169,6 +169,21 @@ ENTITY_FILTER_SELECTOR_CONFIG_SCHEMA = vol.Schema(
)
class _LegacyEntityFilterSelectorConfig(TypedDict, total=False):
"""Class for legacy entity filter support in EntitySelectorConfig.
Provided for backwards compatibility and remains feature frozen.
"""
integration: str
domain: str | list[str]
device_class: str | list[str]
# supported_features is not supported by the schema, included here
# to not break instantiation of EntitySelectorConfig when used with
# legacy config that includes supported_features.
supported_features: list[str]
# Legacy entity selector config schema used directly under entity selectors
# is provided for backwards compatibility and remains feature frozen.
# New filtering features should be added under the `filter` key instead.
@@ -888,9 +903,15 @@ class DurationSelector(Selector[DurationSelectorConfig]):
return cast(dict[str, float], data)
class EntitySelectorConfig(BaseSelectorConfig, EntityFilterSelectorConfig, total=False):
class EntitySelectorConfig(
BaseSelectorConfig, _LegacyEntityFilterSelectorConfig, total=False
):
"""Class to represent an entity selector config."""
# Note: The class inherits _LegacyEntityFilterSelectorConfig to keep
# support for legacy entity filter at top level for backwards compatibility,
# new entity filter options should be added under the `filter` key instead.
exclude_entities: list[str]
include_entities: list[str]
multiple: bool