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

[BUG] Control state objects in LevelControl cluster for dynamic endpoints are never initialized #24645

Open
raven-worx opened this issue Jan 25, 2023 · 8 comments
Assignees
Labels
app-clusters Application cluster work dynamic-bridge Issues in the dynamic-bridge example

Comments

@raven-worx
Copy link

raven-worx commented Jan 25, 2023

Reproduction steps

I am implementing a dynamic-bridge Matter device. Some of the dynamic endpoints have a LevelControl cluster added.

The problem now is that the LevelControl cluster doesn't work when the value is about to be changed via a command.
After debugging the LevelControl cluster implementation i found that the retrieved state pointer (eg. inside moveToLevelHandler() method) is not initialized properly.

This is only the case for dynamically added endpoints. The dummy endpoint's (the endpoint to include all clusters in ZAP tool) state object gets initialized in emberAfLevelControlClusterServerInitCallback(). Especially the maxLevel/minLevel members remain 0 and thus the command never executes correctly.

The attributes are set properly, see my endpoint dump attached.

Bug prevalence

always

GitHub hash of the SDK that was being used

43dd327

Platform

other

Platform Version(s)

1.0.0.2

Anything else?

repl_dump.txt

@bzbarsky-apple bzbarsky-apple added the app-clusters Application cluster work label Jan 25, 2023
@bzbarsky-apple
Copy link
Contributor

@jmartinez-silabs

@jmartinez-silabs jmartinez-silabs self-assigned this Jan 26, 2023
@jmartinez-silabs
Copy link
Member

jmartinez-silabs commented Jan 31, 2023

@raven-worx Reading the issue my first thought was that the stateTable size didn't handle the possible dynamic endpoint count. But I just went through the code and it does. It should be able to initialize the dynamically added endpoint through the emberAfLevelControlClusterServerInitCallback call.

I don't have a sample app with dynamic endpoint creation to this out.
can you let me know what is the value of CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT in your app, what endpoint value is dynamically created?

Did you debug the calls of emberAfLevelControlClusterServerInitCallback What are the values of the endpoint parameters for each time emberAfLevelControlClusterServerInitCallback is called? One should match your dynamically created endpoint.

@raven-worx
Copy link
Author

@jmartinez-silabs
my CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT is set to 200 at the moment.

Yes i also debugged emberAfLevelControlClusterServerInitCallback and it is only called on startup for the fixed endpoints - which in my case is only the bridge dummy endpoint i disable later on.

It should get called when i call emberAfSetDynamicEndpoint to add my dynamic endpoint, i guess.

For now as a workaround i added the few lines of emberAfLevelControlClusterServerInitCallback to initialize the bounds attributes to the moveToLevelHandler and works for me so far.

@bzbarsky-apple
Copy link
Contributor

It should get called when i call emberAfSetDynamicEndpoint to add my dynamic endpoint, i guess.

Do you say that in your endpoint config for the dynamic endpoint? I am guessing not, because DECLARE_DYNAMIC_CLUSTER does not list the init method (just uses NULL for the cluster functions)....

@bzbarsky-apple
Copy link
Contributor

Ideally, we would auto-infer the init method somehow....

@raven-worx
Copy link
Author

I am guessing not, because DECLARE_DYNAMIC_CLUSTER does not list the init method (just uses NULL for the cluster functions)....

i am using the dynamic-bridge-app as a base

@bzbarsky-apple
Copy link
Contributor

Then that's possibly a bug in dynamic-bridge-app, depending on how it's setting up its clusters.

@stale
Copy link

stale bot commented Aug 7, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale Stale issue or PR label Aug 7, 2023
@bzbarsky-apple bzbarsky-apple removed the stale Stale issue or PR label Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app-clusters Application cluster work dynamic-bridge Issues in the dynamic-bridge example
Projects
Status: Todo
Development

No branches or pull requests

3 participants