|
28 | 28 | if TYPE_CHECKING:
|
29 | 29 | from asyncio.subprocess import Process
|
30 | 30 |
|
31 |
| - from chip.native import PyChipError |
32 |
| - |
33 | 31 | from matter_server.server.sdk import ChipDeviceControllerWrapper
|
34 | 32 |
|
35 | 33 | LOGGER = logging.getLogger(__name__)
|
@@ -96,27 +94,22 @@ async def _commission_ota_provider(
|
96 | 94 | ) -> None:
|
97 | 95 | """Commissions the OTA Provider, returns node ID of the commissioned provider."""
|
98 | 96 |
|
99 |
| - res: PyChipError = await chip_device_controller.commission_on_network( |
100 |
| - ota_provider_node_id, |
101 |
| - passcode, |
102 |
| - # TODO: Filtering by long discriminator seems broken |
103 |
| - disc_filter_type=FilterType.LONG_DISCRIMINATOR, |
104 |
| - disc_filter=discriminator, |
105 |
| - ) |
106 |
| - if not res.is_success: |
107 |
| - await self.stop() |
108 |
| - raise UpdateError( |
109 |
| - f"Failed to commission OTA Provider App: SDK Error {res.code}" |
110 |
| - ) |
111 |
| - |
112 |
| - LOGGER.info( |
113 |
| - "OTA Provider App commissioned with node id %d.", |
114 |
| - ota_provider_node_id, |
115 |
| - ) |
116 |
| - |
117 | 97 | # Adjust ACL of OTA Requestor such that Node peer-to-peer communication
|
118 | 98 | # is allowed.
|
119 | 99 | try:
|
| 100 | + commissioned_node_id = await chip_device_controller.commission_on_network( |
| 101 | + ota_provider_node_id, |
| 102 | + passcode, |
| 103 | + disc_filter_type=FilterType.LONG_DISCRIMINATOR, |
| 104 | + disc_filter=discriminator, |
| 105 | + ) |
| 106 | + assert commissioned_node_id == ota_provider_node_id |
| 107 | + |
| 108 | + LOGGER.info( |
| 109 | + "OTA Provider App commissioned with node id %d.", |
| 110 | + ota_provider_node_id, |
| 111 | + ) |
| 112 | + |
120 | 113 | read_result = cast(
|
121 | 114 | Attribute.AsyncReadTransaction.ReadResponse,
|
122 | 115 | await chip_device_controller.read_attribute(
|
@@ -163,7 +156,7 @@ async def _commission_ota_provider(
|
163 | 156 | )
|
164 | 157 | raise UpdateError("Error while setting up OTA Provider.")
|
165 | 158 | except ChipStackError as ex:
|
166 |
| - logging.exception("Failed adjusting OTA Provider App ACL.", exc_info=ex) |
| 159 | + logging.exception("Failed setting up OTA Provider.", exc_info=ex) |
167 | 160 | raise UpdateError("Error while setting up OTA Provider.") from ex
|
168 | 161 |
|
169 | 162 | async def start_update(
|
|
0 commit comments