Groups Cluster

Cluster ID: 0x0004  |  Endpoint: Typically on Endpoint 1 (application endpoint)

The Groups Cluster manages group membership for devices and is the foundation of Matter multicast messaging. By adding multiple devices to the same Group, commands sent to that Group ID are received by all member devices simultaneously -- for example, "turn off all living room lights at once" is a typical multicast scenario.

Multicast vs. Unicast

Without Groups, controlling 5 lights requires sending 5 individual unicast commands, and latency increases linearly with the number of devices. With Groups, only 1 multicast command is needed, and all members respond almost simultaneously. This is also where the combination of Groups and Scenes delivers the most value -- a single multicast command can make different devices each execute their preset actions (lights to warm tone, curtains half open, AC to 26 degrees).

Commands

The Groups Cluster has 6 commands for managing device group membership. AddGroup, RemoveGroup, and RemoveAllGroups are write operations; ViewGroup and GetGroupMembership are query operations; AddGroupIfIdentifying is a conditional write command (the device must be in Identify mode for it to take effect). Click a command ID in the table below to jump to its detailed description.

ID Name Direction Description
0x00 AddGroup Request / Response Add the device to a specified group
0x01 ViewGroup Request / Response Query the name of a specified group
0x02 GetGroupMembership Request / Response Query the list of groups the device belongs to
0x03 RemoveGroup Request / Response Remove the device from a specified group
0x04 RemoveAllGroups Request only Remove the device from all groups
0x05 AddGroupIfIdentifying Request only Add to group only when in Identify mode

AddGroup -- Add to Group (0x00)

Adds the current device (Endpoint) to a specified Group. If the device is already a member of that group, the command still succeeds (idempotent), but will update the group name (if the device supports the GN feature). Returns an AddGroupResponse containing the operation status and GroupID.

ParameterTypeRequiredDescription
GroupID group-id Yes Target Group ID, range 0x0001 ~ 0xFEFF
GroupName string Yes Group name (max 16 bytes). Pass an empty string if the device does not support the GN feature

AddGroupResponse

FieldTypeDescription
Status status 0x00 = SUCCESS, 0x89 = RESOURCE_EXHAUSTED (group table is full)
GroupID group-id The GroupID from the request, echoed back

Request example:

{
  "invokeRequests": [{
    "commandPath": {
      "endpointId": 1,
      "clusterId": "0x0004",
      "commandId": "0x00"       // AddGroup
    },
    "commandFields": {
      "0": 1,                   // GroupID = 0x0001
      "1": "Living Room Lights" // GroupName
    }
  }]
}

Response example:

{
  "invokeResponseValue": {
    "commandPath": {
      "endpointId": 1,
      "clusterId": "0x0004",
      "commandId": "0x00"       // AddGroupResponse
    },
    "commandFields": {
      "0": 0,                   // Status = SUCCESS
      "1": 1                    // GroupID = 0x0001
    }
  }
}
Usage Scenarios

After the user creates a "Living Room" room in the app, the app automatically assigns a GroupID to that room, then sends an AddGroup command to each device in the room to add them all to the same group. When the user taps "Turn off all lights," the app only needs to send one multicast Off command to that GroupID.

ViewGroup -- View Group (0x01)

Queries whether the device belongs to a specified Group, and if so, returns the group's name.

ParameterTypeRequiredDescription
GroupID group-id Yes The Group ID to query

ViewGroupResponse

FieldTypeDescription
Status status 0x00 = SUCCESS (device belongs to the group), 0x8B = NOT_FOUND (not a member)
GroupID group-id The GroupID from the request, echoed back
GroupName string Group name. Only valid when Status = SUCCESS; returns an empty string if the GN feature is not supported
Usage Scenarios

After the app restores room configurations from the cloud, it sends ViewGroup to each device to confirm whether the group membership is still intact -- if a device lost its group information due to a factory reset, the app needs to re-send AddGroup.

GetGroupMembership -- Query Group Membership (0x02)

Queries which groups a device belongs to in bulk. You can pass a list of GroupIDs for a filtered query, or pass an empty list to retrieve all groups the device belongs to. The response also includes a Capacity field that indicates how many more groups the device can join.

