Zigbee ZCL scene helper

The Zigbee ZCL scene helper library provides a set of functions that implement the callbacks required by the ZCL scene cluster in the application. You can use this library to implement these mandatory callbacks and save the configured scenes in the non-volatile memory. For this purpose, it uses Zephyr’s Settings subsystem.

This library is capable of recalling attribute values for the following ZCL clusters:

  • On/off

  • Level control

  • Window covering

If you are implementing clusters that are not included in this list, you must implement their logic manually instead of using this library.

Configuration

To enable the Zigbee ZCL scene helper library, set the CONFIG_ZIGBEE_SCENES Kconfig option.

Because the library uses Zephyr’s Settings subsystem, the application must call the following functions for the library to work correctly:

  • zcl_scenes_init()

  • zcl_scenes_cb()

  • settings_subsys_init()

  • settings_load()

You must implement these functions in the following manner:

  • settings_subsys_init() must be called before zcl_scenes_init()

  • settings_load() must be called after zcl_scenes_init()

  • zcl_scenes_cb() must be called in the ZCL device callback:

    static void zcl_device_cb(zb_bufid_t bufid)
    {
       zb_zcl_device_callback_param_t  *device_cb_param =
          ZB_BUF_GET_PARAM(bufid, zb_zcl_device_callback_param_t);
       switch (device_cb_param->device_cb_id) {
       ...
       default:
          if (zcl_scenes_cb(bufid) == ZB_FALSE) {
                device_cb_param->status = RET_ERROR;
          }
          break;
       }
    }
    

Setting the CONFIG_ZIGBEE_SCENES Kconfig option allows you to configure the following library-specific Kconfig options:

  • CONFIG_ZIGBEE_SCENES_ENDPOINT - This option sets the endpoint number on which the device implements the ZCL scene cluster.

  • CONFIG_ZIGBEE_SCENE_TABLE_SIZE - This option sets the value for the number of scenes that can be configured.

To configure the logging level of the library, use the CONFIG_ZIGBEE_SCENES_LOG_LEVEL Kconfig option.

API documentation

Header file: include/zigbee/zigbee_zcl_scenes.h
Source file: subsys/zigbee/lib/zigbee_scenes/zigbee_zcl_scenes.c

Warning

doxygengroup: Cannot find file: C:\work\Zigbee\ncs-zigbee\ncs-zigbee\docs\_build_doxygen\xml\index.xml