Multi-Generic Switch in Matter

Hi there,

I'm working on NCS 2.4.2 with 52840. Currently,I have tried using a single generic switch, and it works. However, I want to configure multiple generic switches.
But according to Matter Device Library v1.2 Chapter 6.6.4.2, a TagList SHALL be included in the Descriptor cluster on each such endpoint. 

My question is how to include TagList in Descriptor cluster?

Thanks
Ethan

Parents
  • Hello,

    You are referring to conflicting versions for NCS and Matter. NCS v2.4.2 uses Matter v1.1 and there were some changes in the Label-/TagList in Matter 1.2.

    Matter 1.1 has a requirement for the FixedLabel cluster on a Generic Switch device. The FixedLabel cluster has a LabelList which is the equivalent for the TagList in Matter 1.2. See Chapter 6.6.4 in Matter Device Library v1.1 for more.

    For future reference, the Matter versions for each NCS version is listed here.

    Best regards,

    Maria

  • Hi Maria,
    Thanks for your replay~ So if I want to implement a multi-generic switch, does that mean I need to enable the Fixed Label cluster in each generic switch endpoint?

    Thanks~
    Ethan

  • Hi Maria,

    Could you please provide an example that demonstrates how to use the Label cluster and Fixlabel cluster in a multi-generic switch? I would like to reference it for guidance.

    Thanks~

  • Hello,

    I'm starting out with a clarification: FixedLabel is a cluster which has LabelList as an attribute.

    The usage is as follows:

    • Every Generic Switch requires a FixedLabel cluster server. This can be enabled for the Generic Switch application through ZAP tool (Adding clusters guide).
    • The LabelList for each endpoint needs to be filled by the manufacturer and the contents should be specific to each switch. The format of the LabelList is a struct where its entry/entries has a label and a value.

    For code reference for the FixedLabel cluster, please see the source code for the FixedLabel cluster (server) for the implementation. You can find an example for using the LabelList in DeviceInfoProviderImpl.cpp in the provider examples. Note that the implementation has a hard-coded LabelList and is meant for testing only.

    In the Matter test suite for certification where is an example for how the TH writes to an attribute in the UserLabel cluster, which also applies to the FixedLabel cluster for a Generic Switch.

    Best regards,

    Maria

  • Hi Maria,

    Thanks for your replay. In this product,I need two generic switch.
    I've been used zap tool to add fixed label cluster in each generic switch endpoint and modified the hard-coded part in DeviceInfoProviderImpl.cpp like

    bool DeviceInfoProviderImpl::FixedLabelIteratorImpl::Next(FixedLabelType & output)
    {
        bool retval = true;
    
        // A hardcoded list for testing only
        CHIP_ERROR err = CHIP_NO_ERROR;
    
        const char * labelPtr = nullptr;
        const char * valuePtr = nullptr;
    
        VerifyOrReturnError(mIndex < 2, false);
    
        ChipLogProgress(DeviceLayer, "Get the fixed label with index:%u at endpoint:%d", static_cast<unsigned>(mIndex), mEndpoint);
    
    
        switch(mEndpoint)
        {
        case 0:
            printf("mIndex case 0\n");
            labelPtr = "room";
            valuePtr = "bedroom 2";
            break;
        case 1:
            printf("mIndex case 1\n");
            labelPtr = "orientation";
            valuePtr = "North";
            break;
        case 2:
            printf("mIndex case 2\n");
            labelPtr = "floor";
            valuePtr = "2";
            break;
        case 3:
            printf("mIndex case 3\n");
            labelPtr = "direction";
            valuePtr = "up";
            break;
        default:
            err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND;
            break;
        }
    
        if (err == CHIP_NO_ERROR)
        {
            VerifyOrReturnError(std::strlen(labelPtr) <= kMaxLabelNameLength, false);
            VerifyOrReturnError(std::strlen(valuePtr) <= kMaxLabelValueLength, false);
    
            Platform::CopyString(mFixedLabelNameBuf, kMaxLabelNameLength + 1, labelPtr);
            Platform::CopyString(mFixedLabelValueBuf, kMaxLabelValueLength + 1, valuePtr);
    
            output.label = CharSpan::fromCharString(mFixedLabelNameBuf);
            output.value = CharSpan::fromCharString(mFixedLabelValueBuf);
    
            mIndex++;
    
            retval = true;
        }
        else
        {
            retval = false;
        }
    
        return retval;
    }
    

    I utilized mEndpoint to assign distinct labels for different endpoints. However, upon pairing this device with HomeApp, I'm observing that only a single generic label is displayed.

    Any suggertion?

    Thanks~
    Ethan

  • By the way, there is another issue. I frequently encounter an error during device pairing with HomeApp.

    E: 83484 [DMG]Error retrieving data from clusterId: 0x0000_001D, err = b
    .....
    E: 83021 [DMG]Error retrieving data from clusterId: 0x0000_003E, err = b
    ......
    E: 55885 [DMG]Error retrieving data from clusterId: 0x0000_0028, err = b
    ..........

    I found that error "b" in CHIPError.h means " The attempt to allocate a buffer or object failed due to a lack of memory".  Although I have increased CONFIG_CHIP_MALLOC_SYS_HEAP_SIZE, the issue still persists in every pairing attempt.

  • The err = b indicates that the current buffer for an outgoing ReportData buffer has run out. It is not serious, because the data will be sent in the next chunk.

    The devs are aware of the misleading message classification.

Reply Children
No Data
Related