Skip to content

Commit

Permalink
[Ameba] Shell commands update (#23005)
Browse files Browse the repository at this point in the history
* [Shell] Read cluster attributes from matter shell
- Received data but DataResponse is still not printed out
- Support more OnOff commands for matter shell

* [Shell] enable inputting arguments for certain commands

* [Shell] Add levelcontrol commands to shell
- Separate different cluster commands into header files

* [Shell] Add colorcontrol commands to shell

* [Shell] Add thermostat commands to shell

* [Shell] Add handlers for group commands

* [README] Update readme for all-clusters-app

* [Shell] Add identify commands to shell

* [Shell] Increase the number of tokens to fit more arguments
- Add in missing colorcontrol commands
- Fix readme link

* [Shell] Enable reading of attribute list

* [Shell] Fix transition data type and argument errors
- Added logs for levelcontrol commands

* [Shell] Fix compile errors for when CONFIG_ENABLE_CHIP_SHELL is disabled
- Added CONFIG_ENABLE_CHIP_SHELL macro to block off code that requires shell

* [Resyle] fix styling

* Restyled by prettier-markdown

* [Shell] Change ColorTemperature to ColorTemperatureMireds

* [Readme] Update all-clusters-app readme

* [Shell] Change currentx and currenty to current-x and current-y respectively
- To avoid spell check failing as it identifies currenty as mispelling of currently

* [Readme] Restyle

* [Shell] Fix typecasting error

* [Shell] restyle

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
pankore and restyled-commits authored Nov 23, 2022
1 parent dbc2f44 commit 33b9046
Show file tree
Hide file tree
Showing 10 changed files with 4,641 additions and 198 deletions.
1 change: 1 addition & 0 deletions config/ameba/chip.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ list(
-DCHIP_DEVICE_LAYER_TARGET=Ameba
-DMBEDTLS_CONFIG_FILE=<mbedtls_config.h>
-D_POSIX_REALTIME_SIGNALS
-DCHIP_SHELL_MAX_TOKENS=11
)

list(
Expand Down
49 changes: 38 additions & 11 deletions examples/all-clusters-app/ameba/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ control.
- [Cluster control](#cluster-control)
- [Running RPC Console](#running-rpc-console)
- [Running Matter Shell](#running-matter-shell)
- [Binding and Controlling a Lighting Device](#binding-and-controlling-a-lighting-device)
- [Binding and Controlling a Device](#binding-and-controlling-a-device)

---

Expand Down Expand Up @@ -137,28 +137,55 @@ to be On or Off.

- Open the USB-TTL serial port and type `help` to view the available commands

## Binding and Controlling a Lighting Device
- To know what are the available subcommands are there, enter `switch` command
in the shell

- This example shows how to bind a Switch Device to a Lighting Device and
## Binding and Controlling a Device

- This example shows how to bind a Switch Device to a Controllee Device and
control it through the Matter Shell. One binding client (Switch Device) and
one binding server (Lighting Device) is required.
one binding server (Controllee) is required.

- Commission the switch (nodeID 1) and lighting device (nodeID 2) using
- Commission the switch (nodeID 1) and controllee device (nodeID 2) using
chip-tool.

$ ./chip-tool pairing ble-wifi 1 <SSID> <PASSWORD> 20202021 3840
$ ./chip-tool pairing ble-wifi 2 <SSID> <PASSWORD> 20202021 3840

* After successful commissioning, configure the ACL in the lighting device to
allow access from switch device and chip-tool.
- After successful commissioning, configure the ACL in the controllee device
to allow access from switch device and chip-tool.

$ ./chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null },{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [1], "targets": null }]' 2 0

- Bind the lighting device to the switch device.
- Bind the endpoint 1 OnOff cluster of the controllee device to the switch
device.

$ ./chip-tool binding write binding '[{"fabricIndex": 1, "node":2, "endpoint":1, "cluster":6}]' 1 1

- Control the lighting device through the switch device's Matter Shell
- Send OnOff command to the device through the switch device's Matter Shell

`switch onoff on`

`switch onoff off`

* You may also bind more than one cluster to the switch device. Below command
binds the Identify, OnOff, LevelControl, ColorControl and Thermostat
clusters to the switch device.

$ ./chip-tool binding write binding '[{"fabricIndex": 1, "node":2, "endpoint":1, "cluster":3}, {"fabricIndex": 1, "node":2, "endpoint":1, "cluster":6}, {"fabricIndex": 1, "node":2, "endpoint":1, "cluster":8}, {"fabricIndex": 1, "node":2, "endpoint":1, "cluster":768}, {"fabricIndex": 1, "node":2, "endpoint":1, "cluster":513}]' 1 1

- After binding the clusters, you may send these cluster commands to the
controllee device through the switch device's Matter Shell. Follow the
format shown in the description of the commands.

`switch onoff on`

`switch levelcontrol movetolevel 100 0 0 0`

`switch colorcontrol movetohue 100 0 0 0 0`

`switch thermostat SPRL 0 0`

* You may also request to read cluster attributes from Matter Shell

> switch onoff on
> switch onoff off
`switch <cluster> read <attribute>`
1 change: 1 addition & 0 deletions examples/all-clusters-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ list(
-DUSE_ZAP_CONFIG
-DCHIP_HAVE_CONFIG_H
-DMBEDTLS_CONFIG_FILE=<mbedtls_config.h>
-DCHIP_SHELL_MAX_TOKENS=11
)

if (matter_enable_persistentstorage_audit)
Expand Down
Loading

0 comments on commit 33b9046

Please sign in to comment.