nRF5 SDK for Thread and Zigbee v1.0.0
Level controllable output

Level Control device has 6 clusters (see spec 7.4.4):

Sample use Level Control device

Example
Declaration clusters
/******************* Declare attributes ************************/
/* Basic cluster attributes data */
zb_uint8_t g_attr_zcl_version = ZB_ZCL_VERSION;
ZB_ZCL_DECLARE_BASIC_ATTRIB_LIST(basic_attr_list, &g_attr_zcl_version, &g_attr_power_source);
/* Identify cluster attributes data */
zb_uint16_t g_attr_identify_time = 0;
ZB_ZCL_DECLARE_IDENTIFY_ATTRIB_LIST(identify_attr_list, &g_attr_identify_time);
/* Groups cluster attributes data */
zb_uint8_t g_attr_name_support = 0;
ZB_ZCL_DECLARE_GROUPS_ATTRIB_LIST(groups_attr_list, &g_attr_name_support);
/* Scenes cluster attribute data */
zb_uint8_t g_attr_scenes_scene_count;
zb_uint8_t g_attr_scenes_current_scene;
zb_uint16_t g_attr_scenes_current_group;
zb_uint8_t g_attr_scenes_scene_valid;
zb_uint8_t g_attr_scenes_name_support;
ZB_ZCL_DECLARE_SCENES_ATTRIB_LIST(scenes_attr_list, &g_attr_scenes_scene_count,
&g_attr_scenes_current_scene, &g_attr_scenes_current_group,
&g_attr_scenes_scene_valid, &g_attr_scenes_name_support);
/* On/Off cluster attributes data */
zb_uint8_t g_attr_on_off = ZB_FALSE;
ZB_ZCL_DECLARE_ON_OFF_ATTRIB_LIST(on_off_attr_list, &g_attr_on_off);
/* Level Control cluster attribute variables */
zb_uint8_t g_current_level = ZB_ZCL_LEVEL_CONTROL_CURRENT_LEVEL_DEFAULT_VALUE;
zb_uint16_t g_remaining_time = ZB_ZCL_LEVEL_CONTROL_REMAINING_TIME_DEFFAULT_VALUE_ZLL;
ZB_ZCL_DECLARE_LEVEL_CONTROL_ATTRIB_LIST(level_control_attr_list, &g_current_level, &g_remaining_time);
/********************* Declare device **************************/
ZB_HA_DECLARE_LEVEL_CONTROLLABLE_OUTPUT_CLUSTER_LIST(level_controllable_output_clusters,
basic_attr_list,
identify_attr_list,
scenes_attr_list,
groups_attr_list,
on_off_attr_list,
level_control_attr_list);
ZB_HA_DECLARE_LEVEL_CONTROLLABLE_OUTPUT_EP(level_controllable_output_ep,
HA_LEVEL_CONTROLLABLE_OUTPUT_ENDPOINT,
level_controllable_output_clusters);
ZB_HA_DECLARE_LEVEL_CONTROLLABLE_OUTPUT_CTX(level_controllable_output_ctx,
level_controllable_output_ep);
Register device list
ZB_AF_REGISTER_DEVICE_CTX(&level_controllable_output_ctx);
ZB_AF_SET_ENDPOINT_HANDLER(HA_LEVEL_CONTROLLABLE_OUTPUT_ENDPOINT,
zcl_specific_cluster_cmd_handler);
Sample handler
{
TRACE_MSG(TRACE_ZCL3, "Got cluster command 0x%04x", (FMT__D, cmd_info->cmd_id));
/* Process cluster command */
cmd_processed = ZB_TRUE;
}
else
{
TRACE_MSG(TRACE_ZCL2, "Cluster command %hd, skip it", (FMT__H, cmd_info->cmd_id));
}

See ha/devices_generic sample


Documentation feedback | Developer Zone | Subscribe | Updated