Matter: How to add custom attributes and commands into the standard cluster (ex: occupancy cluster server)

Dear Team,

I would like to know if it is possible to add custom attributes and commands to standard clusters, such as the Occupancy cluster. I have reviewed the "Adding a Custom Cluster" guide provided by Nordic, but I am unsure how to proceed with modifying standard clusters.

Could you please advise if this is feasible and, if so, provide some guidance on how to implement it?

Best regards,
Bhavya

Parents
  • Hi Bhavya, 

    I will investigate if it is allowed by the Matter specification to add attributes/commands which are not included in the cluster definition. I suggest that you also check this if you are able to. 

    I assume you are using the latest nRF Connect SDK release (v3.0.2)? This is important to refer to the correct version of the Matter specification(s). If you are using nRF Connect SDK, the Matter v1.4 specification is the correct version. 

    Best regards,

    Maria

  • Hi  ,

    Yes, I have also done a pristine build. But it seems like after adding the below code snippet in the CMakefile, I can compile.

    # Override zap-generated directory.
    get_filename_component(CHIP_APP_ZAP_DIR ${CONFIG_NCS_SAMPLE_MATTER_ZAP_FILES_PATH}/zap-generated REALPATH CACHE)
    message(STATUS "CHIP_APP_ZAP_DIR: ${CHIP_APP_ZAP_DIR}")

    Thank you,

    Bhavya

  • Hi Maria,

    I’ve successfully added a custom command to the existing Occupancy (0x0406) cluster, and it works fine. Now, I want to add a struct attribute and a simple standalone attribute in the same cluster.

    I am using the following command to load my extended XML:

    west zap-gui -j ./zcl.json --clusters ./new.xml
    

    But the new attributes are not appearing in ZAP-GUI. I believe I might be missing something in the XML definition.

    Could you please guide me on the correct way to define structs and attributes in XML so they show up properly in ZAP-GUI?

    Thanks,
    Rahul chauhan.

  • Hi  ,

    We are able to add custom commands in the standard cluster and also able to add attribute with the simple data type like int8, uint8 but we are facing issue in adding attributes with the structure data type. One more thing I would like to inform you that, the tool "nrf connect Matter manufacturer cluster editor" is not able to generate XML code for the structures so we have put the structure code in xml file manually as below.

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <configurator>
    
      <struct apiMaturity="stable" name="RoomSizeCfgStruct">
        <cluster code="0x0406"/> <!-- Occupancy Sensing Cluster -->
        <item name="minMeters" fieldId="1" type="int16u" optional="false"/>
        <item name="maxMeters" fieldId="2" type="int16u" optional="false"/>    
      </struct>
    
      <clusterExtension code="0x406">
        <attribute side="server" code="0xfff11004" define="ZONE_OCCUPANCY" type="int16u" writable="true" optional="false" default="0" name="ZoneOccupancy">
          <description>ZoneOccupancy</description>
        </attribute>
        <attribute name="RoomSize" side="server" code="0xfff11000" define="ROOM_SIZE" type="RoomSizeCfgStruct" writable="false" optional="false" storage="external">
          <description>RoomSize</description>      
        </attribute>
        <command name="RoomSizeCfg" code="0xfff10000" source="client" response="CfgCmdResponse" optional="false" disableDefaultResponse="false">
          <description>Configure rangeSelCfg</description>
          <arg name="minMeters" type="single"/>
          <arg name="maxMeters" type="single"/>
        </command>
      </clusterExtension>
    </configurator>
    
    

    we have selected storage as RAM

    initially we are facing issue in generating code using zap-generate --full. We have added in attribute name manually in zcl.json file at attributeAccessInterfaceAttributes as below.

    I am able to generate files and build it but not able to read the attribute value throgh chip tool. Can you please try to replicate the attribute addition with struct type and check the behavior if we are missing something.

    Thank you,

    Bhavya 

  • Hi,

    I saw you created a new ticket here:  Support Needed for Adding Custom Attribute of Struct data type in standard cluster .

    Do you wish to continue in the new ticket or this one?

    I have replied in the other ticket already, so I will copy my response here:

    Can you try changing the type to array and adding RoomSizeCfgStruct as entryType instead? Like this:

    <attribute name="RoomSize" side="server" code="0xfff11000" define="ROOM_SIZE" type="array" entryType="RoomSizeCfgStruct" writable="false" optional="false" storage="external">

    Here is the full XML with this change:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <configurator>
      <struct apiMaturity="stable" name="RoomSizeCfgStruct">
        <cluster code="0x0406"/> <!-- Occupancy Sensing Cluster -->
        <item name="minMeters" fieldId="1" type="int16u" optional="false"/>
        <item name="maxMeters" fieldId="2" type="int16u" optional="false"/>    
      </struct>
      <clusterExtension code="0x0406">
        <attribute side="server" code="0xfff11004" define="ZONE_OCCUPANCY" type="int16u" writable="true" optional="false" default="0" name="ZoneOccupancy">
          <description>ZoneOccupancy</description>
        </attribute>
        <attribute name="RoomSize" side="server" code="0xfff11000" define="ROOM_SIZE" type="array" entryType="RoomSizeCfgStruct" writable="false" optional="false" storage="external">
          <description>RoomSize</description>      
        </attribute>
      </clusterExtension>
    </configurator>

    Best regards,
    Marte 

  • Hi  ,

    We can continue in the new ticket.

    You can close this ticket.

    Thank you,

    Bhavya

Reply Children
No Data
Related