From fa303cd9bc2329400374d6ecb3333f29b24f21a9 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Mon, 24 Apr 2023 16:24:48 +0200 Subject: [PATCH] Fix schema not found error on vendor specific data (#26120) --- src/controller/python/chip/clusters/Attribute.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/controller/python/chip/clusters/Attribute.py b/src/controller/python/chip/clusters/Attribute.py index 1bd60cbf23501d..3660d31234f0fe 100644 --- a/src/controller/python/chip/clusters/Attribute.py +++ b/src/controller/python/chip/clusters/Attribute.py @@ -146,7 +146,7 @@ def __init__(self, ClusterType: Cluster = None, AttributeType: ClusterAttributeD break if (self.ClusterType is None or self.AttributeType is None): - raise Exception("Schema not found") + raise KeyError(f"No Schema found for Attribute {Path}") # Next, let's figure out the label. for field in self.ClusterType.descriptor.Fields: @@ -156,7 +156,7 @@ def __init__(self, ClusterType: Cluster = None, AttributeType: ClusterAttributeD self.AttributeName = field.Label if (self.AttributeName is None): - raise Exception("Schema not found") + raise KeyError(f"Unable to resolve name for Attribute {Path}") self.Path = Path self.ClusterId = self.ClusterType.id @@ -745,8 +745,14 @@ def _handleReportEnd(self): if (self._subscription_handler is not None): for change in self._changedPathSet: + try: + attribute_path = TypedAttributePath(Path=change) + except (KeyError, ValueError) as err: + # path could not be resolved into a TypedAttributePath + logging.getLogger(__name__).exception(err) + continue self._subscription_handler.OnAttributeChangeCb( - TypedAttributePath(Path=change), self._subscription_handler) + attribute_path, self._subscription_handler) # Clear it out once we've notified of all changes in this transaction. self._changedPathSet = set()