ParameterTypeRequiredDescription
GroupList list[group-id] Yes List of Group IDs to query. Pass an empty list [] to query all groups the device belongs to

GetGroupMembershipResponse

FieldTypeDescription
Capacity uint8 / null Number of additional groups the device can join. null means unknown
GroupList list[group-id] List of Group IDs the device actually belongs to (the intersection of the request list and actual membership; returns all when the request list is empty)

Request example (query whether the device belongs to groups 1, 2, 3):

{
  "invokeRequests": [{
    "commandPath": {
      "endpointId": 1,
      "clusterId": "0x0004",
      "commandId": "0x02"       // GetGroupMembership
    },
    "commandFields": {
      "0": [1, 2, 3]            // GroupList -- query if device belongs to these three groups
    }
  }]
}

Response example (device belongs to groups 1 and 3, can join 5 more groups):

{
  "invokeResponseValue": {
    "commandPath": {
      "endpointId": 1,
      "clusterId": "0x0004",
      "commandId": "0x02"       // GetGroupMembershipResponse
    },
    "commandFields": {
      "0": 5,                   // Capacity = 5 (can join 5 more groups)
      "1": [1, 3]               // GroupList -- device belongs to groups 1 and 3
    }
  }
}
Usage Scenarios

At app startup, the device's group membership needs to be synchronized: pass an empty GroupList to retrieve all groups the device belongs to, then compare with the room configuration stored in the cloud to handle any added or lost group memberships. The Capacity field can be used to determine whether the device has room to join additional groups.

RemoveGroup -- Remove from Group (0x03)

Removes the device from a specified Group. If the device is not a member of that group, returns NOT_FOUND. After removing the group membership, the device will no longer respond to multicast commands for that group.

ParameterTypeRequiredDescription
GroupID group-id Yes The Group ID to remove the device from

RemoveGroupResponse

FieldTypeDescription
Status status 0x00 = SUCCESS, 0x8B = NOT_FOUND
GroupID group-id The GroupID from the request, echoed back
Associated Scenes Are Deleted

When removing a group, all Scenes bound to that group are also automatically deleted. If you only want to temporarily stop the device from responding to multicast while keeping the Scene configuration, there is currently no "pause group membership" mechanism -- you can only remove and re-add.

Usage Scenarios

The user moves a light from the "Living Room" to the "Bedroom": The app first sends RemoveGroup (Living Room GroupID) to the light, then sends AddGroup (Bedroom GroupID).

RemoveAllGroups -- Remove from All Groups (0x04)

Removes the device from all joined groups, effectively clearing the group table. Takes no parameters and has no response. Also deletes all associated Scenes.

Use with Caution

This command clears all group memberships and all Scenes from the device at once, and cannot be undone. Typically used only during factory reset, device handover, or re-commissioning.

Usage Scenarios

During the factory reset process, the app sends RemoveAllGroups before Remove Fabric to ensure no multicast configuration remains on the device.

AddGroupIfIdentifying -- Add to Group If Identifying (0x05)

