ZigBee Color Control Cluster ZCL Device Callback

Hi There!

I'm using the dimmable light bulb example and have extended it with the color control attribute list. I'm using the zb_zcl_color_control_attrs_ext_t in combination with ZB_ZCL_DECLARE_COLOR_CONTROL_ATTRIB_LIST to be able to use the current x and y values.

ZB_ZCL_DECLARE_COLOR_CONTROL_ATTRIB_LIST(
	color_control_attr_list,                                                                                     
	&dev_ctx.color_control_attr.set_color_info.current_X,                                      
	&dev_ctx.color_control_attr.set_color_info.current_Y);
	
ZB_DECLARE_DIMMABLE_LIGHT_CLUSTER_LIST(
	dimmable_light_clusters,
	basic_attr_list,
	identify_client_attr_list,
	identify_server_attr_list,
	groups_attr_list,
	scenes_attr_list,
	on_off_attr_list,
	level_control_attr_list,
	color_control_attr_list);

I assumed I would be able to interface the color control cluster the same way as the level control cluster. That, however, doesn't seem the case. There is no device callback ID for the color control cluster, like there is for the level control cluster (ZB_ZCL_LEVEL_CONTROL_SET_VALUE_CB_ID) and checking for set attribute value callbacks (like underneath) also doesn't work; no such event occurs.

case ZB_ZCL_SET_ATTR_VALUE_CB_ID: {
	zb_uint8_t cluster_id = p_device_cb_param->cb_param.
			set_attr_value_param.cluster_id;
	zb_uint8_t attr_id = p_device_cb_param->cb_param.
		set_attr_value_param.attr_id;

	if (cluster_id == ZB_ZCL_CLUSTER_ID_ON_OFF) {
		uint8_t value =
			p_device_cb_param->cb_param.set_attr_value_param
			.values.data8;

		LOG_INF("on/off attribute setting to %hd", value);
		if (attr_id == ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID) {
			light_bulb_set_brightness(value ? 100 : 0);
		}
	} else if (cluster_id == ZB_ZCL_CLUSTER_ID_COLOR_CONTROL){
		const zb_uint16_t value = p_device_cb_param->cb_param.set_attr_value_param.values.data16;
		if(attr_id == ZB_ZCL_ATTR_COLOR_CONTROL_CURRENT_X_ID){
			LOG_INF("Received new X %hd", value);
		} else if (attr_id == ZB_ZCL_ATTR_COLOR_CONTROL_CURRENT_Y_ID){
			LOG_INF("Received new Y %hd", value);
		} else {
			LOG_WRN("Unused color attribute! %hd.", value);
		}
	}
	break;
}

I assume this is something that's currently not supported? I also think it's weird that the level control is handled over here at line 447, but also at line 471... Per my experience, only line 447 is triggered (I can remove the code at line 471). Such an callback ID not being present for the color control, appears to be the cause of my problem. I expect a ZB_ZCL_COLOR_CONTROL_SET_VALUE_CB_ID, but there is no such macro.

What also could be a pointer in the right direction, is that there's a ZBOSS_DEVICE_DECLARE_LEVEL_CONTROL_CTX in the ZB_DECLARE_DIMMABLE_LIGHT_EP macro, but there's no such thing as ZBOSS_DEVICE_DECLARE_COLOR_CONTROL_CTX.. 

Kind regards,

Jochem

Parents
  • Hello,

    Sorry for the late reply.

    What SDK version are you basing this on?

    I tested the light bulb + light switch examples in NCS v2.0.0, and I see that both 

    I have not looked into this in NCS yet, but a colleague of mine pointed out that you can have a look at the nRF5 SDK implementation of the color light bulb, and try to port that to NCS.
    In the nRF5 SDK for Thread and Zigbee, there is an example:
    SDK\examples\multiprotocol\experimental\ble_zigbee_dynamic_color_light_bulb_thingy.
    In the latest nRF5 SDK version, 4.2, it uses the same ZBOSS version as we are using in NCS 2.0.0
    For the color cluster, ZB_ZCL_SET_ATTR_VALUE_CB_ID should be used with cluster_id and attr_id to determine the attributre. You can see how this is implemented in the above example. 
    Best regards,
    Edvin
Reply
  • Hello,

    Sorry for the late reply.

    What SDK version are you basing this on?

    I tested the light bulb + light switch examples in NCS v2.0.0, and I see that both 

    I have not looked into this in NCS yet, but a colleague of mine pointed out that you can have a look at the nRF5 SDK implementation of the color light bulb, and try to port that to NCS.
    In the nRF5 SDK for Thread and Zigbee, there is an example:
    SDK\examples\multiprotocol\experimental\ble_zigbee_dynamic_color_light_bulb_thingy.
    In the latest nRF5 SDK version, 4.2, it uses the same ZBOSS version as we are using in NCS 2.0.0
    For the color cluster, ZB_ZCL_SET_ATTR_VALUE_CB_ID should be used with cluster_id and attr_id to determine the attributre. You can see how this is implemented in the above example. 
    Best regards,
    Edvin
Children
  • Hi Edvin,

    Apologies for my late reply too. 

    I managed to look into this today, but the referenced example in the SDK for Thread and Zigbee handles things exactly the same as I do. Even with the macros for defining the COLOR_DIMMABLE_LIGHT_EP. Same behaviour.

    I firmly believe it has something to do with my previous suspicions.

    I assume this is something that's currently not supported? I also think it's weird that the level control is handled over here at line 447, but also at line 471... Per my experience, only line 447 is triggered (I can remove the code at line 471). Such an callback ID not being present for the color control, appears to be the cause of my problem. I expect a ZB_ZCL_COLOR_CONTROL_SET_VALUE_CB_ID, but there is no such macro.
    
    What also could be a pointer in the right direction, is that there's a ZBOSS_DEVICE_DECLARE_LEVEL_CONTROL_CTX in the ZB_DECLARE_DIMMABLE_LIGHT_EP macro, but there's no such thing as ZBOSS_DEVICE_DECLARE_COLOR_CONTROL_CTX.. 

    Kind regards,

    Jochem

  • Not everything is implemented in our SDK for Thread and Zigbee. You need to look at the specification to find the values for the clusters that are not implemented, and implement that yourself, unfortunately. 

    Best regards,

    Edvin

Related