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

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

Closed
jamesharrow opened this issue Jan 18, 2024 · 2 comments

Comments

@jamesharrow
Copy link
Contributor

jamesharrow commented Jan 18, 2024

Reproduction steps / Feature

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 https://github.com/project-chip/zap/blob/9c4b5244168a512112d98c5807285a7dbc8b5f3d/src-electron/generator/matter/controller/python/templates/helper.js#L82

Platform

core (please add to version below)

Platform Version(s)

1.3

Type

Manually tested with SDK

(Optional) If manually tested please explain why this is only manually tested

No response

Anything else?

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>
@bzbarsky-apple
Copy link
Contributor

@jamesharrow
Copy link
Contributor Author

Raised issue on ZAP instead here: project-chip/zap#1247

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants