Skip to content

Commit

Permalink
[Python] AttributeReadResult export dataversion (#26943)
Browse files Browse the repository at this point in the history
* [Python] export dataversion field

* dataversion does not need a default value

* fix CI
  • Loading branch information
tianfeng-yang authored and pull[bot] committed Nov 15, 2023
1 parent d916d04 commit 1499552
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/controller/python/chip/ChipDeviceCtrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ def ZCLReadAttribute(self, cluster, attribute, nodeid, endpoint, groupid, blocki
nodeid, [(endpoint, attributeType)]))
path = ClusterAttribute.AttributePath(
EndpointId=endpoint, Attribute=attributeType)
return im.AttributeReadResult(path=im.AttributePath(nodeId=nodeid, endpointId=path.EndpointId, clusterId=path.ClusterId, attributeId=path.AttributeId), status=0, value=result[endpoint][clusterType][attributeType])
return im.AttributeReadResult(path=im.AttributePath(nodeId=nodeid, endpointId=path.EndpointId, clusterId=path.ClusterId, attributeId=path.AttributeId), status=0, value=result[endpoint][clusterType][attributeType], dataVersion=result[endpoint][clusterType][ClusterAttribute.DataVersion])

def ZCLWriteAttribute(self, cluster: str, attribute: str, nodeid, endpoint, groupid, value, dataVersion=0, blocking=True):
req = None
Expand Down
1 change: 1 addition & 0 deletions src/controller/python/chip/clusters/Attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ class AttributeWriteRequest(AttributeDescriptorWithEndpoint):
@dataclass
class AttributeReadResult(AttributeStatus):
Data: Any = None
DataVersion: int = 0


@dataclass
Expand Down
1 change: 1 addition & 0 deletions src/controller/python/chip/interaction_model/delegate.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class AttributeReadResult:
path: AttributePath
status: int
value: 'typing.Any'
dataVersion: int


@dataclass
Expand Down
3 changes: 2 additions & 1 deletion src/test_driver/openiotsdk/integration-tests/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ def read_zcl_attribute(devCtrl, cluster: str, attribute: str, nodeId: int, endpo
EndpointId=endpoint, Attribute=attributeObj)

res = IM.AttributeReadResult(path=IM.AttributePath(nodeId=nodeId, endpointId=path.EndpointId, clusterId=path.ClusterId,
attributeId=path.AttributeId), status=0, value=result[endpoint][clusterObj][attributeObj])
attributeId=path.AttributeId), status=0, value=result[endpoint][clusterObj][attributeObj],
dataVersion=result[endpoint][clusterObj][ClusterAttribute.DataVersion])

except exceptions.ChipStackException as ex:
log.error("An exception occurred during processing ZCL attribute: {}".format(str(ex)))
Expand Down

0 comments on commit 1499552

Please sign in to comment.