Functions the same as AddGroup, but with an added precondition: the device must currently be in Identify mode (i.e., the Identify Cluster's IdentifyTime > 0) for the command to execute. If the device is not in Identify mode, the command is silently ignored. There is no response.

ParameterTypeRequiredDescription
GroupID group-id Yes Target Group ID
GroupName string Yes Group name (max 16 bytes)
Why This Command Exists

During commissioning, devices are typically put into Identify mode first (the user confirms "this is the right device"), then AddGroupIfIdentifying is sent via multicast in bulk -- only the device that is currently flashing/beeping will join the group, while other devices are unaffected. This avoids the complex process of obtaining each device's address individually to send unicast AddGroup commands.

Usage Scenarios

Bulk configuration of newly installed light fixtures: the installer triggers Identify on each light one by one (via physical button or scanning a code), then sends the same AddGroupIfIdentifying multicast command in bulk. Each light that is flashing when it receives the command automatically joins the specified group; lights not flashing ignore the command.

Attributes

The Groups Cluster has only one application attribute. Click the attribute ID to jump to its detailed description.

ID Name Type Access Description
0x0000 NameSupport bitmap8 Read-only Whether the device supports storing group names

NameSupport (Name Support)

An 8-bit bitmap indicating whether the device supports storing group names. Currently only Bit 7 (the most significant bit) is used.

ID Name Type Description
0x0000 NameSupport bitmap8 Bit 7 (0x80): GroupNames -- when 1, the device can store group names. When 0, the GroupName in AddGroup is ignored, and the GroupName in ViewGroup responses is always an empty string

NameSupport Bitmap

Bit 7
GroupNames Supports storing group names (corresponds to GN Feature)
Bit 0~6
Reserved Reserved bits, always 0
Relationship Between NameSupport and FeatureMap

Bit 7 of NameSupport and Bit 0 (GN) of FeatureMap are linked: if FeatureMap declares GN, then Bit 7 of NameSupport must also be 1. The two should remain consistent when read.

Feature Bitmap

The Groups Cluster declares optional capabilities supported by the device through FeatureMap (0xFFFC):

Bit 0
GN (GroupNames) Supports storing group names -- when enabled, the GroupName in AddGroup is saved, and ViewGroup can retrieve the name
Most Devices Support GN

Storing group names consumes very few resources (max 16 bytes per group), and the vast majority of Matter devices enable the GN feature. Devices that do not support GN are typically extremely resource-constrained sensor products. The app should check FeatureMap first and not display the group name editing UI when GN is not supported.

Example Data

Reading the Groups Cluster attributes of a device that supports the GN feature:

{
  // --- Attributes ---
  "0x0000": 128          // NameSupport -- Bit 7 = 1, supports group names
}
GroupID Range

The valid GroupID range is 0x0001 ~ 0xFEFF. 0x0000 is invalid, and 0xFF00 ~ 0xFFFF are reserved for internal Matter use. When assigning GroupIDs, the app must ensure they are within the valid range and that different groups within the same Fabric use different IDs.

Common Scenarios

Scenario 1: Organizing Devices by Room (Most Common)
  1. The app assigns a unique GroupID to each room (e.g., Living Room = 0x0001, Bedroom = 0x0002)
  2. When the user drags a device into a room, the app sends AddGroup(GroupID, RoomName) to the device
  3. When the user taps "Turn off all living room lights," the app sends a single multicast Off command to GroupID 0x0001
  4. All lights in the living room turn off simultaneously with near-zero latency
Scenario 2: Multi-Device Linked Control
  1. The user creates a "Theater Mode" group (GroupID = 0x0010) containing a chandelier, LED strip, and motorized curtain
  2. Send AddGroup to all devices in the group
  3. When Theater Mode is triggered, send multicast commands to GroupID 0x0010:
    • Lights receive LevelControl.MoveToLevel(20) to dim the brightness
    • Curtain receives WindowCovering.GoToLiftPercentage(100) to fully close
  4. Note: multicast commands are sent to all devices in the group; each device only executes Cluster commands it supports
Scenario 3: Groups + Scenes Combined (Automation Presets)

Groups and Scenes are the most powerful combination in Matter -- Groups define "which devices act together," and Scenes define "what each device does individually."

  1. Create a "Living Room" group (GroupID = 0x0001), adding 3 lights and 1 curtain
  2. Create a Scene "Reading Mode" (SceneID = 0x01) under that group:
    • Chandelier: brightness 80%, color temperature 4000K
    • Desk lamp: brightness 100%, color temperature 5000K
    • LED strip: off
    • Curtain: open 50%
  3. When triggered, send a single Scenes.RecallScene(SceneID: 0x01) multicast command to GroupID 0x0001
  4. All devices simultaneously switch to their respective preset states with a single command
Scenario 4: Bulk Group Setup During Commissioning
  1. The installer puts the target device into Identify mode (by pressing a physical button or triggering via app scan)
  2. Send AddGroupIfIdentifying(GroupID, GroupName) to the network multicast address
  3. Only the device that is currently flashing joins the group; other devices ignore the command
  4. Repeat the above steps for the next device, completing group setup one by one
  5. This approach is especially suitable for initial deployment of large numbers of devices (e.g., offices, hotels)