@@ -1433,20 +1433,23 @@ def _parseEventPathTuple(self, pathTuple: typing.Union[
1433
1433
else :
1434
1434
raise ValueError ("Unsupported Attribute Path" )
1435
1435
1436
- async def Read (self , nodeid : int , attributes : typing .Optional [typing .List [typing .Union [
1437
- None , # Empty tuple, all wildcard
1438
- typing .Tuple [int ], # Endpoint
1439
- # Wildcard endpoint, Cluster id present
1440
- typing .Tuple [typing .Type [ClusterObjects .Cluster ]],
1441
- # Wildcard endpoint, Cluster + Attribute present
1442
- typing .Tuple [typing .Type [ClusterObjects .ClusterAttributeDescriptor ]],
1443
- # Wildcard attribute id
1444
- typing .Tuple [int , typing .Type [ClusterObjects .Cluster ]],
1445
- # Concrete path
1446
- typing .Tuple [int , typing .Type [ClusterObjects .ClusterAttributeDescriptor ]],
1447
- # Directly specified attribute path
1448
- ClusterAttribute .AttributePath
1449
- ]]] = None ,
1436
+ async def Read (
1437
+ self ,
1438
+ nodeid : int ,
1439
+ attributes : typing .Optional [typing .List [typing .Union [
1440
+ None , # Empty tuple, all wildcard
1441
+ typing .Tuple [int ], # Endpoint
1442
+ # Wildcard endpoint, Cluster id present
1443
+ typing .Tuple [typing .Type [ClusterObjects .Cluster ]],
1444
+ # Wildcard endpoint, Cluster + Attribute present
1445
+ typing .Tuple [typing .Type [ClusterObjects .ClusterAttributeDescriptor ]],
1446
+ # Wildcard attribute id
1447
+ typing .Tuple [int , typing .Type [ClusterObjects .Cluster ]],
1448
+ # Concrete path
1449
+ typing .Tuple [int , typing .Type [ClusterObjects .ClusterAttributeDescriptor ]],
1450
+ # Directly specified attribute path
1451
+ ClusterAttribute .AttributePath
1452
+ ]]] = None ,
1450
1453
dataVersionFilters : typing .Optional [typing .List [typing .Tuple [int , typing .Type [ClusterObjects .Cluster ], int ]]] = None , events : typing .Optional [typing .List [
1451
1454
typing .Union [
1452
1455
None , # Empty tuple, all wildcard
@@ -1461,10 +1464,11 @@ async def Read(self, nodeid: int, attributes: typing.Optional[typing.List[typing
1461
1464
# Concrete path
1462
1465
typing .Tuple [int , typing .Type [ClusterObjects .ClusterEvent ], int ]
1463
1466
]]] = None ,
1464
- eventNumberFilter : typing .Optional [int ] = None ,
1465
- returnClusterObject : bool = False , reportInterval : typing .Optional [typing .Tuple [int , int ]] = None ,
1466
- fabricFiltered : bool = True , keepSubscriptions : bool = False , autoResubscribe : bool = True ,
1467
- payloadCapability : int = TransportPayloadCapability .MRP_PAYLOAD ):
1467
+ eventNumberFilter : typing .Optional [int ] = None ,
1468
+ returnClusterObject : bool = False , reportInterval : typing .Optional [typing .Tuple [int , int ]] = None ,
1469
+ fabricFiltered : bool = True , keepSubscriptions : bool = False , autoResubscribe : bool = True ,
1470
+ payloadCapability : int = TransportPayloadCapability .MRP_PAYLOAD
1471
+ ):
1468
1472
'''
1469
1473
Read a list of attributes and/or events from a target node
1470
1474
@@ -1534,33 +1538,43 @@ async def Read(self, nodeid: int, attributes: typing.Optional[typing.List[typing
1534
1538
eventPaths = [self ._parseEventPathTuple (
1535
1539
v ) for v in events ] if events else None
1536
1540
1537
- ClusterAttribute .Read (future = future , eventLoop = eventLoop , device = device .deviceProxy , devCtrl = self ,
1541
+ transaction = ClusterAttribute .AsyncReadTransaction (future , eventLoop , self , returnClusterObject )
1542
+ ClusterAttribute .Read (transaction , device = device .deviceProxy ,
1538
1543
attributes = attributePaths , dataVersionFilters = clusterDataVersionFilters , events = eventPaths ,
1539
- eventNumberFilter = eventNumberFilter , returnClusterObject = returnClusterObject ,
1544
+ eventNumberFilter = eventNumberFilter ,
1540
1545
subscriptionParameters = ClusterAttribute .SubscriptionParameters (
1541
1546
reportInterval [0 ], reportInterval [1 ]) if reportInterval else None ,
1542
1547
fabricFiltered = fabricFiltered ,
1543
1548
keepSubscriptions = keepSubscriptions , autoResubscribe = autoResubscribe ).raise_on_error ()
1544
- return await future
1549
+ await future
1545
1550
1546
- async def ReadAttribute (self , nodeid : int , attributes : typing .Optional [typing .List [typing .Union [
1547
- None , # Empty tuple, all wildcard
1548
- typing .Tuple [int ], # Endpoint
1549
- # Wildcard endpoint, Cluster id present
1550
- typing .Tuple [typing .Type [ClusterObjects .Cluster ]],
1551
- # Wildcard endpoint, Cluster + Attribute present
1552
- typing .Tuple [typing .Type [ClusterObjects .ClusterAttributeDescriptor ]],
1553
- # Wildcard attribute id
1554
- typing .Tuple [int , typing .Type [ClusterObjects .Cluster ]],
1555
- # Concrete path
1556
- typing .Tuple [int , typing .Type [ClusterObjects .ClusterAttributeDescriptor ]],
1557
- # Directly specified attribute path
1558
- ClusterAttribute .AttributePath
1559
- ]]], dataVersionFilters : typing .Optional [typing .List [typing .Tuple [int , typing .Type [ClusterObjects .Cluster ], int ]]] = None ,
1560
- returnClusterObject : bool = False ,
1561
- reportInterval : typing .Optional [typing .Tuple [int , int ]] = None ,
1562
- fabricFiltered : bool = True , keepSubscriptions : bool = False , autoResubscribe : bool = True ,
1563
- payloadCapability : int = TransportPayloadCapability .MRP_PAYLOAD ):
1551
+ if result := transaction .GetSubscriptionHandler ():
1552
+ return result
1553
+ else :
1554
+ return transaction .GetReadResponse ()
1555
+
1556
+ async def ReadAttribute (
1557
+ self ,
1558
+ nodeid : int ,
1559
+ attributes : typing .Optional [typing .List [typing .Union [
1560
+ None , # Empty tuple, all wildcard
1561
+ typing .Tuple [int ], # Endpoint
1562
+ # Wildcard endpoint, Cluster id present
1563
+ typing .Tuple [typing .Type [ClusterObjects .Cluster ]],
1564
+ # Wildcard endpoint, Cluster + Attribute present
1565
+ typing .Tuple [typing .Type [ClusterObjects .ClusterAttributeDescriptor ]],
1566
+ # Wildcard attribute id
1567
+ typing .Tuple [int , typing .Type [ClusterObjects .Cluster ]],
1568
+ # Concrete path
1569
+ typing .Tuple [int , typing .Type [ClusterObjects .ClusterAttributeDescriptor ]],
1570
+ # Directly specified attribute path
1571
+ ClusterAttribute .AttributePath
1572
+ ]]], dataVersionFilters : typing .Optional [typing .List [typing .Tuple [int , typing .Type [ClusterObjects .Cluster ], int ]]] = None ,
1573
+ returnClusterObject : bool = False ,
1574
+ reportInterval : typing .Optional [typing .Tuple [int , int ]] = None ,
1575
+ fabricFiltered : bool = True , keepSubscriptions : bool = False , autoResubscribe : bool = True ,
1576
+ payloadCapability : int = TransportPayloadCapability .MRP_PAYLOAD
1577
+ ):
1564
1578
'''
1565
1579
Read a list of attributes from a target node, this is a wrapper of DeviceController.Read()
1566
1580
@@ -1629,24 +1643,28 @@ async def ReadAttribute(self, nodeid: int, attributes: typing.Optional[typing.Li
1629
1643
else :
1630
1644
return res .attributes
1631
1645
1632
- async def ReadEvent (self , nodeid : int , events : typing .List [typing .Union [
1633
- None , # Empty tuple, all wildcard
1634
- typing .Tuple [str , int ], # all wildcard with urgency set
1635
- typing .Tuple [int , int ], # Endpoint,
1636
- # Wildcard endpoint, Cluster id present
1637
- typing .Tuple [typing .Type [ClusterObjects .Cluster ], int ],
1638
- # Wildcard endpoint, Cluster + Event present
1639
- typing .Tuple [typing .Type [ClusterObjects .ClusterEvent ], int ],
1640
- # Wildcard event id
1641
- typing .Tuple [int , typing .Type [ClusterObjects .Cluster ], int ],
1642
- # Concrete path
1643
- typing .Tuple [int , typing .Type [ClusterObjects .ClusterEvent ], int ]
1644
- ]], eventNumberFilter : typing .Optional [int ] = None ,
1645
- fabricFiltered : bool = True ,
1646
- reportInterval : typing .Optional [typing .Tuple [int , int ]] = None ,
1647
- keepSubscriptions : bool = False ,
1648
- autoResubscribe : bool = True ,
1649
- payloadCapability : int = TransportPayloadCapability .MRP_PAYLOAD ):
1646
+ async def ReadEvent (
1647
+ self ,
1648
+ nodeid : int ,
1649
+ events : typing .List [typing .Union [
1650
+ None , # Empty tuple, all wildcard
1651
+ typing .Tuple [str , int ], # all wildcard with urgency set
1652
+ typing .Tuple [int , int ], # Endpoint,
1653
+ # Wildcard endpoint, Cluster id present
1654
+ typing .Tuple [typing .Type [ClusterObjects .Cluster ], int ],
1655
+ # Wildcard endpoint, Cluster + Event present
1656
+ typing .Tuple [typing .Type [ClusterObjects .ClusterEvent ], int ],
1657
+ # Wildcard event id
1658
+ typing .Tuple [int , typing .Type [ClusterObjects .Cluster ], int ],
1659
+ # Concrete path
1660
+ typing .Tuple [int , typing .Type [ClusterObjects .ClusterEvent ], int ]
1661
+ ]], eventNumberFilter : typing .Optional [int ] = None ,
1662
+ fabricFiltered : bool = True ,
1663
+ reportInterval : typing .Optional [typing .Tuple [int , int ]] = None ,
1664
+ keepSubscriptions : bool = False ,
1665
+ autoResubscribe : bool = True ,
1666
+ payloadCapability : int = TransportPayloadCapability .MRP_PAYLOAD
1667
+ ):
1650
1668
'''
1651
1669
Read a list of events from a target node, this is a wrapper of DeviceController.Read()
1652
1670
0 commit comments