Add value is not to Matter discovery schema logic (#136157)

This commit is contained in:
Marcel van der Veldt 2025-01-21 10:15:32 +01:00 committed by GitHub
parent 364556a7dd
commit f422ad22c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View File

@ -130,6 +130,15 @@ def async_discover_entities(
):
continue
# check for value that may not be present
if schema.value_is_not is not None and (
schema.value_is_not == primary_value
or (
isinstance(primary_value, list) and schema.value_is_not in primary_value
)
):
continue
# check for required value in cluster featuremap
if schema.featuremap_contains is not None and (
not bool(

View File

@ -116,6 +116,11 @@ class MatterDiscoverySchema:
# NOTE: only works for list values
value_contains: Any | None = None
# [optional] the primary attribute value must NOT have this value
# for example to filter out invalid values (such as empty string instead of null)
# in case of a list value, the list may not contain this value
value_is_not: Any | None = None
# [optional] the primary attribute's cluster featuremap must contain this value
# for example for the DoorSensor on a DoorLock Cluster
featuremap_contains: int | None = None