@@ -197,14 +197,13 @@ def update(self, attributes_data: dict[str, Any]) -> None:
197
197
for attribute_path , attribute_value in attributes_data .items ():
198
198
self .set_attribute_value (attribute_path , attribute_value )
199
199
# extract device types from Descriptor Cluster
200
- cluster = self .get_cluster (Clusters .Descriptor )
201
- assert cluster is not None
202
- for dev_info in cluster .deviceTypeList : # type: ignore[unreachable]
203
- device_type = DEVICE_TYPES .get (dev_info .deviceType )
204
- if device_type is None :
205
- LOGGER .debug ("Found unknown device type %s" , dev_info )
206
- continue
207
- self .device_types .add (device_type )
200
+ if cluster := self .get_cluster (Clusters .Descriptor ):
201
+ for dev_info in cluster .deviceTypeList : # type: ignore[unreachable]
202
+ device_type = DEVICE_TYPES .get (dev_info .deviceType )
203
+ if device_type is None :
204
+ LOGGER .debug ("Found unknown device type %s" , dev_info )
205
+ continue
206
+ self .device_types .add (device_type )
208
207
209
208
def __repr__ (self ) -> str :
210
209
"""Return the representation."""
@@ -326,7 +325,13 @@ def update(self, node_data: MatterNodeData) -> None:
326
325
# (as that will also use partsList to indicate its child's)
327
326
continue
328
327
descriptor = endpoint .get_cluster (Clusters .Descriptor )
329
- assert descriptor is not None
328
+ if descriptor is None :
329
+ LOGGER .warning (
330
+ "Found endpoint without a Descriptor: Node %s, endpoint %s" ,
331
+ self .node_id ,
332
+ endpoint .endpoint_id ,
333
+ )
334
+ continue
330
335
if descriptor .partsList : # type: ignore[unreachable]
331
336
for endpoint_id in descriptor .partsList :
332
337
self ._composed_endpoints [endpoint_id ] = endpoint .endpoint_id
0 commit comments