@@ -1170,33 +1170,26 @@ def _parseAttributePathTuple(self, pathTuple: typing.Union[
1170
1170
# Concrete path
1171
1171
typing .Tuple [int , typing .Type [ClusterObjects .ClusterAttributeDescriptor ]]
1172
1172
]):
1173
- endpoint = None
1174
- cluster = None
1175
- attribute = None
1176
-
1177
1173
if pathTuple == ('*' ) or pathTuple == ():
1178
1174
# Wildcard
1179
- pass
1175
+ return ClusterAttribute . AttributePath ()
1180
1176
elif not isinstance (pathTuple , tuple ):
1181
1177
if isinstance (pathTuple , int ):
1182
- endpoint = pathTuple
1178
+ return ClusterAttribute . AttributePath ( EndpointId = pathTuple )
1183
1179
elif issubclass (pathTuple , ClusterObjects .Cluster ):
1184
- cluster = pathTuple
1180
+ return ClusterAttribute . AttributePath . from_cluster ( EndpointId = None , Cluster = pathTuple )
1185
1181
elif issubclass (pathTuple , ClusterObjects .ClusterAttributeDescriptor ):
1186
- attribute = pathTuple
1182
+ return ClusterAttribute . AttributePath . from_attribute ( EndpointId = None , Attribute = pathTuple )
1187
1183
else :
1188
1184
raise ValueError ("Unsupported Attribute Path" )
1189
1185
else :
1190
1186
# endpoint + (cluster) attribute / endpoint + cluster
1191
- endpoint = pathTuple [0 ]
1192
1187
if issubclass (pathTuple [1 ], ClusterObjects .Cluster ):
1193
- cluster = pathTuple [1 ]
1188
+ return ClusterAttribute . AttributePath . from_cluster ( EndpointId = pathTuple [ 0 ], Cluster = pathTuple [1 ])
1194
1189
elif issubclass (pathTuple [1 ], ClusterAttribute .ClusterAttributeDescriptor ):
1195
- attribute = pathTuple [1 ]
1190
+ return ClusterAttribute . AttributePath . from_attribute ( EndpointId = pathTuple [ 0 ], Attribute = pathTuple [1 ])
1196
1191
else :
1197
1192
raise ValueError ("Unsupported Attribute Path" )
1198
- return ClusterAttribute .AttributePath (
1199
- EndpointId = endpoint , Cluster = cluster , Attribute = attribute )
1200
1193
1201
1194
def _parseDataVersionFilterTuple (self , pathTuple : typing .List [typing .Tuple [int , typing .Type [ClusterObjects .Cluster ], int ]]):
1202
1195
endpoint = None
@@ -1530,7 +1523,7 @@ def ZCLReadAttribute(self, cluster, attribute, nodeid, endpoint, groupid, blocki
1530
1523
1531
1524
result = asyncio .run (self .ReadAttribute (
1532
1525
nodeid , [(endpoint , attributeType )]))
1533
- path = ClusterAttribute .AttributePath (
1526
+ path = ClusterAttribute .AttributePath . from_attribute (
1534
1527
EndpointId = endpoint , Attribute = attributeType )
1535
1528
return im .AttributeReadResult (path = im .AttributePath (nodeId = nodeid , endpointId = path .EndpointId , clusterId = path .ClusterId , attributeId = path .AttributeId ),
1536
1529
status = 0 , value = result [endpoint ][clusterType ][attributeType ], dataVersion = result [endpoint ][clusterType ][ClusterAttribute .DataVersion ])
0 commit comments