@@ -103,6 +103,8 @@ To build and run the Python CHIP controller:
103
103
chip-repl
104
104
```
105
105
106
+ NOTE: To get more verbose logs, pass the debug flag: `chip-repl --debug`
107
+
106
108
<hr>
107
109
108
110
## Using Python CHIP Controller REPL for Matter accessory testing
@@ -133,8 +135,8 @@ An uncommissioned accessory device advertises over Bluetooth LE or via mDNS if
133
135
already on the network. Run the following command to scan all advertised Matter
134
136
devices:
135
137
136
- ```
137
- devCtrl.DiscoverCommissionableNodes()
138
+ ```python
139
+ await devCtrl.DiscoverCommissionableNodes()
138
140
```
139
141
140
142
### Step 4: Set network pairing credentials
@@ -173,7 +175,7 @@ network interface, such as Thread or Wi-Fi.
173
175
2. Set the previously obtained Active Operational Dataset as a byte array using
174
176
the following command:
175
177
176
- ```
178
+ ```python
177
179
thread_dataset = bytes.fromhex("0e080000000000010000000300001335060004001fffe002084fe76e9a8b5edaf50708fde46f999f0698e20510d47f5027a414ffeebaefa92285cc84fa030f4f70656e5468726561642d653439630102e49c0410b92f8c7fbb4f9f3e08492ee3915fbd2f0c0402a0fff8")
178
180
devCtrl.SetThreadOperationalDataset(thread_dataset)
179
181
```
@@ -183,7 +185,7 @@ network interface, such as Thread or Wi-Fi.
183
185
Assuming your Wi-Fi SSID is _TESTSSID_, and your Wi-Fi password is _P455W4RD_,
184
186
set the credentials to the controller by executing the following command:
185
187
186
- ```
188
+ ```python
187
189
devCtrl.SetWiFiCredentials(<ssid>, <password>)
188
190
```
189
191
@@ -213,8 +215,8 @@ with the following assumptions for the Matter accessory device:
213
215
- The setup pin code of the device is _ 20202021_
214
216
- The temporary Node ID is _ 1234_
215
217
216
- ```
217
- devCtrl.ConnectBLE(3840, 20202021, 1234)
218
+ ``` python
219
+ await devCtrl.ConnectBLE(3840 , 20202021 , 1234 )
218
220
```
219
221
220
222
You can skip the last parameter, the Node ID, in the command. If you skip it,
@@ -230,8 +232,8 @@ CHIP:SVR: SetupQRCode: [MT:-24J0AFN00KA0648G00]
230
232
231
233
Use the following command to commission the device with the QR code:
232
234
233
- ```
234
- devCtrl.CommissionWithCode("MT:-24J0AFN00KA0648G00", 1234)
235
+ ``` python
236
+ await devCtrl.CommissionWithCode(" MT:-24J0AFN00KA0648G00" , 1234 )
235
237
```
236
238
237
239
After connecting the device over Bluetooth LE, the controller will go through
@@ -262,14 +264,14 @@ the following stages:
262
264
For the light bulb example, execute the following command to toggle the LED
263
265
state:
264
266
265
- ```
267
+ ``` python
266
268
await devCtrl.SendCommand(1234 , 1 , Clusters.OnOff.Commands.Toggle())
267
269
```
268
270
269
271
To change the brightness of the LED, use the following command, with the level
270
272
value somewhere between 0 and 255.
271
273
272
- ```
274
+ ``` python
273
275
commandToSend = LevelControl.Commands.MoveToLevel(level = 50 , transitionTime = Null, optionsMask = 0 , optionsOverride = 0 )
274
276
await devCtrl.SendCommand(1234 , 1 , commandToSend)
275
277
```
@@ -281,7 +283,7 @@ maintains collection of attributes that a controller can obtain from a device,
281
283
such as the vendor name, the product name, or software version. Use
282
284
` ReadAttribute() ` command to read those values from the device:
283
285
284
- ```
286
+ ``` python
285
287
attributes = [
286
288
(0 , Clusters.BasicInformation.Attributes.VendorName),
287
289
(0 , Clusters.BasicInformation.Attributes.ProductName),
@@ -309,7 +311,7 @@ the full list of available commands.
309
311
Provides the controller with Thread network credentials that will be used in the
310
312
device commissioning procedure to configure the device with a Thread interface.
311
313
312
- ```
314
+ ``` python
313
315
thread_dataset = bytes .fromhex(" 0e080000000000010000000300001335060004001fffe002084fe76e9a8b5edaf50708fde46f999f0698e20510d47f5027a414ffeebaefa92285cc84fa030f4f70656e5468726561642d653439630102e49c0410b92f8c7fbb4f9f3e08492ee3915fbd2f0c0402a0fff8" )
314
316
devCtrl.SetThreadOperationalDataset(thread_dataset)
315
317
```
@@ -319,7 +321,7 @@ devCtrl.SetThreadOperationalDataset(thread_dataset)
319
321
Provides the controller with Wi-Fi network credentials that will be used in the
320
322
device commissioning procedure to configure the device with a Wi-Fi interface.
321
323
322
- ```
324
+ ``` python
323
325
devCtrl.SetWiFiCredentials(' TESTSSID' , ' P455W4RD' )
324
326
```
325
327
@@ -328,8 +330,8 @@ devCtrl.SetWiFiCredentials('TESTSSID', 'P455W4RD')
328
330
Commission with the given nodeid from the setupPayload. setupPayload may be a QR
329
331
or the manual setup code.
330
332
331
- ```
332
- devCtrl.CommissionWithCode("MT:-24J0AFN00KA0648G00", 1234)
333
+ ``` python
334
+ await devCtrl.CommissionWithCode(" MT:-24J0AFN00KA0648G00" , 1234 )
333
335
```
334
336
335
337
### ` SendCommand(<nodeid>: int, <endpoint>: int, Clusters.<cluster>.Commands.<command>(<arguments>)) `
0 commit comments