Skip to content

Commit

Permalink
Merge branch 'pr_315' into 'main'
Browse files Browse the repository at this point in the history
[GH_PR] Added User Label Cluster to generic_switch example.

See merge request app-frameworks/esp-matter!344
  • Loading branch information
dhrishi committed Apr 12, 2023
2 parents b566646 + e94bbd7 commit 16b4f98
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 10 additions & 2 deletions examples/generic_switch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This example creates a Generic Switch device using the ESP
Matter data model.
This example aims to demonstrate the use of Fixed Label Cluster which provides a feature for the device to tag an endpoint with zero or more read-only labels using nvs api.
This example aims to demonstrate the use of Fixed Label Cluster and User Label Cluster which provide a feature for the device to tag an endpoint with zero or more read-only labels using nvs api and zero or more labels respectively.

Note:
In order to retrieve the label-list from the fixed-label cluster the two options:
Expand All @@ -27,9 +27,17 @@ chip-tool pairing ble-wifi 0x7283 [ssid] [password] 20202020 3841
- To read the fixed-labels, use chip-tool.
- Command :
```
chip-tool fixedlabels read label-list 0x7283 1
chip-tool fixedlabel read label-list 0x7283 1
```

The example command given below should be executed to write to the label-list of User Label Cluster.
```
chip-tool userlabel write label-list '[{"label":"room", "value":"bedroom 1"}, {"label":"orientation", "value":"east"}]' 0x7283 1
```
To read label-list of User Label Cluster execute the command given below.
```
chip-tool userlabel read label-list 0x7283 1
```
## 2. Post Commissioning Setup

This should be followed by: Commission the generic switch device
Expand Down
3 changes: 3 additions & 0 deletions examples/generic_switch/main/app_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ extern "C" void app_main()
cluster::fixed_label::config_t fl_config;
cluster_t *fl_cluster = cluster::fixed_label::create(endpoint, &fl_config, CLUSTER_FLAG_SERVER);

cluster::user_label::config_t ul_config;
cluster_t *ul_cluster = cluster::user_label::create(endpoint, &ul_config, CLUSTER_FLAG_SERVER);

/* Add additional features to the node */
cluster_t *cluster = cluster::get(endpoint, Switch::Id);
#if CONFIG_GENERIC_SWITCH_TYPE_LATCHING
Expand Down

0 comments on commit 16b4f98

Please sign in to comment.