|
| 1 | +From 487dd7eb7f7d52e7050770abde0cf0f16ac7e07d Mon Sep 17 00:00:00 2001 |
| 2 | +Message-Id: <487dd7eb7f7d52e7050770abde0cf0f16ac7e07d.1681718701.git.stefan@agner.ch> |
| 3 | +In-Reply-To: <60ee727300ce3685624cbece545f81d3c6350a8b.1681718701.git.stefan@agner.ch> |
| 4 | +References: <60ee727300ce3685624cbece545f81d3c6350a8b.1681718701.git.stefan@agner.ch> |
| 5 | +From: Marcel van der Veldt <m.vanderveldt@outlook.com> |
| 6 | +Date: Mon, 17 Apr 2023 09:39:20 +0200 |
| 7 | +Subject: [PATCH] Fix schema not found error on vendor specific data |
| 8 | + |
| 9 | +--- |
| 10 | + src/controller/python/chip/clusters/Attribute.py | 12 +++++++++--- |
| 11 | + 1 file changed, 9 insertions(+), 3 deletions(-) |
| 12 | + |
| 13 | +diff --git a/src/controller/python/chip/clusters/Attribute.py b/src/controller/python/chip/clusters/Attribute.py |
| 14 | +index 68499a5b9..4272501bf 100644 |
| 15 | +--- a/src/controller/python/chip/clusters/Attribute.py |
| 16 | ++++ b/src/controller/python/chip/clusters/Attribute.py |
| 17 | +@@ -147,7 +147,7 @@ class TypedAttributePath: |
| 18 | + break |
| 19 | + |
| 20 | + if (self.ClusterType is None or self.AttributeType is None): |
| 21 | +- raise Exception("Schema not found") |
| 22 | ++ raise KeyError(f"No Schema found for Attribute {Path}") |
| 23 | + |
| 24 | + # Next, let's figure out the label. |
| 25 | + for field in self.ClusterType.descriptor.Fields: |
| 26 | +@@ -157,7 +157,7 @@ class TypedAttributePath: |
| 27 | + self.AttributeName = field.Label |
| 28 | + |
| 29 | + if (self.AttributeName is None): |
| 30 | +- raise Exception("Schema not found") |
| 31 | ++ raise KeyError(f"Unable to resolve name for Attribute {Path}") |
| 32 | + |
| 33 | + self.Path = Path |
| 34 | + self.ClusterId = self.ClusterType.id |
| 35 | +@@ -746,8 +746,14 @@ class AsyncReadTransaction: |
| 36 | + |
| 37 | + if (self._subscription_handler is not None): |
| 38 | + for change in self._changedPathSet: |
| 39 | ++ try: |
| 40 | ++ attribute_path = TypedAttributePath(Path=change) |
| 41 | ++ except (KeyError, ValueError) as err: |
| 42 | ++ # path could not be resolved into a TypedAttributePath |
| 43 | ++ logging.getLogger(__name__).exception(err) |
| 44 | ++ continue |
| 45 | + self._subscription_handler.OnAttributeChangeCb( |
| 46 | +- TypedAttributePath(Path=change), self._subscription_handler) |
| 47 | ++ attribute_path, self._subscription_handler) |
| 48 | + |
| 49 | + # Clear it out once we've notified of all changes in this transaction. |
| 50 | + self._changedPathSet = set() |
| 51 | +-- |
| 52 | +2.40.0 |
| 53 | + |
0 commit comments