From e94a7b2ec12f1da647d33089760bdffaf7af1633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20BOU=C3=89?= Date: Thu, 28 Aug 2025 15:57:40 +0200 Subject: [PATCH] Add `product_id` support to Matter discovery schemas (#151307) --- homeassistant/components/matter/discovery.py | 7 +++++++ homeassistant/components/matter/models.py | 3 +++ homeassistant/components/matter/select.py | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/matter/discovery.py b/homeassistant/components/matter/discovery.py index 8042b7505f4..278eb8b7e83 100644 --- a/homeassistant/components/matter/discovery.py +++ b/homeassistant/components/matter/discovery.py @@ -78,6 +78,13 @@ def async_discover_entities( ): continue + # check product_id + if ( + schema.product_id is not None + and device_info.productID not in schema.product_id + ): + continue + # check product_name if ( schema.product_name is not None diff --git a/homeassistant/components/matter/models.py b/homeassistant/components/matter/models.py index 4af7cc3c026..acdcc53f660 100644 --- a/homeassistant/components/matter/models.py +++ b/homeassistant/components/matter/models.py @@ -100,6 +100,9 @@ class MatterDiscoverySchema: # [optional] the endpoint's vendor_id must match ANY of these values vendor_id: tuple[int, ...] | None = None + # [optional] the endpoint's product_id must match ANY of these values + product_id: tuple[int, ...] | None = None + # [optional] the endpoint's product_name must match ANY of these values product_name: tuple[str, ...] | None = None diff --git a/homeassistant/components/matter/select.py b/homeassistant/components/matter/select.py index 92b451d5265..665e9041be7 100644 --- a/homeassistant/components/matter/select.py +++ b/homeassistant/components/matter/select.py @@ -525,6 +525,6 @@ DISCOVERY_SCHEMAS = [ clusters.BooleanStateConfiguration.Attributes.CurrentSensitivityLevel, ), vendor_id=(4447,), - product_name=("Aqara Door and Window Sensor P2",), + product_id=(8194,), ), ]