Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EFR32][Groups] Add group commands support to light-switch example #15727

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1373,3 +1373,19 @@ zephyrproject
Zigbee
zigbeealliance
zigbeethread
libshell
TestGroupDemoConfig
ACLs
AddNOC
CHIPConfig
CHIPProjectAppConfig
CaseAdminNode
DataVersion
ProxyView
ReadAttribute
WriteAttribute
kAdminister
kManage
kOperate
kView
xFFFFFFFD
34 changes: 28 additions & 6 deletions examples/light-switch-app/efr32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,21 @@ combination with JLinkRTTClient as follows:

**Matter shell**

- 'switch on' : Sends On command to bound device
**_OnOff Cluster_**

- 'switch off' : Sends Off command to bound device
- 'switch onoff on' : Sends unicast On command to bound device
- 'switch onoff off' : Sends unicast Off command to bound device
- 'switch onoff toggle' : Sends unicast Toggle command to bound device

- 'switch toggle : Sends Toggle command to bound device
- 'switch groups onoff on' : Sends On group command to bound group
- 'switch groups onoff off' : Sends On group command to bound group
- 'switch groups onoff toggle' : Sends On group command to bound group

* You can provision and control the Chip device using the python controller,
Chip tool standalone, Android or iOS app

[CHIPTool](https://github.com/project-chip/connectedhomeip/blob/master/examples/chip-tool/README.md)
standalone, Android or iOS app

Here is an example with the CHIPTool:
Here is an example with the CHIPTool for unicast commands only:

```
chip-tool pairing ble-thread 1 hex:<operationalDataset> 20202021 3840
Expand All @@ -280,6 +283,25 @@ combination with JLinkRTTClient as follows:
chip-tool binding write binding '[{"fabricIndex": 1, "node": <lighting-node-id>, "endpoint": 1, "cluster":6}]' 1 1
```

Here is an example with the CHIPTool for groups commands only:

```
chip-tool pairing ble-thread 1 hex:<operationalDataset> 20202021 3840

chip-tool tests TestGroupDemoConfig --nodeId 1

chip-tool tests TestGroupDemoConfig --nodeId <lighting-node-id>

chip-tool binding write binding '[{"fabricIndex": 1, "group": 257}]' 1 1
```

To run the example with unicast and groups commands, run the group
configuration commands and replace the last one with binding this command

```
chip-tool binding write binding '[{"fabricIndex": 1, "group": 257},{"fabricIndex": 1, "node": <lighting-node-id>, "endpoint": 1, "cluster":6} ]' 1 1
```

### Notes

- Depending on your network settings your router might not provide native ipv6
Expand Down
6 changes: 3 additions & 3 deletions examples/light-switch-app/efr32/include/binding-handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
#include "lib/core/CHIPError.h"

CHIP_ERROR InitBindingHandler();
void SwitchToggleOnOff(intptr_t context);
void SwitchOnOffOn(intptr_t context);
void SwitchOnOffOff(intptr_t context);
void SwitchWorkerFunction(intptr_t context);

struct BindingCommandData
{
chip::EndpointId localEndpointId = 1;
chip::CommandId commandId;
chip::ClusterId clusterId;
bool isGroup = false;
};
6 changes: 5 additions & 1 deletion examples/light-switch-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,11 @@ void AppTask::SwitchActionEventHandler(AppEvent * aEvent)
{
if (aEvent->Type == AppEvent::kEventType_Button)
{
chip::DeviceLayer::PlatformMgr().ScheduleWork(SwitchToggleOnOff, 0);
BindingCommandData * data = Platform::New<BindingCommandData>();
data->commandId = chip::app::Clusters::OnOff::Commands::Toggle::Id;
data->clusterId = chip::app::Clusters::OnOff::Id;

DeviceLayer::PlatformMgr().ScheduleWork(SwitchWorkerFunction, reinterpret_cast<intptr_t>(data));
}
}

Expand Down
Loading