2024-06-03 02:24 AM
Hey,
im developing a zigbee sleepy end device. The device is supposed to periodically send sensor values (max length of 512bytes) read via I2C to the coordinator using the custom cluster. I use the HW_TS to trigger the sensor readings and sending the message. After a few messages (~8-20) the sleepy end device messages start to not arrive in time or at all and out of order, ending with the end device hanging up and being removed from the network by the coordinator.
What I have tried:
Solved! Go to Solution.
2024-06-03 06:55 AM - edited 2024-06-03 06:58 AM
Hi @user5,
From the logs attached, it seems that the device is removed from the network by the parent as it is no more active ( no keepalive messages),
From my understanding, the sensor values read from I2C are sent manually to the coordinator over ZigBee, in this case, the application should manage zb requests timing properly and make sure to wait for a response callback to avoid any unexpected behavior on the stack side.
Please note that the best approach for such application is to configure the attribute as a reportable with a defined period or only on change, this allows to manage timing and the sleep mode as well accurately.
Best regards,
Ouadi
2024-06-03 06:55 AM - edited 2024-06-03 06:58 AM
Hi @user5,
From the logs attached, it seems that the device is removed from the network by the parent as it is no more active ( no keepalive messages),
From my understanding, the sensor values read from I2C are sent manually to the coordinator over ZigBee, in this case, the application should manage zb requests timing properly and make sure to wait for a response callback to avoid any unexpected behavior on the stack side.
Please note that the best approach for such application is to configure the attribute as a reportable with a defined period or only on change, this allows to manage timing and the sleep mode as well accurately.
Best regards,
Ouadi
2024-06-03 07:20 AM
Is there examples or guidance on how to setup attribute reporting on custom clusters?
2024-06-03 07:54 AM
You can take a look on these 2 posts :
Post1 : Zigbee example/help on how to configure and send values
Post2 : STM32WB55 Zigbee - Can't report value
2024-06-10 04:47 AM
On the server side it gives me error ZCL_STATUS_UNREPORTABLE_ATTRIBUTE for:
ZbZclAttrStringWriteLong(zigbee_app_info.custom_ls_client, ZCL_CUSTOM_LS_ATTR, teststr);
On the client side I get ZCL_STATUS_TIMEOUT for:
APP_ZIGBEE_ReportConfig() if i set report.dst.nwkAddr = 0xFFFF;
If report.dst.nwkAddr = 0x0000; its successful. Why?
Can I get more documentation on how to configure a custom cluster with attribute reporting?
2024-06-10 06:28 AM - edited 2024-06-10 06:28 AM
If the attribute is not configured as a reportable, you will get the status ZCL_STATUS_UNREPORTABLE_ATTRIBUTE as you mentioned.
You will find more details on the attribute reporting following this Wiki page link: Attribute Reporting
The implementation is the same for a custom cluster or a standard cluster.
Regards,
Ouadi
2024-06-10 09:02 AM
I tried to add a custom attribute:
static const struct ZbZclAttrT ZclTemp_AttrList[] = {
{
MY_ZCL_DEV_LS, ZCL_DATATYPE_STRING_LONG_CHARACTER,
ZCL_ATTR_FLAG_REPORTABLE | ZCL_ATTR_FLAG_WRITABLE,
0, // custom size
NULL, // callback
{0, 0}, //no value range
{5, 10}
}
};
but when adding it via
ZbZclAttrAppendList(zigbee_app_info.custom_ls_client,ZclTemp_AttrList, ZCL_ATTR_LIST_LEN(ZclTemp_AttrList));
i get ZCL_STATUS_INVALID_DATA_TYPE.
What can I do to make the custom string attribute reportable or add a new reportable string attribute?
2024-06-10 11:04 AM
The parameter custom size is missing in your definition of ZclTemp_AttrList that should not be null as follow :
/**
* The structure used to initialize a ZCL attribute when calling ZbZclAttrAppendList.
*/
struct ZbZclAttrT {
uint16_t attributeId; /**< The attribute ID */
enum ZclDataTypeT dataType;
/**< The attribute data type (ZCL_DATATYPE_UNKNOWN if last entry) */
ZclAttrFlagT flags; /**< Attribute flags (e.g. writeable, reportable, etc) */
unsigned int customValSz;
/**< A custom size is required if the data type is one of:
* ZCL_DATATYPE_STRING_OCTET,
* ZCL_DATATYPE_STRING_CHARACTER,
* ZCL_DATATYPE_STRING_LONG_OCTET,
* ZCL_DATATYPE_STRING_LONG_CHARACTER,
* ZCL_DATATYPE_ARRAY,
* ZCL_DATATYPE_STRUCT,
* ZCL_DATATYPE_SET,
* ZCL_DATATYPE_BAG
*
* A custom size is also required if both customRead and customWrite callbacks
* are provided and ZCL_ATTR_FLAG_PERSISTABLE is set.
*
* The maximum size is the length returned by ZbZclClusterGetMaxAsduLength() or
* the cluster's maxAsduLength parameter. It should not exceed
* ZB_APS_CONST_MAX_FRAG_SIZE. */
Best regards,
Ouadi
2024-06-11 06:30 AM
Hi, thanks for the patience.
I was able to setup a new reportable custom ls attribute and write to it successfully.
Now I am trying to orientate on the Zigbee_TempMeas_Client_Router/Zigbee_TempMeas_Server_Coord examples with the difference, that Client is Coordinator and Server are the sleepy end devices.
I didnt change the examples naming for testing:
I made my coordinator execute APP_ZIGBEE_ReportConfig with report.dst.nwkAddr = 0x0000;, which is successful and execute APP_ZIGBEE_Read_Temp_Attribute with readReq.dst.nwkAddr = 0xFFFF;. Unfortunately, APP_ZIGBEE_Temp_Meas_Read_cb returns "[TEMP MEAS] Error, No attribute read", expect for the first time, the end device connects to the coordinator. What setting might I be messing here?
2024-06-14 01:14 AM
Any help possible?