2024-01-25 07:53 AM
Hi evryone,
I've been trying to work on Zigbee communication for a while now, so far I've just learned how to read and write attributes. Now I'd like to try to learn how to use cluster Identify and groups, but I dont understand several thing, so I need help. For these cluster I'm working in Server.
Identify Cluster (only IdentifyTime attribute)
so i create my cluster, i allocate it as usual, i use the ZbZclIdentifyServerSetTime function and then i write in my attribute the value of the remaining time. what i don't understand is the part where in my code i'm going to receive the command that says "it's ok i can start the timer". i've seen that there's a start and stop structure that can be used via a callback, but i don't understand how to use it.
Groups Cluster
I don't really understand how to use this one.
I suppose that my device will receive an order to say "I've been added to such and such a group", in which case, as above, how can I manage the reception of this order? How does this cluster server really work?
if someone could explain it to me, that would be great!
thanks
have a nice day
Solved! Go to Solution.
2024-02-06 05:18 AM
Hello,
I'm not sure to understand exactly your question about ZbApsmeAddGroupReq which was used in my example to set a group addressing mode using APS layer, but this is not the purpose of the application provided to demonstrate mainly the use of the groups cluster according to your previous request.
Identification mode is needed only when client use the command ZbZclGroupsClientAddIdentifyingReq, and this was not the case in my example.
Please find a new example implementing Identify cluster as follow :
/* Idenfity server */
zigbee_app_info.identify_server = ZbZclIdentifyServerAlloc(zigbee_app_info.zb, SW1_ENDPOINT, NULL);
assert(zigbee_app_info.identify_server != NULL);
ZbZclClusterEndpointRegister(zigbee_app_info.identify_server);
ZbZclIdentifyServerSetCallback(zigbee_app_info.identify_server, ZbZclIdentifyCallback);
Regards,
Ouadi
2024-01-26 07:35 AM
Hi @CH3
The forum moderator had marked your post as needing a little more investigation and direct support. An online support case has been created on your behalf, please stand by for just a moment and you will hear from us.
Regards,
Billy
2024-01-30 02:42 AM
Hello @CH3 ,
Thanks for your post and welcome to the community.
Please find below my answers:
Identify cluster is used during network commissioning process to allow the identification of each node in the network, this feature is mandatory for Find and Bind process giving the possibility for the device to enter in identify mode.
Identify mode can be done during an interval of time configured using ZbZclIdentifyServerSetTime function as you mentioned, the timer starts automatically once this function is called and the callback ZbZclIdentifyServerSetCallback is raised with ZCL_IDENTIFY_START param.
When the timer expires, the same callback is called to inform that the timer stopped => ZCL_IDENTIFY_STOP
To configure the callback function, you need to call ZbZclIdentifyServerSetCallback function after initialization of the cluster in (APP_ZIGBEE_ConfigEndpoints()).
To get the local identify server time => ZbZclIdentifyServerGetTime function returns the current time.
You can refer to the project example ..\Applications\Zigbee\Zigbee_Find_Bind_Coord that implements this cluster.
A groups cluster is a feature of APS stack layer providing a mechanism to manage a group of an end point by enabling the transmission of a command to multiple devices through group addressing.
To add an entry in a group table => ZbApsmeAddGroupReq
To remove an entry in a group table => ZbApsmeRemoveGroupReq
To enable the group addressing mode => ZB_APSDE_ADDRMODE_GROUP
To better understand the use of this cluster, you can refer to the project example ..\Applications\Zigbee\Zigbee_OnOff_Client_Router which implements a toggle command sent over a groups cluster.
I hope this will be helpful for you.
Best regards,
Ouadi
2024-01-30 05:03 AM
Hi Ouadi,
thank you for your reply, it's a great help !
for Groups cluster, what will be the difference between your method (that of ..\Applications\Zigbee\Zigbee_OnOff_Client_Router ) and the functions taken from the zcl.group.h file? for example, between ZbApsmeAddGroupReq and ZbZclGroupsClientAddReq?
thank you
2024-01-30 05:35 AM
APIs listed on my answer uses APS stack layer and could be used independently of ZCL library.
APIs located in file zcl.group.h uses ZCL library and allows to create a group cluster either as a Server or Client with the existing attributes and commands ( add, view, remove..)
BR,
Ouadi
2024-01-30 06:37 AM
okay, in my case I need to work with the ZCL library as a server, ZbZclGroupsClientAddReq command will be more useful. How does this work? My application will tell my device to add itself to the group, this order will be "stored" in the attribute corresponding to the order and so when it is received I send my ZbZclGroupsClientAddReq command?
2024-01-30 08:44 AM
Actually, if your device is configured as a server using ZbZclGroupsServerAlloc it can only receive commands from the client to modify the local group table.
In case of your device is configured as a client (ZbZclGroupsClientAlloc), it is able to send commands to the server requesting add, view, get group membership or remove to the group table.
ZbZclGroupsClientAddReq function is to be used from the client side in order to be added ( endpoint) to the group.
ZbZclGroupsClientAddIdentifyingReq function is to be used from the client side in order to request the addition of the endpoint to the group, when the target device is in identification mode.
Best regards,
Ouadi
2024-01-30 08:51 AM
For more details using ZbZclGroupsClientAddReq command, you can call this function anytime after the establishment of the network between the server and the client.
On the server side, a group ID is created based on data sent by your device ( client), then it will generate an add group response command which will be received on the callback defined in your function argument (Client side).
BR,
Ouadi
2024-01-31 01:41 AM
yes, we're in server mode, and it's the local table that we want to modify. the order we receive, do we get it via the attribute? for example, the addgroup attribute is set to 0 when no add order is received, then the attribute becomes non-null, so we've received our add order? i deduce that once we've received the order, all we need to do is create a group structure and fill it in. do you have any examples where you use the groups cluster in this way?
Thanks
2024-02-01 04:51 AM
Hello @CH3,
Indeed, for the groups cluster, the server has only 1 attributes called NameSupport as mentioned in "zcl.groups.h"
As discussed previously, the server's role is to receive commands from the client and to manage the group table internally ( this is done by the stack), so no need to create or modify the group table manually.
I made an example to understand the use of this cluster with a focus on ZbZclGroupsClientAddReq function:
The client send a Group Add Request to the server by pressing SW1
On receipt of this command, the server add the group ID and the group name ( if supported) to its group table, then generate the appropriate Add group response indicating success of failure.
The response is generated on client side AddGroupCallback
The response is displayed over the UART with the status, the source adresse, and the payload ( Group ID).
Please find in attachment files for both client/server.
BR,
Ouadi