Add docs and CI for controller example

This commit is contained in:
WanqQixiang
2022-09-01 15:24:25 +08:00
parent 27976aeb94
commit fd80c494f2
3 changed files with 101 additions and 101 deletions
+15 -101
View File
@@ -1,10 +1,7 @@
# Light Switch
# Controller
This example creates an On/Off Light Switch device using the ESP Matter
data model.
This example creates a Matter Controller using the ESP Matter data model.
It creates the On/Off client and other devices can be bound to the
switch and then controlled from the switch.
See the [docs](https://docs.espressif.com/projects/esp-matter/en/main/esp32/developing.html) for more information about building and flashing the firmware.
@@ -12,113 +9,30 @@ See the [docs](https://docs.espressif.com/projects/esp-matter/en/main/esp32/deve
No additional setup is required.
## 2. Post Commissioning Setup
## 2. Controller Example
### 2.1 Bind light to switch
Using the chip-tool, commission 2 devices, the switch and a light.
If you are having trouble, try commissioning them one at a time (by powering off the other device) as
the default discriminator and passcode are same for both of them.
Then use the below commands to bind the light to the switch.
For the commands below:
- Node Id of switch used during commissioning is 0x7283 (29315 in decimal)
- Node Id of light used during commissioning is 0x5164 (20836 in decimal)
- Cluster Id for OnOff cluster is 6
- Binding cluster is currently present on endpoint 1 on the switch
Update the light's acl attribute to add the entry of remote device
(switch) in the access control list:
```
chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [ 112233, 29315 ], "targets": null}]' 0x5164 0x0
```
Update the switch's binding attribute to add the entry of remote device
(light) in the binding table:
```
chip-tool binding write binding '[{"fabricIndex": 1, "node":20836, "endpoint":1, "cluster":6}]' 0x7283 0x1
```
### 2.2 Device console
Switch specific console commands:
- Send command to all the bound devices on the specified cluster:
(The IDs are in hex):
```
matter esp bound invoke <endpoint_id> <cluster_id> <command_id>
```
- Example: Off:
```
matter esp bound invoke 0x1 0x6 0x0
```
- Example: On:
```
matter esp bound invoke 0x1 0x6 0x1
```
- Example: Toggle:
```
matter esp bound invoke 0x1 0x6 0x2
```
## 3. Device Performance
### 3.1 Memory usage
The following is the Memory and Flash Usage.
- `Bootup` == Device just finished booting up. Device is not
commissionined or connected to wifi yet.
- `After Commissioning` == Device is conneted to wifi and is also
commissioned and is rebooted.
- device used: esp32c3_devkit_m
- tested on:
[6a244a7](https://github.com/espressif/esp-matter/commit/6a244a7b1e5c70b0aa1bf57254f19718b0755d95)
(2022-06-16)
| | Bootup | After Commissioning |
|:- |:-: |:-: |
|**Free Internal Memory** |114KB |111KB |
**Flash Usage**: Firmware binary size: 1.25MB
This should give you a good idea about the amount of free memory that is
available for you to run your application's code.
Applications that do not require BLE post commissioning, can disable it using app_ble_disable() once commissioning is complete. It is not done explicitly because of a known issue with esp32c3 and will be fixed with the next IDF release (v4.4.2).
See the [docs](https://docs.espressif.com/projects/esp-matter/en/main/esp32/developing.html#controller-example) for more information
about pairing and controling an end-device using this example
## A2 Appendix FAQs
### A2.1 Binding Failed
### A2.1 Pairing Command Failed
My light is not getting bound to my switch:
I cannot finish the commissioning on the controller example:
- Make sure the light's acl is updated. You can read it again to make
sure it is correct: `chip-tool accesscontrol read acl 0x5164 0x0`.
- If you are still facing issues, reproduce the issue on the default
example for the device and then raise an [issue](https://github.com/espressif/esp-matter/issues).
Make sure to share these:
- Currently this example only supports onnetwork pairing, so please make sure that the end-device and the controller are on the same IP-network.
- The controller uses the hard-code test PAA certification so the PAI and DAC on the end-device should be generated by the [test cert](https://github.com/espressif/connectedhomeip/blob/4f7669b052b16bd054227376e1bbadac85419793/credentials/test/attestation/Chip-Test-PAA-NoVID-Cert.pem) and the [test key](https://github.com/espressif/connectedhomeip/blob/4f7669b052b16bd054227376e1bbadac85419793/credentials/test/attestation/Chip-Test-PAA-NoVID-Key.pem)
- If you are still facing issues, reproduce the issue on the default example for the device and then raise an [issue](https://github.com/espressif/esp-matter/issues). Make sure to share these:
- The complete device logs for both the devices taken over UART.
- The complete chip-tool logs.
- The esp-matter and esp-idf branch you are using.
### A2.2 Command Send Failed
I cannot send commands to the light from my switch:
I cannot send commands to the light from the controller:
- Make sure the binding command was a success.
- Make sure you are passing the local endpoint_id, and not the remote
endpoint_id, to the cluster_update() API.
- If using device console, make sure you are running the
`bound invoke` command and not the `client invoke` command. The
client commands are for devices which have not been bound.
- If you are still facing issues, reproduce the issue on the default
example for the device and then raise an [issue](https://github.com/espressif/esp-matter/issues).
Make sure to share these:
- Make sure the pairing command was a success.
- Currently the cluster commands and write-attribute commands are only supported for on-off, level-control, and color-control clusters.
- The CASESession will be lost on end-device after reboot. But the controller will still send commands on the previous CASESession. The controller will release previous CASESession after the last command is timeout. So the second command will re-establish a new CASESession in this situation.
- If you are still facing issues, reproduce the issue on the default example for the device and then raise an [issue](https://github.com/espressif/esp-matter/issues). Make sure to share these:
- The complete device logs for both the devices taken over UART.
- The complete chip-tool logs.
- The esp-matter and esp-idf branch you are using.