Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GetConnectedDevice directly to get device proxy #723

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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