# Controller

This example creates a Matter Controller using the ESP Matter data model.


See the [docs](https://docs.espressif.com/projects/esp-matter/en/main/esp32/developing.html) for more information about building and flashing the firmware.

## 1. Additional Environment Setup

No additional setup is required.

## 2. Controller Example

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 Pairing Command Failed

I cannot finish the commissioning on the controller example:

-   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 esp-matter and esp-idf branch you are using.

### A2.2 Command Send Failed

I cannot send commands to the light from the controller:

-   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 esp-matter and esp-idf branch you are using.
