This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Color temperature attribute is zero.

Hello,

I slightly modified examples\multiprotocol\experimental\ble_zigbee_dynamic_color_light_bulb_thingy so that it can receive changes in the color temperature attribute.

switch (attr_id)
{
  ...
  case ZB_ZCL_ATTR_COLOR_CONTROL_COLOR_TEMPERATURE_ID:
     color_control_set_color_temperature(value);
     break;
  ...
}

In Zigbee packet sniffer I see that command "Move  to Color Temperature" is sent

But I receive zero in 

p_device_cb_param->cb_param.set_attr_value_param.values.data16

Although p_device_cb_param->cb_param.set_attr_value_param.values.data32 contains some value but it's not what I would expect at all.

There is nothing is the payload which might remotely resemble the color temperature I sent - 288 Mired or 0x0120.

I would very much appreciate it if you can point to any mistake.

Best regards,

Sergey

Parents
  • [UPDATE]

    I added an endpoint handler

    ZB_AF_SET_ENDPOINT_HANDLER(HA_COLOR_LIGHT_ENDPOINT_ID, z_handler);

    zb_uint8_t z_handler(zb_uint8_t bufid)
    {
      zb_zcl_parsed_hdr_t * p_cmd_info         = ZB_BUF_GET_PARAM(bufid, zb_zcl_parsed_hdr_t);
    
      if (p_cmd_info->addr_data.common_data.dst_endpoint == HA_COLOR_LIGHT_ENDPOINT_ID &&
          p_cmd_info->cluster_id == ZB_ZCL_CLUSTER_ID_COLOR_CONTROL &&
          p_cmd_info->cmd_id == ZB_ZCL_CMD_COLOR_CONTROL_MOVE_TO_COLOR_TEMPERATURE) {
        zb_zcl_color_control_move_to_color_temperature_req_t payload;
        zb_zcl_parse_status_t res;
    
        ZB_ZCL_COLOR_CONTROL_GET_MOVE_TO_COLOR_TEMPERATURE_REQ(bufid, payload, res);
    
        zb_uint16_t value = payload.color_temperature;
        ZB_ZCL_SET_ATTRIBUTE(HA_COLOR_LIGHT_ENDPOINT_ID, 
                             ZB_ZCL_CLUSTER_ID_COLOR_CONTROL,    
                             ZB_ZCL_CLUSTER_SERVER_ROLE,  
                             ZB_ZCL_ATTR_COLOR_CONTROL_COLOR_TEMPERATURE_ID,
                             (zb_uint8_t *)&value,                        
                             ZB_FALSE);
    
        return ZB_TRUE;
      }
    
      return ZB_FALSE;
    }

    And can confirm that the value received is correct.

     

    Is there any bug in the code calling the device callback? Could you please clarify?

Reply
  • [UPDATE]

    I added an endpoint handler

    ZB_AF_SET_ENDPOINT_HANDLER(HA_COLOR_LIGHT_ENDPOINT_ID, z_handler);

    zb_uint8_t z_handler(zb_uint8_t bufid)
    {
      zb_zcl_parsed_hdr_t * p_cmd_info         = ZB_BUF_GET_PARAM(bufid, zb_zcl_parsed_hdr_t);
    
      if (p_cmd_info->addr_data.common_data.dst_endpoint == HA_COLOR_LIGHT_ENDPOINT_ID &&
          p_cmd_info->cluster_id == ZB_ZCL_CLUSTER_ID_COLOR_CONTROL &&
          p_cmd_info->cmd_id == ZB_ZCL_CMD_COLOR_CONTROL_MOVE_TO_COLOR_TEMPERATURE) {
        zb_zcl_color_control_move_to_color_temperature_req_t payload;
        zb_zcl_parse_status_t res;
    
        ZB_ZCL_COLOR_CONTROL_GET_MOVE_TO_COLOR_TEMPERATURE_REQ(bufid, payload, res);
    
        zb_uint16_t value = payload.color_temperature;
        ZB_ZCL_SET_ATTRIBUTE(HA_COLOR_LIGHT_ENDPOINT_ID, 
                             ZB_ZCL_CLUSTER_ID_COLOR_CONTROL,    
                             ZB_ZCL_CLUSTER_SERVER_ROLE,  
                             ZB_ZCL_ATTR_COLOR_CONTROL_COLOR_TEMPERATURE_ID,
                             (zb_uint8_t *)&value,                        
                             ZB_FALSE);
    
        return ZB_TRUE;
      }
    
      return ZB_FALSE;
    }

    And can confirm that the value received is correct.

     

    Is there any bug in the code calling the device callback? Could you please clarify?

Children
No Data
Related