Skip to content

Commit

Permalink
ESP32 examples Readme.md update with chip-tool instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
jadhavrohit924 committed Dec 31, 2021
1 parent 83b2f46 commit e57cd48
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 157 deletions.
86 changes: 42 additions & 44 deletions examples/all-clusters-app/esp32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ control.
- [Supported Devices](#supported-devices)
- [Building the Example Application](#building-the-example-application)
- [Commissioning and cluster control](#commissioning-and-cluster-control)
- [Setting up Python Controller](#setting-up-python-controller)
- [Setting up chip-tool](#setting-up-chip-tool)
- [Commissioning over BLE](#commissioning-over-ble)
- [Cluster control](#cluster-control)
- [Flashing app using script](#flashing-app-using-script)
Expand Down Expand Up @@ -160,73 +160,71 @@ your network configuration. To erase it, simply run.

$ idf.py -p /dev/tty.SLAB_USBtoUART erase_flash

### Setting up Python Controller
- Once ESP32 is up and running, we need to set up a device controller to
perform
- commissioning and cluster control.

Once ESP32 is up and running, we need to set up a device controller to perform
commissioning and cluster control.
### Setting up chip-tool

- Set up python controller.
See [the build guide](../../../docs/guides/BUILDING.md#prerequisites) for
general background on build prerequisites.

$ cd {path-to-connectedhomeip}
$ ./scripts/build_python.sh -m platform
Building the example:

- Execute the controller.
```
$ cd examples/chip-tool
$ rm -rf out
$ source ./out/python_env/bin/activate
$ chip-device-ctrl
$ git submodule update --init
### Commissioning over BLE
$ source third_party/connectedhomeip/scripts/activate.sh
- Establish the secure session over BLE. BLE is the default mode in the
application and is configurable through menuconfig.
$ gn gen out/debug
- chip-device-ctrl > ble-scan
- chip-device-ctrl > connect -ble 3840 20202021 135246
$ ninja -C out/debug
```

Parameters:
1. Discriminator: 3840 (configurable through menuconfig)
2. Setup-pin-code: 20202021 (configurable through menuconfig)
3. Node ID: Optional.
If not passed in this command, then it is auto-generated by the controller and displayed in the output of connect.
The same value should be used in the next commands.
We have chosen a random node ID which is 135246.
which puts the binary at `out/debug/chip-tool`

- Add credentials of the Wi-Fi network you want the ESP32 to connect to, using
the `AddOrUpdateWiFiNetwork` command and then enable the ESP32 to connect to
it using `EnableWiFiNetwork` command. In this example, we have used
`TESTSSID` and `TESTPASSWD` as the SSID and passphrase respectively.
### Commission a device using chip-tool

- chip-device-ctrl > zcl NetworkCommissioning AddOrUpdateWiFiNetwork 135246 0 0 ssid=str:TESTSSID credentials=str:TESTPASSWD breadcrumb=0
To initiate a client commissioning request to a device, run the built executable
and choose the pairing mode.

- chip-device-ctrl > zcl NetworkCommissioning ConnectNetwork 135246 0 0 networkID=str:TESTSSID breadcrumb=0
#### Commissioning over BLE

- Close the BLE connection to ESP32, as it is not required hereafter.
Run the built executable and pass it the discriminator and pairing code of the
remote device, as well as the network credentials to use.

- chip-device-ctrl > close-ble
The command below uses the default values hard-coded into the debug versions of
the ESP32 all-clusters-app to commission it onto a Wi-Fi network:

- Resolve DNS-SD name and update address of the node in the device controller.
$ .out/debug/chip-tool pairing ble-wifi 12344321 ${SSID} ${PASSWORD} 20202021 3840

- chip-device-ctrl > resolve 135246
Parameters:

1. Discriminator: 3840 (configurable through menuconfig)
2. Setup-pin-code: 20202021 (configurable through menuconfig)
3. Node-id: 12344321 (you can assign any node id)

### Cluster control

- After successful commissioning, use the OnOff cluster commands to control
the OnOff attribute. This allows you to toggle a parameter implemented by
the device to be On or Off.
#### onoff

`chip-device-ctrl > zcl OnOff Off 135246 1 1`
To use the Client to send Matter commands, run the built executable and pass it
the target cluster name, the target command name as well as an endpoint id.

- Use the LevelControl cluster commands to control the CurrentLevel attribute.
This allows you to control the brightness of the led.
$ .out/debug/chip-tool onoff on 12344321 1

`chip-device-ctrl > zcl LevelControl MoveToLevel 135246 1 1 level=10 transitionTime=0 optionMask=0 optionOverride=0`
The client will send a single command packet and then exit.

- For ESP32C3-DevKitM, use the ColorControl cluster commands to control the
CurrentHue and CurrentSaturation attribute. This allows you to control the
color of on-board LED.
#### levelcontrol

`zcl ColorControl MoveToHue 135246 1 1 hue=100 direction=0 transitionTime=0 optionsMask=0 optionsOverride=0`
`zcl ColorControl MoveToSaturation 135245 1 1 saturation=200 transitionTime=0 optionsMask=0 optionsOverride=0`
```bash
Usage:
$ ./out/debug/chip-tool levelcontrol move-to-level Level=10 TransitionTime=0 OptionMask=0 OptionOverride=0 12344321 1
```

### Flashing app using script

Expand Down
80 changes: 39 additions & 41 deletions examples/bridge-app/esp32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cluster have been added as endpoints
- [Dynamic Endpoints](#dynamic-endpoints)
- [Building the Example Application](#building-the-example-application)
- [Commissioning and cluster control](#commissioning-and-cluster-control)
- [Setting up Python Controller](#setting-up-python-controller)
- [Setting up chip-tool](#setting-up-chip-tool)
- [Commissioning over BLE](#commissioning-over-ble)
- [Cluster control](#cluster-control)

Expand Down Expand Up @@ -192,63 +192,61 @@ your network configuration. To erase it, simply run.

$ idf.py -p /dev/tty.SLAB_USBtoUART erase_flash

### Setting up Python Controller
- Once ESP32 is up and running, we need to set up a device controller to
perform
- commissioning and cluster control.

Once ESP32 is up and running, we need to set up a device controller to perform
commissioning and cluster control.
### Setting up chip-tool

- Set up python controller.
See [the build guide](../../../docs/guides/BUILDING.md#prerequisites) for
general background on build prerequisites.

$ cd {path-to-connectedhomeip}
$ ./scripts/build_python.sh -m platform
Building the example:

- Execute the controller.
```
$ cd examples/chip-tool
$ source ./out/python_env/bin/activate
$ chip-device-ctrl
$ rm -rf out
### Commissioning over BLE
$ git submodule update --init
- Establish the secure session over BLE. BLE is the default mode in the
application and is configurable through menuconfig.
$ source third_party/connectedhomeip/scripts/activate.sh
- chip-device-ctrl > ble-scan
- chip-device-ctrl > connect -ble 3840 20202021 135246
$ gn gen out/debug
Parameters:
1. Discriminator: 3840 (configurable through menuconfig)
2. Setup-pin-code: 20202021 (configurable through menuconfig)
3. Node ID: Optional.
If not passed in this command, then it is auto-generated by the controller and displayed in the output of connect.
The same value should be used in the next commands.
We have chosen a random node ID which is 135246.
$ ninja -C out/debug
```

- Add credentials of the Wi-Fi network you want the ESP32 to connect to, using
the `AddOrUpdateWiFiNetwork` command and then enable the ESP32 to connect to
it using `EnableWiFiNetwork` command. In this example, we have used
`TESTSSID` and `TESTPASSWD` as the SSID and passphrase respectively.
which puts the binary at `out/debug/chip-tool`

- chip-device-ctrl > zcl NetworkCommissioning AddOrUpdateWiFiNetwork 135246 0 0 ssid=str:TESTSSID credentials=str:TESTPASSWD breadcrumb=0
### Commission a device using chip-tool

- chip-device-ctrl > zcl NetworkCommissioning ConnectNetwork 135246 0 0 networkID=str:TESTSSID breadcrumb=0
To initiate a client commissioning request to a device, run the built executable
and choose the pairing mode.

- Close the BLE connection to ESP32, as it is not required hereafter.
#### Commissioning over BLE

- chip-device-ctrl > close-ble
Run the built executable and pass it the discriminator and pairing code of the
remote device, as well as the network credentials to use.

- Resolve DNS-SD name and update address of the node in the device controller.
Get fabric ID using `get-fabricid` and use the decimal value of compressed
fabric id.
The command below uses the default values hard-coded into the debug versions of
the ESP32 all-clusters-app to commission it onto a Wi-Fi network:

- chip-device-ctrl > get-fabricid
$ .out/debug/chip-tool pairing ble-wifi 12344321 ${SSID} ${PASSWORD} 20202021 3840

- chip-device-ctrl > resolve <Compressed Fabric ID> 135246
Parameters:

### Cluster Control
1. Discriminator: 3840 (configurable through menuconfig)
2. Setup-pin-code: 20202021 (configurable through menuconfig)
3. Node-id: 12344321 (you can assign any node id)

- After successful commissioning, use the OnOff cluster commands to control
the OnOff attribute on different light devices connected on specific
endpoints. This allows you to toggle a parameter implemented by the device
to be On or Off.
### Cluster control

`chip-device-ctrl > zcl OnOff On 135246 2 0`
#### onoff

To use the Client to send Matter commands, run the built executable and pass it
the target cluster name, the target command name as well as an endpoint id.

$ .out/debug/chip-tool onoff on 12344321 1

The client will send a single command packet and then exit.
77 changes: 40 additions & 37 deletions examples/lock-app/esp32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This example demonstrates the mapping of OnOff cluster to lock/unlock logic.
- [CHIP ESP32 Lock Example](#chip-esp32-lock-example)
- [Building the Example Application](#building-the-example-application)
- [Commissioning and cluster control](#commissioning-and-cluster-control)
- [Setting up Python Controller](#setting-up-python-controller)
- [Setting up chip-tool](#setting-up-chip-tool)
- [Commissioning over BLE](#commissioning-over-ble)
- [Cluster control](#cluster-control)
- [Example Demo](#example-demo)
Expand Down Expand Up @@ -136,63 +136,66 @@ your network configuration. To erase it, simply run.

$ idf.py -p /dev/tty.SLAB_USBtoUART erase_flash

### Setting up Python Controller
- Once ESP32 is up and running, we need to set up a device controller to
perform
- commissioning and cluster control.

Once ESP32 is up and running, we need to set up a device controller to perform
commissioning and cluster control.
### Setting up chip-tool

- Set up python controller.
See [the build guide](../../../docs/guides/BUILDING.md#prerequisites) for
general background on build prerequisites.

$ cd {path-to-connectedhomeip}
$ ./scripts/build_python.sh -m platform
Building the example:

- Execute the controller.
```
$ cd examples/chip-tool
$ source ./out/python_env/bin/activate
$ chip-device-ctrl
$ rm -rf out
### Commissioning over BLE
$ git submodule update --init
- Establish the secure session over BLE. BLE is the default mode in the
application and is configurable through menuconfig.
$ source third_party/connectedhomeip/scripts/activate.sh
- chip-device-ctrl > ble-scan
- chip-device-ctrl > connect -ble 3840 20202021 135246
$ gn gen out/debug
Parameters:
1. Discriminator: 3840 (configurable through menuconfig)
2. Setup-pin-code: 20202021 (configurable through menuconfig)
3. Node ID: Optional.
If not passed in this command, then it is auto-generated by the controller and displayed in the output of connect.
The same value should be used in the next commands.
We have chosen a random node ID which is 135246.
$ ninja -C out/debug
```

- Add credentials of the Wi-Fi network you want the ESP32 to connect to, using
the `AddOrUpdateWiFiNetwork` command and then enable the ESP32 to connect to
it using `EnableWiFiNetwork` command. In this example, we have used
`TESTSSID` and `TESTPASSWD` as the SSID and passphrase respectively.
which puts the binary at `out/debug/chip-tool`

- chip-device-ctrl > zcl NetworkCommissioning AddOrUpdateWiFiNetwork 135246 0 0 ssid=str:TESTSSID credentials=str:TESTPASSWD breadcrumb=0
### Commission a device using chip-tool

- chip-device-ctrl > zcl NetworkCommissioning ConnectNetwork 135246 0 0 networkID=str:TESTSSID breadcrumb=0
To initiate a client commissioning request to a device, run the built executable
and choose the pairing mode.

- Close the BLE connection to ESP32, as it is not required hereafter.
#### Commissioning over BLE

- chip-device-ctrl > close-ble
Run the built executable and pass it the discriminator and pairing code of the
remote device, as well as the network credentials to use.

- Resolve DNS-SD name and update address of the node in the device controller.
The command below uses the default values hard-coded into the debug versions of
the ESP32 all-clusters-app to commission it onto a Wi-Fi network:

- chip-device-ctrl > resolve 135246
$ .out/debug/chip-tool pairing ble-wifi 12344321 ${SSID} ${PASSWORD} 20202021 3840

Parameters:

1. Discriminator: 3840 (configurable through menuconfig)
2. Setup-pin-code: 20202021 (configurable through menuconfig)
3. Node-id: 12344321 (you can assign any node id)

### Cluster control

- After successful commissioning, use the OnOff cluster command to control the
OnOff attribute. This allows you to toggle a parameter implemented by the
device to be On or Off.
#### onoff

To use the Client to send Matter commands, run the built executable and pass it
the target cluster name, the target command name as well as an endpoint id.

$ .out/debug/chip-tool onoff on 12344321 1

`chip-device-ctrl > zcl OnOff Off 135246 1 0`
The client will send a single command packet and then exit.

### Example Demo
## Example Demo

This demo app illustrates controlling OnOff cluster (Server) attributes of an
endpoint and lock/unlock status of door using LED's. For `ESP32-DevKitC`, a GPIO
Expand Down
Loading

0 comments on commit e57cd48

Please sign in to comment.