Matter Custom cluster Build error ValueError: Unhandled server cluster:

I am trying to Build a modified version of the Matter weather station with additional endpoints

I have created a custom Cluster and Custom Device type via Matter Cluster editor
I cant find specific guidance on this process

I have tried adding these using both  

west zap-gui --clusters ./src/default_zap/scene_sequence.xml


and (am using -o so doesn't overwrite external/modules/lib/matter/src/app/zap-templates/zcl/zcl.json)
west zap-append -o ./src/default_zap/zcl-ammended.json ./src/default_zap/scene_sequence.xml
west zap-gui -j ./src/default_zap/zcl-ammended.json

Both seem to work (no errors)

then run 

west zap-generate


have also tried
west zap-generate -j



but when i try to build i get 

CMake Error at /home/fireblade/test2/matter_weather_station/external/modules/lib/matter/src/app/chip_data_model.cmake:56 (message):
  Failed to execute zap_cluster_list.py: Traceback (most recent call last):

    File "/home/fireblade/test2/matter_weather_station/external/modules/lib/matter/src/app/zap_cluster_list.py", line 113, in <module>
      main()
    File "/home/fireblade/test2/matter_weather_station/external/modules/lib/matter/src/app/zap_cluster_list.py", line 107, in main
      dump_zapfile_clusters(args.zap_file, args.cluster_implementation_data, args.external_clusters)
    File "/home/fireblade/test2/matter_weather_station/external/modules/lib/matter/src/app/zap_cluster_list.py", line 77, in dump_zapfile_clusters
      get_cluster_sources(server_clusters, SERVER_CLUSTERS, 'server'))
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/fireblade/test2/matter_weather_station/external/modules/lib/matter/src/app/zap_cluster_list.py", line 25, in get_cluster_sources
      raise ValueError("Unhandled %s cluster: %s"

  ValueError: Unhandled server cluster: scene_sequence (hint: add to
  src/app/zap_cluster_list.json)

Call Stack (most recent call first):
  /home/fireblade/test2/matter_weather_station/external/modules/lib/matter/src/app/chip_data_model.cmake:106 (chip_configure_zap_file)
  /home/fireblade/test2/matter_weather_station/external/nrf/samples/matter/common/cmake/data_model.cmake:20 (chip_configure_data_model)
  CMakeLists.txt:48 (ncs_configure_data_model)


I think im missing something but not sure what,

I could manually alter  "src/app/zap_cluster_list.json" but that's in the external matter repo (external/modules/lib/matter/) so i'd rather avoid that if possible

could anyone point me to the correct sequence to do this or tell me the missing step(s)

thanks 






Parents Reply
  • hello

    ive tried with 

    west zap-generate --full


    and get 

    Files generated in: /home/fireblade/test2/matter_weather_station/application/src/default_zap/zap-generated
    Error: /home/fireblade/test2/matter_weather_station/external/modules/lib/matter/True does not exists or is not a file.
    FATAL ERROR: command exited with status 1: ./scripts/tools/zap/generate.py -z True -t src/app/common/templates/templates.json -o /home/fireblade/test2/matter_weather_station/application/src/default_zap/zap-generated/app-common/zap-generated



Children
  • Ok after renaming the ./src/default_zap/zcl-ammended.json to ./src/default_zap/zcl.json

    west zap-generate --full
    
    


    now works

    but im still getting

      ValueError: Unhandled server cluster: scene_sequence (hint: add to
      src/app/zap_cluster_list.json)

    on build


  • Hi,

    Can you share your XML file with the custom cluster and device type so I can test it on my end? If you do not want to share the file in a public ticket, let me know and I can make the ticket private.

    Best regards,
    Marte

  • hello

    here is cluster file

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <configurator>
    
      <struct name="SequenceSceneStruct" isFabricScoped="true">
        <cluster code="0xff1fc00"/>
        <item fieldId="0" name="SceneID" type="int8u" default="0"/>
        <item fieldId="1" name="TimeOffset" type="int32u" isFabricSensitive="true"/>
      </struct>
      <struct name="SequenceInfoStuct" isFabricScoped="true">
        <cluster code="0xff1fc00"/>
        <item fieldId="0" name="SequenceCount" type="int16u" default="0"/>
        <item fieldId="1" name="CurrentSequence" type="int16u" isFabricSensitive="true"/>
        <item fieldId="2" name="RemainingCapacity" type="int16u" isFabricSensitive="true"/>
      </struct>
    
    
    
      <domain name="CHIP"/>
      <cluster>
        <domain>General</domain>
        <name>Scene Sequence</name>
        <code>0xff1fc00</code>
        <define>scene_sequence</define>
        <attribute name="Sequence table size" side="server" code="0x1" define="SEQUENCE_TABLE_SIZE" type="int16u" default="16" apiMaturity="provisional">
          <description>Sequence table size</description>
          Sequence table size
        </attribute>
        <attribute name="FabricSequenceInfo" side="server" code="0x0000" define="FABRIC_SEQUENCE_INFO" type="SequenceInfoStuct" apiMaturity="provisional">
          <description>FabricSequenceInfo</description>
          FabricSequenceInfo
        </attribute>
        <command name="AddSequence" code="0xfff10000" source="client" response="AddSequenceResponse">
          <description/>
          <arg name="GroupID" type="group_id"/>
          <arg name="SequenceID" type="int16u"/>
          <arg name="SequenceName" type="char_string"/>
          <arg name="SceneSequence" type="SequenceSceneStruct" array="true" />
          <access op="invoke" role="manage"/>
        </command>
        <command name="RemoveSequence" code="0xfff10003" source="client" response="RemoveSequenceResponse">
          <description/>
          <arg name="GroupID" type="group_id"/>
          <arg name="SequenceID" type="int16u"/>
          <access op="invoke" role="manage"/>
        </command>
        <command name="PlaySequence" code="0xfff10002" source="client" response="PlaySequenceResponse">
          <description/>
          <arg name="GroupID" type="group_id"/>
          <arg name="SequenceID" type="int16u"/>
        </command>
        <command name="StopSequence" code="0xfff10004" source="client" response="StopSequenceResponse">
          <description/>
          <arg name="GroupID" type="group_id"/>
          <arg name="SequenceID" type="int16u"/>
        </command>
        <command name="ViewSequene" code="0xfff10005" source="client" response="ViewSequeneResponse">
          <description/>
          <arg name="GroupID" type="group_id"/>
          <arg name="SequenceID" type="int16u"/>
        </command>
        <command name="AddSequenceResponse" code="0xfff10000" source="server">
          <description/>
          <arg name="GroupID" type="group_id"/>
          <arg name="SequenceID" type="int16u"/>
          <arg name="Status" type="status"/>
        </command>
        <command name="RemoveSequenceResponse" code="0xfff10003" source="server">
          <description/>
          <arg name="GroupID" type="group_id"/>
          <arg name="SequenceID" type="int16u"/>
          <arg name="Status" type="status"/>
        </command>
        <command name="PlaySequenceResponse" code="0xfff10002" source="server">
          <description/>
          <arg name="GroupID" type="group_id"/>
          <arg name="SequenceID" type="int16u"/>
          <arg name="Status" type="status"/>
        </command>
        <command name="StopSequenceResponse" code="0xfff10004" source="server">
          <description/>
          <arg name="GroupID" type="group_id"/>
          <arg name="SequenceID" type="int16u"/>
          <arg name="Status" type="status"/>
        </command>
      </cluster>
      <deviceType>
        <name>signal-lights</name>
        <domain>Lighting</domain>
        <typeName>Signal Lights</typeName>
        <profileId>0x104</profileId>
        <deviceId>0xfff100f1</deviceId>
        <clusters lockOthers="false">
          <include cluster="Scene Sequence" server="true"/>
          <include cluster="Scenes Management" client="true"/>
        </clusters>
      </deviceType>
    </configurator>


    is basically facility to allow a device to switch between a set of scenes over a period of time without interaction with a controller

    I'm not yet that familiar with matter, so only a rough outline to test what is required.  

    is create using a combination of matter cluster editor 0.1 and a few manual edits, due to bugs/missing features in the editor



    I'm building on top of  matter weather station as have that correctly building with additional drivers for i2c GPIO expanders (mcp23017 and pca9538) and shells






  • Hi,

    I tested adding your custom cluster and device in the Matter Template sample. I got some errors that it expected StopSequenceResponse instead of ViewSequeneResponse for ViewSequeneResponse::DecodableType in src/default_zap/zap-generated/clusters/SceneSequence/Commands.h, but I do not get the error about unhandled server cluster that you get.

    To add the cluster and run the ZAP tool I used this command:

    west zap-gui -j ./src/default_zap/zcl.json --clusters ./scene_sequence.xml

    I added the Signal Lights device on endpoint 1 and saved the zap file, then I generated the C++ files with the following:

    west zap-generate --full

    Lastly, I added this to CMakeLists.txt:

    project(matter-template)
    
    # Override zap-generated directory.
    include(${ZEPHYR_NRF_MODULE_DIR}/samples/matter/common/cmake/zap_helpers.cmake)
    ncs_get_zap_parent_dir(ZAP_PARENT_DIR)
    
    get_filename_component(CHIP_APP_ZAP_DIR ${ZAP_PARENT_DIR}/zap-generated REALPATH CACHE)
    
    # Existing code in CMakeList.txt
    
    ncs_configure_data_model(
       EXTERNAL_CLUSTERS "scene_sequence" # Add EXTERNAL_CLUSTERS flag
    )
    
    # NORDIC SDK APP END

    I also noticed that the device shows up as "undefined" if I re-opened ZAP Tool. This was fixed by adding editable="false" to the deviceId in the XML file:

    <deviceId editable="false">0xfff100f1</deviceId>

    Best regards,
    Marte

  • some tweaks and fixes to the cluster xml file and 


    adding 

    ncs_configure_data_model(
       EXTERNAL_CLUSTERS "scene_sequence" # Add EXTERNAL_CLUSTERS flag
    )



    seems to fix that error and the "StopSequenceResponse instead of ViewSequeneResponse" error

    however this leads me to a different error

    CMake Error at /home/fireblade/race-start-signals/external/modules/lib/matter/src/app/chip_data_model.cmake:34 (include):
      include could not find requested file:
    
        /home/fireblade/race-start-signals/external/modules/lib/matter/src/app/clusters/timer-server/app_config_dependent_sources.cmake
    Call Stack (most recent call first):
      /home/fireblade/race-start-signals/external/modules/lib/matter/src/app/chip_data_model.cmake:62 (chip_configure_cluster)
      /home/fireblade/race-start-signals/external/modules/lib/matter/src/app/chip_data_model.cmake:106 (chip_configure_zap_file)
      /home/fireblade/race-start-signals/external/nrf/samples/matter/common/cmake/data_model.cmake:20 (chip_configure_data_model)
      CMakeLists.txt:40 (ncs_configure_data_model)


    after some examination it appears to originate fro the fact that the upstream repo is missing the timer cluster

    and if you get it into your .zap file its difficult to remove without recreating it, as just deselecting and saving in zap-gui doesn't seem to remove it

    e.g if you run

    west zap-gui -j ./src/default_zap/zcl.json --clusters ./scene_sequence.xml
    


    or just

    west zap-gui -j ./src/default_zap/zcl.json



    and check timer cluster in any endpoint save

    you get the error

    and if uncheck and save again

    you still get the error as the cluster definitions are not removed from then zap file


    as i think this is a matter sdk error i have created an issue
    do you want this mentioned anywhere else?


    I was intending to use a timer, but think i can workaround that







Related