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

Update release branch to Matter v1.3 #53

Merged
merged 21 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8ada09c
Update to master branch
agners Mar 5, 2024
3554056
Adjust configuration for depandabot
agners Mar 5, 2024
291d024
Merge pull request #36 from agners/bump-to-latest-master
agners Mar 5, 2024
e84f14d
Bump connectedhomeip from `3d47e35` to `e52724f`
dependabot[bot] Mar 6, 2024
7cdadfc
Merge pull request #38 from home-assistant-libs/dependabot/submodules…
agners Mar 6, 2024
29c1c50
Bump connectedhomeip from `e52724f` to `f7a9b59`
dependabot[bot] Mar 11, 2024
84086fa
Bump softprops/action-gh-release from 1 to 2
dependabot[bot] Mar 11, 2024
db733c0
Merge pull request #41 from home-assistant-libs/dependabot/submodules…
agners Mar 11, 2024
9d2f54c
Merge pull request #42 from home-assistant-libs/dependabot/github_act…
agners Mar 11, 2024
d21ec4a
Bump connectedhomeip from `f7a9b59` to `a97bad9`
dependabot[bot] Mar 12, 2024
3595663
Merge pull request #43 from home-assistant-libs/dependabot/submodules…
agners Mar 12, 2024
487b22e
Bump connectedhomeip from `a97bad9` to `12d8487`
dependabot[bot] Mar 13, 2024
8b000b0
Merge pull request #44 from home-assistant-libs/dependabot/submodules…
agners Mar 13, 2024
bec8b91
Don't fetch the Matter SDK recursively
agners Mar 18, 2024
5d6f51b
Merge pull request #45 from home-assistant-libs/bump-to-latest-master
agners Mar 19, 2024
23f65bc
Bump connectedhomeip from `12d8487` to `5bb5c9e`
agners Mar 27, 2024
3d21d47
Merge pull request #47 from home-assistant-libs/bump-to-v1.3-branch-c…
agners Mar 27, 2024
6a48e36
Upload all wheels from correct path
agners Mar 27, 2024
47c9050
Merge pull request #48 from home-assistant-libs/fix-upload-path
agners Mar 27, 2024
2e9bad3
Add patch which implements async GetConnectedDevice
agners Mar 28, 2024
5bc80ec
Merge pull request #50 from home-assistant-libs/async-friendly-get-co…
agners Mar 28, 2024
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
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ updates:
- dependency-name: "connectedhomeip"
schedule:
interval: "daily"
target-branch: main
- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ jobs:
name: chip-wheels-linux-${{ matrix.arch.name }}
path: ./connectedhomeip/out/controller/python/*.whl
- name: Upload wheels as release assets
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: project-chip/out/controller/python/*.whl
files: ./connectedhomeip/out/controller/python/*.whl
- name: Upload wheels to PyPI
if: startsWith(github.ref, 'refs/tags/')
env:
Expand Down Expand Up @@ -229,9 +229,9 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: chip-wheels-macosx-${{ matrix.arch.name }}
path: project-chip/out/controller/python/*.whl
path: ./connectedhomeip/out/controller/python/*.whl
- name: Upload wheels as release assets
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: connectedhomeip/out/controller/python/*.whl
Expand Down
2 changes: 2 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[submodule "connectedhomeip"]
path = connectedhomeip
url = https://github.com/project-chip/connectedhomeip.git
branch = master
fetchRecurseSubmodules = false
27 changes: 0 additions & 27 deletions 0003-Bump-prompt-toolkit-requirement-to-fix-ptpython-vers.patch

This file was deleted.

133 changes: 133 additions & 0 deletions 0004-Python-Implement-async-friendly-GetConnectedDevice.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
From f9fc067ad51d3989a2045f19fc5641971ce1ee20 Mon Sep 17 00:00:00 2001
From: Stefan Agner <stefan@agner.ch>
Date: Wed, 27 Mar 2024 22:13:19 +0100
Subject: [PATCH] [Python] Implement async friendly GetConnectedDevice

Currently GetConnectedDeviceSync() is blocking e.g. when a new session
needs to be created. This is not asyncio friendly as it blocks the
whole event loop.

Implement a asyncio friendly variant GetConnectedDevice() which is
a co-routine function which can be awaited.
---
src/controller/python/chip/ChipDeviceCtrl.py | 62 ++++++++++++++++++--
1 file changed, 56 insertions(+), 6 deletions(-)

diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py
index 369260787d..b3d0aa2d7f 100644
--- a/src/controller/python/chip/ChipDeviceCtrl.py
+++ b/src/controller/python/chip/ChipDeviceCtrl.py
@@ -823,6 +823,56 @@ class ChipDeviceControllerBase():

return DeviceProxyWrapper(returnDevice, self._dmLib)

+ async def GetConnectedDevice(self, nodeid, allowPASE=True, timeoutMs: int = None):
+ ''' Returns DeviceProxyWrapper upon success.'''
+ self.CheckIsActive()
+
+ if allowPASE:
+ returnDevice = c_void_p(None)
+ res = self._ChipStack.Call(lambda: self._dmLib.pychip_GetDeviceBeingCommissioned(
+ self.devCtrl, nodeid, byref(returnDevice)), timeoutMs)
+ if res.is_success:
+ logging.info('Using PASE connection')
+ return DeviceProxyWrapper(returnDevice)
+
+ eventLoop = asyncio.get_running_loop()
+ future = eventLoop.create_future()
+
+ class DeviceAvailableClosure():
+ def __init__(self, loop, future: asyncio.Future):
+ self._returnDevice = c_void_p(None)
+ self._returnErr = None
+ self._event_loop = loop
+ self._future = future
+
+ def _deviceAvailable(self):
+ if self._returnDevice.value is not None:
+ self._future.set_result(self._returnDevice)
+ else:
+ self._future.set_exception(self._returnErr.to_exception())
+
+ def deviceAvailable(self, device, err):
+ self._returnDevice = c_void_p(device)
+ self._returnErr = err
+ self._event_loop.call_soon_threadsafe(self._deviceAvailable)
+ ctypes.pythonapi.Py_DecRef(ctypes.py_object(self))
+
+ closure = DeviceAvailableClosure(eventLoop, future)
+ ctypes.pythonapi.Py_IncRef(ctypes.py_object(closure))
+ self._ChipStack.Call(lambda: self._dmLib.pychip_GetConnectedDeviceByNodeId(
+ self.devCtrl, nodeid, ctypes.py_object(closure), _DeviceAvailableCallback),
+ timeoutMs).raise_on_error()
+
+ # The callback might have been received synchronously (during self._ChipStack.Call()).
+ # In that case the Future has already been set it will return immediately
+ if (timeoutMs):
+ timeout = float(timeoutMs) / 1000
+ await asyncio.wait_for(future, timeout=timeout)
+ else:
+ await future
+
+ return DeviceProxyWrapper(future.result(), self._dmLib)
+
def ComputeRoundTripTimeout(self, nodeid, upperLayerProcessingTimeoutMs: int = 0):
''' Returns a computed timeout value based on the round-trip time it takes for the peer at the other end of the session to
receive a message, process it and send it back. This is computed based on the session type, the type of transport,
@@ -887,7 +937,7 @@ class ChipDeviceControllerBase():
eventLoop = asyncio.get_running_loop()
future = eventLoop.create_future()

- device = self.GetConnectedDeviceSync(nodeid, timeoutMs=interactionTimeoutMs)
+ device = await self.GetConnectedDevice(nodeid, timeoutMs=interactionTimeoutMs)

ClusterCommand.TestOnlySendBatchCommands(
future, eventLoop, device.deviceProxy, commands,
@@ -908,7 +958,7 @@ class ChipDeviceControllerBase():
eventLoop = asyncio.get_running_loop()
future = eventLoop.create_future()

- device = self.GetConnectedDeviceSync(nodeid, timeoutMs=None)
+ device = await self.GetConnectedDevice(nodeid, timeoutMs=None)
ClusterCommand.TestOnlySendCommandTimedRequestFlagWithNoTimedInvoke(
future, eventLoop, responseType, device.deviceProxy, ClusterCommand.CommandPath(
EndpointId=endpoint,
@@ -940,7 +990,7 @@ class ChipDeviceControllerBase():
eventLoop = asyncio.get_running_loop()
future = eventLoop.create_future()

- device = self.GetConnectedDeviceSync(nodeid, timeoutMs=interactionTimeoutMs)
+ device = await self.GetConnectedDevice(nodeid, timeoutMs=interactionTimeoutMs)
ClusterCommand.SendCommand(
future, eventLoop, responseType, device.deviceProxy, ClusterCommand.CommandPath(
EndpointId=endpoint,
@@ -981,7 +1031,7 @@ class ChipDeviceControllerBase():
eventLoop = asyncio.get_running_loop()
future = eventLoop.create_future()

- device = self.GetConnectedDeviceSync(nodeid, timeoutMs=interactionTimeoutMs)
+ device = await self.GetConnectedDevice(nodeid, timeoutMs=interactionTimeoutMs)

ClusterCommand.SendBatchCommands(
future, eventLoop, device.deviceProxy, commands,
@@ -1031,7 +1081,7 @@ class ChipDeviceControllerBase():
eventLoop = asyncio.get_running_loop()
future = eventLoop.create_future()

- device = self.GetConnectedDeviceSync(nodeid, timeoutMs=interactionTimeoutMs)
+ device = await self.GetConnectedDevice(nodeid, timeoutMs=interactionTimeoutMs)

attrs = []
for v in attributes:
@@ -1259,7 +1309,7 @@ class ChipDeviceControllerBase():
eventLoop = asyncio.get_running_loop()
future = eventLoop.create_future()

- device = self.GetConnectedDeviceSync(nodeid)
+ device = await self.GetConnectedDevice(nodeid)
attributePaths = [self._parseAttributePathTuple(
v) for v in attributes] if attributes else None
clusterDataVersionFilters = [self._parseDataVersionFilterTuple(
--
2.44.0

90 changes: 0 additions & 90 deletions 0004-Python-Support-commissioning-with-code-on-network-on.patch

This file was deleted.

54 changes: 0 additions & 54 deletions 0005-Python-Parse-Interface-ID-from-IP-address-string-as-.patch

This file was deleted.

51 changes: 0 additions & 51 deletions 0006-Python-Allow-early-logging-initialization-31945.patch

This file was deleted.

Loading
Loading