espressif / esp-matter

Espressif's SDK for Matter
Apache License 2.0
644 stars 150 forks source link

Level Control Cluster with Bridge-app (CON-734) #606

Open ghost opened 1 year ago

ghost commented 1 year ago

In the bridge-app It is given for the on /off light where I need to integrate the Dimmer instead on on/off light. Does bridge-app example support Dimmers. The changes made for Dimmer: dimmer_changes.txt with these changes I observed that:

  1. the attribute is mismatched(current level)
  2. Once it read the callback doesn't go to write callback.

Kindly share the resources if available.

wqx6 commented 1 year ago

Looks like you are using the bridge-app from upstream connectedhomeip repo. For level control cluster, we must call MatterLevelControlPluginServerInitCallback before enabling the dynamic endpoint to make the cluster work.

If you use APIs from esp-matter-bridge this PluginServerInit Callback will be call in plugin_init_callback_endpoin and the dimmable-light can be create with create_device.

ghost commented 1 year ago

@wqx6 I'm using bridge-app examples from here, where we don't have any matter related file includes in it. When I try to add the header files it throws the error as No such file or directory

include

any reference docs for the matter bridge?

wqx6 commented 1 year ago

I'm using bridge-app examples from here.

In that example, you should call MatterLevelControlPluginServerInitCallback() after you call Esp32AppServer::Init() to use the LevelControl Cluster in Dynamic endpoint. You should call emberAfLevelControlClusterServerInitCallback() after you enable the dynamic endpoint with emberAfEndpointEnableDisable().

any reference docs for the matter bridge?

9.12. Bridge for non-Matter devices in SPEC might help you

ghost commented 1 year ago

Could you share the location of the file where the MatterLevelControlPluginServerInitCallback() function exist.

wqx6 commented 1 year ago

Sorry for the wrong reply. I have changed the function in the last comment. emberAfLevelControlClusterServerInitCallback() is in connectedhomeip/src/app/clusters/level-control.cpp

wqx6 commented 1 year ago

The DECLARE_DYNAMIC_CLUSTER doesn't include the init function so the cluster initialization function is not called for the dynamic endpoint, that's why the level control cluster doesn't work on dynamic endpoint.

ghost commented 1 year ago

@wqx6 initialized the function, but doesn't seems like the level control cluster works. still the write callback is not called and the level cluster is not handled. if (emAfMatchAttribute(cluster, am, attRecord))// this condition is getting failed.

initializtion of the function: endpoint_index=AddDeviceEndpoint(&gLight[array_index],&bridgedDimmableLightEndpoint, Span(gBridgedDimDeviceTypes),Span(gDimmableLight1DataVersions), 1); emberAfLevelControlClusterServerInitCallback(endpoint_index);

wqx6 commented 1 year ago

The input of emberAfLevelControlClusterServerInitCallback is endpoint ID, not endpoint index.

ghost commented 1 year ago

named the variable as endpoint_index, but passing the endpoint only. Is there anything that need to be updated in the ZAP config for the clusters and attributes.

ghost commented 12 months ago

@wqx6 The logs are as this when the level functions are not being called. I tried calling the function emberAfLevelControlClusterServerInitCallback(), but no use. How do I get the level cluster related callbacks. level_bridge.txt

ghost commented 11 months ago

I'm using esp-idf: v4.4.3 Matter: release/v1.0 When ever I change the level in the dimmer through alexa the level cluster is not being called. Tried the above configurations as suggested but still getting the same issue.

wqx6 commented 4 months ago

bridge-level-control.txt Could you apply this patch to your example? I tested and the external write callback was called when I sent the movetolevel command to the endpoint.