Skip to content

Commit

Permalink
Fix open commissioning window tuple bug (#447)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Hjelmare <[email protected]>
Co-authored-by: Marcel van der Veldt <[email protected]>
  • Loading branch information
3 people committed Dec 6, 2023
1 parent 5b941cf commit 6eb814e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions matter_server/server/device_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import time
from typing import TYPE_CHECKING, Any, Callable, Iterable, TypeVar, cast

from chip.ChipDeviceCtrl import CommissionableNode
from chip.ChipDeviceCtrl import CommissionableNode, CommissioningParameters
from chip.clusters import Attribute, Objects as Clusters
from chip.clusters.Attribute import ValueDecodeFailure
from chip.clusters.ClusterObjects import ALL_ATTRIBUTES, ALL_CLUSTERS, Cluster
Expand Down Expand Up @@ -273,7 +273,7 @@ async def open_commissioning_window(
iteration: int = 1000,
option: int = 1,
discriminator: int | None = None,
) -> tuple[int, str]:
) -> CommissioningParameters:
"""Open a commissioning window to commission a device present on this controller to another.
Returns code to use as discriminator.
Expand All @@ -284,15 +284,14 @@ async def open_commissioning_window(
if discriminator is None:
discriminator = 3840 # TODO generate random one

pin, code = await self._call_sdk(
return await self._call_sdk(
self.chip_controller.OpenCommissioningWindow,
nodeid=node_id,
timeout=timeout,
iteration=iteration,
discriminator=discriminator,
option=option,
)
return pin, code

@api_command(APICommand.DISCOVER)
async def discover_commissionable_nodes(
Expand Down

0 comments on commit 6eb814e

Please sign in to comment.