## Add the Manufacturer Specific (MS) Cluster to your device

[ZCL Advanced Platform (ZAP)](https://developers.home.google.com/matter/tools/zap.md.txt) is used to configure
Matter clusters and other device features. Use the ZAP GUI
to add your custom MS cluster to your device. Starting with
`rootnode_onofflight_bbs1b7IaOV.zap` as a base reference device, create a copy
of its data model:

    $ cd examples/chef
    $ cp rootnode_onofflight_bbs1b7IaOV.zap rootnode_onofflight_samplemei.zap

Run the UI using your new device as input:

    $ ./chef.py -d rootnode_onofflight_samplemei -t linux -gzb

1. Once the UI is loaded, click **Endpoint - 1**:

   ![image](https://developers.home.google.com/static/matter/extensions/images/zap-gui-cluster-endpoint.png)
2. Search for your cluster by entering its name in the **Search Clusters**
   field. Once located, select **Not Enabled** and change it to **Server**:

   ![image](https://developers.home.google.com/static/matter/extensions/images/zap-gui-cluster-search.png)
3. Click the to configure the
   cluster:

   ![image](https://developers.home.google.com/static/matter/extensions/images/zap-gui-cluster-configure.png)
4. In the **Attributes** tab, ensure all attributes are enabled:

   ![image](https://developers.home.google.com/static/matter/extensions/images/zap-gui-attributes.png)
5. In the **Commands** tab ensure all commands are enabled:

   ![image](https://developers.home.google.com/static/matter/extensions/images/zap-gui-commands.png)
6. Leave the cluster configuration window by clicking on the
   button.

7. Save your data model by selecting **File \> Save** or Ctrl+S.

8. Exit ZAP by selecting **File \> Exit** or Ctrl+Q. The build starts.

9. Regenerate the ZAP and codegen files with:

       $ ../../scripts/tools/zap_regen_all.py

   <br />

10. Run your sample in your local machine with:

        $ linux/out/rootnode_onofflight_samplemei

## Test using chip-tool

In a different terminal, build `chip-tool` with your new MS clusters with:

    $ cd <chip_root>/examples/chip-tool
    $ source <chip_root>/scripts/activate.sh
    $ gn gen out
    $ ninja -C out

Once you are running your sample in your local machine, use `chip-tool`
to commission it:

```bash
out/chip-tool pairing onnetwork 1 20202021
```

To read from an attribute, enter:

    $ out/chip-tool samplemei read flip-flop 1 1 # destination-id, endpoint-id
    (...)
    CHIP:DMG: ReportDataMessage =
    CHIP:DMG: {
    CHIP:DMG:       AttributeReportIBs =
    CHIP:DMG:  [
    CHIP:DMG:    AttributeReportIB =
    CHIP:DMG:    {
    CHIP:DMG:      AttributeDataIB =
    CHIP:DMG:      {
    CHIP:DMG:        DataVersion = 0x2999c13f,
    CHIP:DMG:        AttributePathIB =
    CHIP:DMG:        {
    CHIP:DMG:          Endpoint = 0x1,
    CHIP:DMG:          Cluster = 0xfff1fc20,
    CHIP:DMG:          Attribute = 0x0000_0000,
    CHIP:DMG:        }
    CHIP:DMG:
    CHIP:DMG:        Data = false,
    CHIP:DMG:      },
    CHIP:DMG:
    CHIP:DMG:    },
    CHIP:DMG:
    CHIP:DMG:  ],
    CHIP:DMG:
    CHIP:DMG:  SuppressResponse = true,
    CHIP:DMG:  InteractionModelRevision = 10
    CHIP:DMG: }
    CHIP:TOO: Endpoint: 1 Cluster: 0xFFF1_FC20 Attribute 0x0000_0000 DataVersion: 697942335
    CHIP:TOO:   FlipFlop: FALSE
    (...)

To write to an attribute:

    $ out/chip-tool samplemei write flip-flop true 1 1
    (...)
    CHIP:DMG: WriteResponseMessage =
    CHIP:DMG: {
    CHIP:DMG:  AttributeStatusIBs =
    CHIP:DMG:  [
    CHIP:DMG:    AttributeStatusIB =
    CHIP:DMG:    {
    CHIP:DMG:      AttributePathIB =
    CHIP:DMG:      {
    CHIP:DMG:        Endpoint = 0x1,
    CHIP:DMG:        Cluster = 0xfff1fc20,
    CHIP:DMG:        Attribute = 0x0000_0000,
    CHIP:DMG:      }
    CHIP:DMG:
    CHIP:DMG:      StatusIB =
    CHIP:DMG:      {
    CHIP:DMG:        status = 0x00 (SUCCESS),
    CHIP:DMG:      },
    CHIP:DMG:
    CHIP:DMG:    },
    CHIP:DMG:
    CHIP:DMG:  ],
    CHIP:DMG:
    CHIP:DMG:  InteractionModelRevision = 10
    CHIP:DMG: }
    (...)

And to call a command:

    $ out/chip-tool samplemei ping 1 1
    (...)
    CHIP:DMG: InvokeResponseMessage =
    CHIP:DMG: {
    CHIP:DMG:  suppressResponse = false,
    CHIP:DMG:  InvokeResponseIBs =
    CHIP:DMG:  [
    CHIP:DMG:    InvokeResponseIB =
    CHIP:DMG:    {
    CHIP:DMG:      CommandStatusIB =
    CHIP:DMG:      {
    CHIP:DMG:        CommandPathIB =
    CHIP:DMG:        {
    CHIP:DMG:          EndpointId = 0x1,
    CHIP:DMG:          ClusterId = 0xfff1fc20,
    CHIP:DMG:          CommandId = 0x0,
    CHIP:DMG:        },
    CHIP:DMG:
    CHIP:DMG:        StatusIB =
    CHIP:DMG:        {
    CHIP:DMG:          status = 0x00 (SUCCESS),
    CHIP:DMG:        },
    CHIP:DMG:
    CHIP:DMG:      },
    CHIP:DMG:
    CHIP:DMG:    },
    CHIP:DMG:
    CHIP:DMG:  ],
    CHIP:DMG:
    CHIP:DMG:  InteractionModelRevision = 10
    CHIP:DMG: },
    (...)