Skip to content

Commit

Permalink
Use GetConnectedDevice directly to get device proxy (#723)
Browse files Browse the repository at this point in the history
  • Loading branch information
agners committed Jun 29, 2024
1 parent ed23edc commit a9c6708
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion matter_server/server/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,16 @@ async def read(
# This is basically a re-implementation of the chip controller's Read function
# but one that allows us to send/request custom attributes.
future = self.server.loop.create_future()
device = await self.find_or_establish_case_session(node_id)
async with self._get_node_lock(node_id):
# GetConnectedDevice is guaranteed to return a deviceProxy
# otherwise it will raise a ChipStackError exception. A caller to
# this function should handle the exception in any case, as the Read
# below might raise such exceptions too.
device = await self._chip_controller.GetConnectedDevice(
nodeid=node_id,
allowPASE=False,
timeoutMs=None,
)
Attribute.Read(
future=future,
eventLoop=self.server.loop,
Expand Down

0 comments on commit a9c6708

Please sign in to comment.