Temperature Sensor Integration: Compilation Error and Attribute Reporting Issue

Hi everyone, I’m working on integrating two temperature sensors into my Z-Wave project, and I’ve encountered a compilation error that I’m struggling to resolve. I’d love to hear your insights or solutions!

Project Setup
I’m using two endpoints with Temperature Measurement clusters. Here’s how I’ve structured the code:

// Endpoint 1
ZB_ZCL_DECLARE_TEMP_MEASUREMENT_ATTRIB_LIST(temp_measurement_attr_list_1, &dev_ctx.temp_1_measure_attrs.measure_value, &dev_ctx.temp_1_measure_attrs.min_measure_value, &dev_ctx.temp_1_measure_attrs.max_measure_value, &dev_ctx.temp_1_measure_attrs.tolerance);
ZB_HA_DECLARE_TEMPERATURE_SENSOR_CLUSTER_LIST(temperature_sensor_clusters_1, basic_attr_list, identify_attr_list, temp_measurement_attr_list_1);
#define TEMPERATURE_SENSOR_ENDPOINT_1 11
ZB_HA_DECLARE_TEMPERATURE_SENSOR_EP(temperature_sensor_ep_one, TEMPERATURE_SENSOR_ENDPOINT_1, temperature_sensor_clusters_1);

// Endpoint 2
ZB_ZCL_DECLARE_TEMP_MEASUREMENT_ATTRIB_LIST(temp_measurement_attr_list_2, &dev_ctx.temp_2_measure_attrs.measure_value, &dev_ctx.temp_2_measure_attrs.min_measure_value, &dev_ctx.temp_2_measure_attrs.max_measure_value, &dev_ctx.temp_2_measure_attrs.tolerance);
ZB_HA_DECLARE_TEMPERATURE_SENSOR_CLUSTER_LIST(temperature_sensor_clusters_2, basic_attr_list, identify_attr_list, temp_measurement_attr_list_2);
#define TEMPERATURE_SENSOR_ENDPOINT_2 12
ZB_HA_DECLARE_TEMPERATURE_SENSOR_EP(temperature_sensor_ep_two, TEMPERATURE_SENSOR_ENDPOINT_2, temperature_sensor_clusters_2);

ZBOSS_DECLARE_DEVICE_CTX_2_EP(device_ctx, temperature_sensor_ep_one, temperature_sensor_ep_two);

Compilation Error
When I try to compile, I get this error:

G:/ncs/v2.8.0/nrfxlib/zboss/production/include/zboss_api_af.h:257:32: error: redefinition of ‘struct zb_af_simple_desc_3_1_s’

After some research, I found a temporary fix by using the following hack:

#undef ZB_DECLARE_SIMPLE_DESC
#define ZB_DECLARE_SIMPLE_DESC(…)

This allowed the code to compile, but it introduced a new issue.

Attribute Reporting Issue
When I added the sensor to Home Assistant, both temperature readings appeared correctly. However, when I adjusted the ADC input (simulating a temperature change), only the first sensor’s value updated. Both sensors are connected to the same voltage source, so both should reflect the change. If I read the cluster directly, the correct value is returned, indicating the issue might be with the attribute reporting setup.

Questions

  1. Has anyone encountered a similar compilation error when declaring multiple endpoints with Temperature Measurement clusters?
  2. Could the temporary fix I applied interfere with attribute reporting?
  3. Are there best practices for declaring multiple temperature sensors to avoid such issues?

I’m really stuck here and would appreciate any guidance or suggestions. Let’s collaborate to find a proper solution!

Best regards,
[Your Name]