zap icon indicating copy to clipboard operation
zap copied to clipboard

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

Open fessehaeve opened this issue 1 year ago • 4 comments

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 ]

fessehaeve avatar Oct 30 '23 12:10 fessehaeve

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

brdandu avatar Oct 30 '23 12:10 brdandu

@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.

tecimovic avatar Oct 30 '23 13:10 tecimovic

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.

bzbarsky-apple avatar Oct 31 '23 18:10 bzbarsky-apple

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

brdandu avatar Nov 15 '23 19:11 brdandu