Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / examples / chip-tool / README.md
1 # CHIP Client Example
2
3 An example application that uses CHIP to send messages to a CHIP server.
4
5 ---
6
7 -   [CHIP Client Example](#chip-client-example)
8 -   [Building the Example Application](#building-the-example-application)
9 -   [Using the Client to Request an Echo](#using-the-client-to-request-an-echo)
10
11 ---
12
13 ## Building the Example Application
14
15 Building the example application is quite straightforward.
16
17 ### gn
18
19 ```
20 cd examples/chip-tool
21 git submodule update --init
22 source third_party/connectedhomeip/scripts/activate.sh
23 gn gen out/debug
24 ninja -C out/debug
25 ```
26
27 -   After the application is built, it can be found in the build directory as
28     `out/debug/chip-tool`
29
30 ## Using the Client to Pair a device
31
32 In order to send commands to a device, it must be paired with the client.
33
34 #### Pair a device
35
36 To initiate a client pairing request to a device, run the built executable and
37 choose the pairing mode.
38
39 ##### Pair a device configured to bypass Rendezvous
40
41 The command below pair a device with the provided IP address and port of the
42 server to talk to.
43
44     $ chip-tool pairing bypass 192.168.0.30 11097
45
46 #### Pair a device over BLE
47
48 Run the built executable and pass it the discriminator and pairing code of the
49 remote device.
50
51 The command below uses the default values hard-coded into the debug versions of
52 the ESP32 all-clusters-app:
53
54     $ chip-tool pairing ble 12345678 3840
55
56 ### Unpair a device
57
58     $ chip-tool pairing unpair
59
60 ## Using the Client to Send CHIP Commands
61
62 To use the Client to send a CHIP commands, run the built executable and pass it
63 the target cluster name, the target command name as well as an endpoint id.
64
65 The endpoint id must be between 1 and 240.
66
67     $ chip-tool onoff on 1
68
69 The client will send a single command packet and then exit.
70
71 ### How to get the list of supported clusters
72
73 To get the list of supported clusters, run the built executable without any
74 arguments.
75
76     $ chip-tool
77
78 Example output:
79
80 ```bash
81 Usage:
82   ./chip-tool cluster_name command_name [param1 param2 ...]
83
84   +-------------------------------------------------------------------------------------+
85   | Clusters:                                                                           |
86   +-------------------------------------------------------------------------------------+
87   | * barriercontrol                                                                    |
88   | * basic                                                                             |
89   | * colorcontrol                                                                      |
90   | * doorlock                                                                          |
91   | * groups                                                                            |
92   | * iaszone                                                                           |
93   | * identify                                                                          |
94   | * levelcontrol                                                                      |
95   | * onoff                                                                             |
96   | * pairing                                                                           |
97   | * payload                                                                           |
98   | * scenes                                                                            |
99   | * temperaturemeasurement                                                            |
100   +-------------------------------------------------------------------------------------+
101 ```
102
103 ### How to get the list of supported commands for a specific cluster
104
105 To get the list of commands for a specific cluster, run the built executable
106 with the target cluster name.
107
108     $ chip-tool onoff
109
110 ### How to get the list of supported attributes for a specific cluster
111
112 To the the list of attributes for a specific cluster, run the built executable
113 with the target cluster name and the `read` command name.
114
115     $ chip-tool onoff read
116
117 ### How to get the list of parameters for a command
118
119 To get the list of parameters for a specific command, run the built executable
120 with the target cluster name and the target command name
121
122     $ chip-tool onoff on
123
124 ## Using the Client for Setup Payload
125
126 ### How to parse a setup code
127
128 To parse a setup code, run the built executable with the `payload` cluster name
129 and the `parse-setup-payload` command
130
131     $ chip-tool payload parse-setup-payload code
132
133 #### QR Code
134
135     $ chip-tool payload parse-setup-payload "CH:#####"
136
137 #### QR Code with optional Vendor Info
138
139     $ chip-tool payload parse-setup-payload "CH:#####"
140
141 #### Manual Setup Code
142
143     $ chip-tool payload parse-setup-payload :#####"
144
145 # Using the Client for Additional Data Payload
146
147 To parse an additional data payload, run the built executable with the `payload`
148 cluster name and the `parse-additional-data-payload` command
149
150     $ chip-tool payload parse-additional-data-payload "#####"
151
152 # Command Reference
153
154 ## Command List
155
156 -   [barriercontrol](#barriercontrol)
157 -   [basic](#basic)
158 -   [colorcontrol](#colorcontrol)
159 -   [doorlock](#doorlock)
160 -   [groups](#groups)
161 -   [iaszone](#iaszone)
162 -   [identify](#identify)
163 -   [levelcontrol](#levelcontrol)
164 -   [onoff](#onoff)
165 -   [pairing](#pairing)
166 -   [payload](#payload)
167 -   [scenes](#scenes)
168 -   [temperaturemeasurement](#temperaturemeasurement)
169
170 ## Command Details
171
172 ### barriercontrol
173
174 ```bash
175 Usage:
176   ./chip-tool barriercontrol command_name [param1 param2 ...]
177
178   +-------------------------------------------------------------------------------------+
179   | Commands:                                                                           |
180   +-------------------------------------------------------------------------------------+
181   | * barrier-control-go-to-percent                                                     |
182   | * barrier-control-stop                                                              |
183   | * discover                                                                          |
184   | * read                                                                              |
185   +-------------------------------------------------------------------------------------+
186 ```
187
188 ### basic
189
190 ```bash
191 Usage:
192   ./chip-tool basic command_name [param1 param2 ...]
193
194   +-------------------------------------------------------------------------------------+
195   | Commands:                                                                           |
196   +-------------------------------------------------------------------------------------+
197   | * reset-to-factory-defaults                                                         |
198   | * ping                                                                              |
199   | * discover                                                                          |
200   | * read                                                                              |
201   +-------------------------------------------------------------------------------------+
202 ```
203
204 ### colorcontrol
205
206 ```bash
207 Usage:
208   ./chip-tool colorcontrol command_name [param1 param2 ...]
209
210   +-------------------------------------------------------------------------------------+
211   | Commands:                                                                           |
212   +-------------------------------------------------------------------------------------+
213   | * move-color                                                                        |
214   | * move-color-temperature                                                            |
215   | * move-hue                                                                          |
216   | * move-saturation                                                                   |
217   | * move-to-color                                                                     |
218   | * move-to-color-temperature                                                         |
219   | * move-to-hue                                                                       |
220   | * move-to-hue-and-saturation                                                        |
221   | * move-to-saturation                                                                |
222   | * step-color                                                                        |
223   | * step-color-temperature                                                            |
224   | * step-hue                                                                          |
225   | * step-saturation                                                                   |
226   | * stop-move-step                                                                    |
227   | * discover                                                                          |
228   | * read                                                                              |
229   | * report                                                                            |
230   +-------------------------------------------------------------------------------------+
231 ```
232
233 ### doorlock
234
235 ```bash
236 Usage:
237   ./chip-tool doorlock command_name [param1 param2 ...]
238
239   +-------------------------------------------------------------------------------------+
240   | Commands:                                                                           |
241   +-------------------------------------------------------------------------------------+
242   | * clear-all-pins                                                                    |
243   | * clear-all-rfids                                                                   |
244   | * clear-holiday-schedule                                                            |
245   | * clear-pin                                                                         |
246   | * clear-rfid                                                                        |
247   | * clear-weekday-schedule                                                            |
248   | * clear-yearday-schedule                                                            |
249   | * get-holiday-schedule                                                              |
250   | * get-pin                                                                           |
251   | * get-rfid                                                                          |
252   | * get-user-type                                                                     |
253   | * get-weekday-schedule                                                              |
254   | * get-yearday-schedule                                                              |
255   | * lock-door                                                                         |
256   | * set-holiday-schedule                                                              |
257   | * set-pin                                                                           |
258   | * set-rfid                                                                          |
259   | * set-user-type                                                                     |
260   | * set-weekday-schedule                                                              |
261   | * set-yearday-schedule                                                              |
262   | * unlock-door                                                                       |
263   | * unlock-with-timeout                                                               |
264   | * discover                                                                          |
265   | * read                                                                              |
266   | * report                                                                            |
267   +-------------------------------------------------------------------------------------+
268 ```
269
270 ### groups
271
272 ```bash
273 Usage:
274   ./chip-tool groups command_name [param1 param2 ...]
275
276   +-------------------------------------------------------------------------------------+
277   | Commands:                                                                           |
278   +-------------------------------------------------------------------------------------+
279   | * add-group                                                                         |
280   | * add-group-if-identifying                                                          |
281   | * get-group-membership                                                              |
282   | * remove-all-groups                                                                 |
283   | * remove-group                                                                      |
284   | * view-group                                                                        |
285   | * discover                                                                          |
286   | * read                                                                              |
287   +-------------------------------------------------------------------------------------+
288 ```
289
290 ### iaszone
291
292 ```bash
293 Usage:
294   ./chip-tool iaszone command_name [param1 param2 ...]
295
296   +-------------------------------------------------------------------------------------+
297   | Commands:                                                                           |
298   +-------------------------------------------------------------------------------------+
299   | * discover                                                                          |
300   | * read                                                                              |
301   | * write                                                                             |
302   +-------------------------------------------------------------------------------------+
303 ```
304
305 ### identify
306
307 ```bash
308 Usage:
309   ./chip-tool identify command_name [param1 param2 ...]
310
311   +-------------------------------------------------------------------------------------+
312   | Commands:                                                                           |
313   +-------------------------------------------------------------------------------------+
314   | * identify                                                                          |
315   | * identify-query                                                                    |
316   | * discover                                                                          |
317   | * read                                                                              |
318   +-------------------------------------------------------------------------------------+
319 ```
320
321 ### levelcontrol
322
323 ```bash
324 Usage:
325   ./chip-tool levelcontrol command_name [param1 param2 ...]
326
327   +-------------------------------------------------------------------------------------+
328   | Commands:                                                                           |
329   +-------------------------------------------------------------------------------------+
330   | * move                                                                              |
331   | * move-to-level                                                                     |
332   | * move-to-level-with-on-off                                                         |
333   | * move-with-on-off                                                                  |
334   | * step                                                                              |
335   | * step-with-on-off                                                                  |
336   | * stop                                                                              |
337   | * stop-with-on-off                                                                  |
338   | * discover                                                                          |
339   | * read                                                                              |
340   | * report                                                                            |
341   +-------------------------------------------------------------------------------------+
342 ```
343
344 ### onoff
345
346 ```bash
347 Usage:
348   ./chip-tool onoff command_name [param1 param2 ...]
349
350   +-------------------------------------------------------------------------------------+
351   | Commands:                                                                           |
352   +-------------------------------------------------------------------------------------+
353   | * off                                                                               |
354   | * on                                                                                |
355   | * toggle                                                                            |
356   | * discover                                                                          |
357   | * read                                                                              |
358   | * report                                                                            |
359   +-------------------------------------------------------------------------------------+
360 ```
361
362 ### onoff off [endpoint-id]
363
364 Send the OFF command to the ONOFF cluster on the given endpoint.
365
366 ### onoff on [endpoint-id]
367
368 Send the ON command to the ONOFF cluster on the given endpoint.
369
370 ### onoff toggle [endpoint-id]
371
372 Send the TOGGLE command to the ONOFF cluster on the given endpoint.
373
374 ### onoff discover [endpoint-id]
375
376 Send the DISCOVER command to the ONOFF cluster on the given endpoint.
377
378 ### pairing
379
380 ```bash
381 Usage:
382   ./chip-tool pairing command_name [param1 param2 ...]
383
384   +-------------------------------------------------------------------------------------+
385   | Commands:                                                                           |
386   +-------------------------------------------------------------------------------------+
387   | * unpair                                                                            |
388   | * bypass                                                                            |
389   | * ble                                                                               |
390   | * softap                                                                            |
391   +-------------------------------------------------------------------------------------+
392 ```
393
394 ### payload
395
396 ```bash
397 Usage:
398   ./chip-tool payload command_name [param1 param2 ...]
399
400   +-------------------------------------------------------------------------------------+
401   | Commands:                                                                           |
402   +-------------------------------------------------------------------------------------+
403   | * parse-setup-payload                                                               |
404   | * parse-additional-data-payload                                                     |
405   +-------------------------------------------------------------------------------------+
406 ```
407
408 ### scenes
409
410 ```bash
411 Usage:
412   ./chip-tool scenes command_name [param1 param2 ...]
413
414   +-------------------------------------------------------------------------------------+
415   | Commands:                                                                           |
416   +-------------------------------------------------------------------------------------+
417   | * add-scene                                                                         |
418   | * get-scene-membership                                                              |
419   | * recall-scene                                                                      |
420   | * remove-all-scenes                                                                 |
421   | * remove-scene                                                                      |
422   | * store-scene                                                                       |
423   | * view-scene                                                                        |
424   | * discover                                                                          |
425   | * read                                                                              |
426   +-------------------------------------------------------------------------------------+
427 ```
428
429 ### temperaturemeasurement
430
431 ```bash
432 Usage:
433   ./chip-tool temperaturemeasurement command_name [param1 param2 ...]
434
435   +-------------------------------------------------------------------------------------+
436   | Commands:                                                                           |
437   +-------------------------------------------------------------------------------------+
438   | * discover                                                                          |
439   | * read                                                                              |
440   | * report                                                                            |
441   +-------------------------------------------------------------------------------------+
442 ```