diff --git a/src/controller/python/chip/clusters/Attribute.py b/src/controller/python/chip/clusters/Attribute.py index fc2ec8ec20ba7d..36d6e343f52b13 100644 --- a/src/controller/python/chip/clusters/Attribute.py +++ b/src/controller/python/chip/clusters/Attribute.py @@ -408,9 +408,14 @@ def UpdateCachedData(self): endpointCache = attributeCache[endpoint] for cluster in tlvCache[endpoint]: + if cluster not in _ClusterIndex: + # + # #22599 tracks dealing with unknown clusters more + # gracefully so that clients can still access this data. + # + continue + clusterType = _ClusterIndex[cluster] - if (clusterType is None): - raise Exception("Cannot find cluster in cluster index") if (clusterType not in endpointCache): endpointCache[clusterType] = {} @@ -427,9 +432,6 @@ def UpdateCachedData(self): endpointCache[clusterType].SetDataVersion( clusterDataVersion) except Exception as ex: - logging.error( - f"Error converting TLV to Cluster Object for path: Endpoint = {endpoint}, cluster = {str(clusterType)}") - logging.error(f"|-- Exception: {repr(ex)}") decodedValue = ValueDecodeFailure( tlvCache[endpoint][cluster], ex) endpointCache[clusterType] = decodedValue @@ -438,27 +440,26 @@ def UpdateCachedData(self): for attribute in tlvCache[endpoint][cluster]: value = tlvCache[endpoint][cluster][attribute] + if (cluster, attribute) not in _AttributeIndex: + # + # #22599 tracks dealing with unknown clusters more + # gracefully so that clients can still access this data. + # + continue + attributeType = _AttributeIndex[( cluster, attribute)][0] - if (attributeType is None): - raise Exception( - "Cannot find attribute in attribute index") if (attributeType not in clusterCache): clusterCache[attributeType] = {} if (type(value) is ValueDecodeFailure): - logging.error( - f"For path: Endpoint = {endpoint}, Attribute = {str(attributeType)}, got IM Error: {str(value.Reason)}") clusterCache[attributeType] = value else: try: decodedValue = attributeType.FromTagDictOrRawValue( tlvCache[endpoint][cluster][attribute]) except Exception as ex: - logging.error( - f"Error converting TLV to Cluster Object for path: Endpoint = {endpoint}, Attribute = {str(attributeType)}") - logging.error(f"|-- Exception: {repr(ex)}") decodedValue = ValueDecodeFailure(value, ex) clusterCache[attributeType] = decodedValue diff --git a/src/controller/python/chip/clusters/attribute.cpp b/src/controller/python/chip/clusters/attribute.cpp index 488c1bc1c47521..0c90495ae4bf00 100644 --- a/src/controller/python/chip/clusters/attribute.cpp +++ b/src/controller/python/chip/clusters/attribute.cpp @@ -135,10 +135,7 @@ class ReadClientCallback : public ReadClient::Callback { version = aPath.mDataVersion.Value(); } - else - { - ChipLogError(DataManagement, "expect aPath has valid mDataVersion"); - } + gOnReadAttributeDataCallback(mAppContext, version, aPath.mEndpointId, aPath.mClusterId, aPath.mAttributeId, to_underlying(aStatus.mStatus), buffer.get(), size); }