Don't expose attribute option in state selector (#77347)

This commit is contained in:
Franck Nijhof 2022-08-26 11:51:36 +02:00 committed by GitHub
parent 7fb9c4a37f
commit dfc3e7d80f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -781,7 +781,6 @@ class StateSelectorConfig(TypedDict, total=False):
"""Class to represent an state selector config."""
entity_id: str
attribute: str
@SELECTORS.register("state")
@ -793,7 +792,11 @@ class StateSelector(Selector):
CONFIG_SCHEMA = vol.Schema(
{
vol.Required("entity_id"): cv.entity_id,
vol.Optional("attribute"): str,
# The attribute to filter on, is currently deliberately not
# configurable/exposed. We are considering separating state
# selectors into two types: one for state and one for attribute.
# Limiting the public use, prevents breaking changes in the future.
# vol.Optional("attribute"): str,
}
)

View File

@ -322,11 +322,6 @@ def test_time_selector_schema(schema, valid_selections, invalid_selections):
("on", "armed"),
(None, True, 1),
),
(
{"entity_id": "sensor.abc", "attribute": "device_class"},
("temperature", "humidity"),
(None,),
),
),
)
def test_state_selector_schema(schema, valid_selections, invalid_selections):