Hi,
I am trying to develop a small Zigbee device that has two endpoints, each with a Temperature Measurement Cluster. My starting point was https://docs.nordicsemi.com/bundle/ncs-2.8.0/page/nrf/protocols/zigbee/adding_clusters.html. I worked through problems with duplicate Endpoint Simple Descriptions and figured out how to write data to the attributes.
I have successfully deployed the code to a nRF52840DK and connected the DK to HomeAssistant. I see the initial values for both endpoints. Every 30 seconds, *one* of the measurements gets updated. The fact the other doesn't get updated is an issue for another post!
For the project, I want to push the temperature readings every 5 seconds.
To accomplish this, I am trying to use Attribute Reporting. Using a few sample projects I have found online and answers in this forum, I have ended up with this, but it doesn't work
I have added a method called configured_attribute_reporting()
void configure_attribute_reporting()
{
zb_zcl_reporting_info_t temp_rep_info;
ZB_BZERO(&temp_rep_info, sizeof(temp_rep_info));
temp_rep_info.direction = ZB_ZCL_CONFIGURE_REPORTING_SEND_REPORT;
temp_rep_info.ep = TEMPERATURE_SENSOR_ENDPOINT_1;
temp_rep_info.cluster_id = ZB_ZCL_CLUSTER_ID_TEMP_MEASUREMENT;
temp_rep_info.cluster_role = ZB_ZCL_CLUSTER_SERVER_ROLE;
temp_rep_info.attr_id = ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_ID;
temp_rep_info.u.send_info.min_interval = 1;
temp_rep_info.u.send_info.max_interval = 0;
temp_rep_info.u.send_info.delta.s16 = 0x000A;
temp_rep_info.dst.profile_id = ZB_AF_HA_PROFILE_ID ;
zb_ret_t zb_err_code = zb_zcl_put_reporting_info(&temp_rep_info, ZB_FALSE);
}
This method is called once when the application begins and the device is connected.
void zboss_signal_handler(zb_bufid_t bufid)
{
zigbee_led_status_update(bufid, ZIGBEE_NETWORK_STATE_LED);
ZB_ERROR_CHECK(zigbee_default_signal_handler(bufid));
if (bufid)
{
zb_buf_free(bufid);
}
static bool lastJoin = false;
bool thisJoin = ZB_JOINED();
if ((lastJoin == false) && (thisJoin == true))
{
LOG_INF("Joined network!");
configure_attribute_reporting();
zb_ret_t status = zb_zcl_start_attr_reporting(TEMPERATURE_SENSOR_ENDPOINT_1, ZB_ZCL_CLUSTER_ID_TEMP_MEASUREMENT, ZB_ZCL_CLUSTER_SERVER_ROLE, ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_ID);
if (status == ZB_ZCL_STATUS_SUCCESS)
{
LOG_INF("Started attr reporting!");
}
}
lastJoin = thisJoin;
}
Unfortunately, the call to zb_zcl_put_reporting_info results in a RET_NOT_FOUND error.
The log looks like this:
*** Booting nRF Connect SDK v2.8.0-a2386bfc8401 ***
*** Using Zephyr OS v3.7.99-0bc3393fb112 ***
I: Starting Zigbee FART Sensor
I: ZigbeeI: Production configuration is not present or invalid (status: -1)
I: Zigbee stack initialized
application template started
T: 1I: Unimplemented signal (signal: 54, status: 0)
I: Joined network!
I: Reporting info configuration failed: -28!!!
E: ERROR 28 [RET_NOT_FOUND] at CMAKE_SOURCE_DIR/src/main.c:469
E: ZBOSS fatal error occurred
I cannot find a clean example of how to use Attribute Reporting.
Am I taking the correct approach?