zap icon indicating copy to clipboard operation
zap copied to clipboard

Using ZAP tool for Matter

Open tpitman opened this issue 1 year ago • 6 comments

I am trying to follow a tutorial for the Nordic Matter SDK here.

It talks about installing and using the ZAP tool.

When I get to the step to generate the C++ code here:

python ./scripts/tools/zap/generate.py ../../../nrf/samples/matter/sensor/src/template.zap -t src/app/zap-templates/app-templates.json -o ../../../nrf/samples/matter/sensor/src/zap-generated

I replace the ../../../nrf/ etc with the path to my project.

I get an error:

Error: /private/var/folders/bb/flvr__sd3cx3c4glfq8nvh_w0000gn/T/AppTranslocation/34302B3E-0F11-4D33-B136-9A0DD3C3A76F/d/zap.app/Contents/Resources/app-arm64.asar/zcl-builtin/silabs/zcl.json

I have spent a while trying to figure out what is going on by looking at the generate.py script and what I found is several things.

One of the things I looked at is the changes in GIT that occur to my .zap file after saving it with this tool. The first thing I notice is that is changes this:

(minus signs signify removed lines and plus signs mean added...normal git)

"package": [ { "pathRelativity": "relativeToZap", - "path": "../../../../../modules/lib/matter/src/app/zap-templates/zcl/zcl.json", + "path": "../../../../../../../../private/var/folders/bb/flvr__sd3cx3c4glfq8nvh_w0000gn/T/AppTranslocation/34302B3E-0F11-4D33-B136-9A0DD3C3A76F/d/zap.app/Contents/Resources/app-arm64.asar/zcl-builtin/silabs/zcl.json", "type": "zcl-properties", - "category": "matter", + "category": "zigbee", "version": 1,

So the path to the zcl.json file is changed from where nordic stores it to inside the zap.app package. The category was also changed from matter to zigbee.

and secondly this:

(minus signs signify removed lines and plus signs mean added...normal git)

- "description": "Matter SDK ZCL data" - }, - { - "pathRelativity": "relativeToZap", - "path": "../../../../../modules/lib/matter/src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", - "version": "chip-v1" + "description": "ZigbeePro test data"

so the description is changed from Matter SDK ZCL data to ZigbeePro test data

Once I saw that I noticed the title of the Cluster Configurator is ZigbeePro test data.

I also found inside the settings that path to the zcl.json file.

The downloaded binary seems to be configured for Zigbee and not Matter (though I know Matter runs on top of Zigbee, so maybe it doesn't matter).

If I use the GENERATE button at the top of the tool I browse to my zap-generate folder in my src project and then see a progress bar go quickly by, but nothing gets generated.

So my question is how can I use this zap tool to edit and then generate MATTER files for my Nordic based SDK project?

tpitman avatar Aug 30 '23 03:08 tpitman

why is this your path to your zcl.json file zcl-builtin/silabs/zcl.json? is that where it is in the SDK???

paulr34 avatar Sep 06 '23 00:09 paulr34

note: ZAP_DEVELOPMENT_PATH is for running ZAP with source and ZAP_INSTALL_PATH is for running it with a binary. At least, that is what the code does. I know this because zap-start.js is not something you can access with the binary.

Please use ZAP_INSTALL_PATH when you're using the zap binary.

paulr34 avatar Sep 06 '23 00:09 paulr34

why is this your path to your zcl.json file zcl-builtin/silabs/zcl.json? is that where it is in the SDK???

I have not idea. That is just what I saw when I went to the settings using the gear icon. I was hoping someone here could tell me.

I started the app by using the zap.app that came in the binary package for MacOS.

tpitman avatar Sep 06 '23 00:09 tpitman

download the Matter repo and run their scripts

paulr34 avatar Sep 06 '23 00:09 paulr34

Can you point me to exactly which scripts to run?

tpitman avatar Sep 06 '23 02:09 tpitman

zap_regen.py?

paulr34 avatar Jun 14 '24 13:06 paulr34