Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZAP bombs out with unhelpful message if derived xml clusters (e.g. xyz-mode-cluster.xml is not in mode-base-cluster.xml) #1247

Open
jamesharrow opened this issue Jan 18, 2024 · 1 comment

Comments

@jamesharrow
Copy link

Follow the process to add new XML cluster definitions, but due to lack of documentation there was no clear instruction to add the into mode-base-cluster.xml

Running ./scripts/tools/zap_regen_all.py bombs out after 5 mins with this error:

Having more debug to explain what cluster is affected and what type is effected would give the developer a clue where the issue was. Instead I had to reverse engineer zap tool.

🤖 Generating files:
✍ /__w/connectedhomeip/connectedhomeip/src/controller/python/chip/clusters/Objects.py
⚠️ Errors:
👎 /__w/connectedhomeip/connectedhomeip/src/controller/python/chip/clusters/CHIPClusters.py: ⛔ TypeError: Cannot read properties of undefined (reading 'discriminatorName')
Stack trace:

TypeError: Cannot read properties of undefined (reading 'discriminatorName')
at Object.as_underlying_python_zcl_type (/snapshot/zap/dist/src-electron/generator/matter/controller/python/templates/helper.js:76:23)
at async Promise.all (index 0)
at async Promise.all (index 0)
at async Promise.all (index 1)
at async Promise.all (index 70)
at async Promise.all (index 0)
at produceContent (/snapshot/zap/dist/src-electron/generator/template-engine.js:150:19)
at generateSingleTemplate (/snapshot/zap/dist/src-electron/generator/generation-engine.js:522:27)
at async Promise.all (index 1)
at generateAllTemplates (/snapshot/zap/dist/src-electron/generator/generation-engine.js:499:5)
🕐 Generation time: 6s 905ms
{"src/controller/python/chip/clusters/CHIPClusters.py":{}}
Zap generation error: Error: Generation failed: -- blank session --
Error: Generation failed: -- blank session --
at generateSingleFile (/snapshot/zap/dist/src-electron/main-process/startup.js:490:15)
at startGeneration (/snapshot/zap/dist/src-electron/main-process/startup.js:543:5)

Propose adding something like:

   if (!dataType)
   {
     throw new Error(`dataType is undefined for clusterId: ${clusterId} ${type} ${packageIds}`);
   }

into

if (type && type.toLowerCase() == 'boolean') {

Example of the state my draft PR was in when it failed is here:
https://github.com/project-chip/connectedhomeip/actions/runs/7568704069/job/20610437501?pr=31506#step:7:1602

To resolve my issue I had to add the EVSE and DEM mode cluster IDs into the mode-base-cluster.xml:

  <struct name="ModeOptionStruct">
    <cluster code="0x0051"/> <!-- Laundry Washer Mode -->
    <cluster code="0x0052"/> <!-- Refrigerator and temperature controlled cabinet Mode -->
    <cluster code="0x0054"/> <!-- RVC Run Mode -->
    <cluster code="0x0055"/> <!-- RVC Clean Mode -->
    <cluster code="0x0059"/> <!-- Dishwasher Mode -->
    <cluster code="0x005E"/> <!-- Microwave Oven Mode -->
    <cluster code="0x0049"/> <!-- Oven Mode -->
    <cluster code="0x009D"/> <!-- Energy EVSE Mode -->
    <cluster code="0x009F"/> <!-- Device Energy Management Mode -->
    <item name="Label"    type="char_string"                length="64" optional="false"/>
    <item name="Mode"     type="int8u"                                  optional="false"/>
    <item name="ModeTags" type="ModeTagStruct" array="true" length="8"  optional="false"/>
  </struct>
@paulr34
Copy link
Collaborator

paulr34 commented Jan 29, 2024

We will try and add more helpful messages, thanks for the feedback

@paulr34 paulr34 self-assigned this Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants