project-chip / zap

ZAP stands for ZCL Advanced Platform. It is used to configure clusters, attributes and other entities for Matter and ZigbeePro applications.
Apache License 2.0
139 stars 83 forks source link

min/max not supported for attribute size larger than 2 bytes #1187

Open fessehaeve opened 12 months ago

fessehaeve commented 12 months ago

I have this attribute

    <attribute side="server" code="0x0000" define="OPEN_DURATION" type="elapsed_s" isNullable="true" min="1"  writable="true" optional="false">
      <description>OpenDuration</description>
      <access op="read" privilege="view"/>
      <access op="write" privilege="manage"/>
    </attribute>

and autogen fails with the following error:

🤖 Generating files:
    ✍  /Users/f/Sources/connectedhomeip/out/debug/gen/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/zap_pregen/zap-generated/CHIPClusters.h
    ✍  /Users/f/Sources/connectedhomeip/out/debug/gen/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/zap_pregen/zap-generated/IMClusterCommandHandler.cpp
    ✍  /Users/f/Sources/connectedhomeip/out/debug/gen/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/zap_pregen/zap-generated/gen_config.h
    ✍  /Users/f/Sources/connectedhomeip/out/debug/gen/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/zap_pregen/zap-generated/access.h
⚠️  Errors:
    👎  /Users/f/Sources/connectedhomeip/out/debug/gen/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/zap_pregen/zap-generated/endpoint_config.h: 
⛔ Error: Can't have min/max for attributes larger than 2 bytes like 'OpenDuration' [line: 25, column: 35, file: /Users/f/Sources/connectedhomeip/examples/all-clusters-app/linux/third_party/connectedhomeip/src/app/zap-templates/templates/app/endpoint_config.zapt ]
brdandu commented 12 months ago

@tecimovic any ideas on why this constraint was added in helper-endpointconfig.js?

tecimovic commented 12 months ago

@tecimovic any ideas on why this constraint was added in helper-endpointconfig.js?

This is a ZIgbeePro constraint due to how the union for that is constructed. We should parametrize this, so that Matter doesn't follow this constraint.

bzbarsky-apple commented 12 months ago

Note that for Matter we would also need to change the codegen to output something that actually works with > 16 bits. Right now it does not.

brdandu commented 11 months ago

This is coming up frequently and we need to resolve this. See https://csamembers.slack.com/archives/C01B01GH64E/p1700063239142299