ZCL Common

Zigbee Cluster Library (ZCL) common usage definition for ESP Zigbee SDK.

Header File

Functions

uint16_t esp_zb_zcl_get_attribute_size(uint8_t attr_type, uint8_t *attr_value)

Get the size of ZCL attribute value.

Parameters
  • attr_type[in] The data type of attribute value

  • attr_value[in] The value of attribute

Returns

  • 0x00 - 0xFFFE: The size of attribute value

  • 0xFFFF: Invalid size

uint8_t *esp_zb_zcl_put_attribute_value(uint8_t *data_ptr, uint8_t type, uint8_t *value, uint16_t value_size)

Put the ZCL attribute value to specific memory.

Parameters
  • data_ptr – A pointer of specific memory

  • type – The data type of attribute value

  • value – The value of attribute

  • value_size – The size of attribute value

Returns

A pointer indicates the end location in specific memory after a value has been stored

Structures

struct esp_zb_zcl_attr_location_info_s

The ZCL attribute location information struct.

Public Members

uint8_t endpoint_id

The endpoint identifier on which the cluster id is resident.

uint16_t cluster_id

The cluster identifier on which the attribute is resident, refer to esp_zb_zcl_cluster_id_t

uint8_t cluster_role

The role of cluster, refer to esp_zb_zcl_cluster_role_t

uint16_t manuf_code

The manufacturer code of attribute

uint16_t attr_id

The attribute identifier

Macros

ESP_ZGP_ENDPOINT

Green power special endpoint

ESP_ZB_ZCL_ATTR_NON_MANUFACTURER_SPECIFIC

Non manufacturer specific code for certain attribute

EZP_ZB_ZCL_CLUSTER_NON_MANUFACTURER_SPECIFIC

Non manufacturer specific code for certain cluster

Type Definitions

typedef struct esp_zb_zcl_attr_location_info_s esp_zb_zcl_attr_location_info_t

The ZCL attribute location information struct.

typedef signed int (*esp_zb_zcl_cluster_check_value_callback_t)(uint16_t attr_id, uint8_t endpoint, uint8_t *value)

ZCL Cluster Check Attribute Value Handler, which should be called before attribute change and checks if new value is in correct range and can be applied.

Param attr_id

[in] ZCL Attribute ID

Param endpoint

[in] Device endpoint

Param value

[in] Pointer to the new Attribute Value

Return

The result of check value whose value refer to esp_err_t

typedef void (*esp_zb_zcl_cluster_write_attr_callback_t)(uint8_t endpoint, uint16_t attr_id, uint8_t *new_value, uint16_t manuf_code)

ZCL Cluster Write Attribute Handler, which should be called before attribute change (if any cluster-specific action needs to be bound to attribute change, it can be placed in this handler).

Param endpoint

[in] Device endpoint

Param attr_id

[in] ZCL Attribute ID

Param new_value

[in] Pointer to the new Attribute Value

Param manuf_code

[in] Manufacturer specific code

Enumerations

enum esp_zb_af_profile_id_t

Application Framework Profile identifiers.

Values:

enumerator ESP_ZB_AF_HA_PROFILE_ID
enumerator ESP_ZB_AF_SE_PROFILE_ID

HA profile ID

enumerator ESP_ZB_AF_ZLL_PROFILE_ID

SE profile ID

enumerator ESP_ZB_AF_GP_PROFILE_ID

ZLL profile ID

enum esp_zb_ha_standard_devices_t

HA Device identifiers.

Values:

enumerator ESP_ZB_HA_ON_OFF_SWITCH_DEVICE_ID

General On/Off switch

enumerator ESP_ZB_HA_LEVEL_CONTROL_SWITCH_DEVICE_ID

Level Control Switch

enumerator ESP_ZB_HA_ON_OFF_OUTPUT_DEVICE_ID

General On/Off output

enumerator ESP_ZB_HA_LEVEL_CONTROLLABLE_OUTPUT_DEVICE_ID

Level Controllable Output

enumerator ESP_ZB_HA_SCENE_SELECTOR_DEVICE_ID

Scene Selector

enumerator ESP_ZB_HA_CONFIGURATION_TOOL_DEVICE_ID

Configuration Tool

enumerator ESP_ZB_HA_REMOTE_CONTROL_DEVICE_ID

Remote Control

enumerator ESP_ZB_HA_COMBINED_INTERFACE_DEVICE_ID

Combined Interface

enumerator ESP_ZB_HA_RANGE_EXTENDER_DEVICE_ID

Range Extender

enumerator ESP_ZB_HA_MAINS_POWER_OUTLET_DEVICE_ID

Mains Power Outlet

enumerator ESP_ZB_HA_DOOR_LOCK_DEVICE_ID

Door lock client

enumerator ESP_ZB_HA_DOOR_LOCK_CONTROLLER_DEVICE_ID

Door lock controller

enumerator ESP_ZB_HA_SIMPLE_SENSOR_DEVICE_ID

Simple Sensor device

enumerator ESP_ZB_HA_CONSUMPTION_AWARENESS_DEVICE_ID

Consumption Awareness Device

enumerator ESP_ZB_HA_HOME_GATEWAY_DEVICE_ID

Home Gateway

enumerator ESP_ZB_HA_SMART_PLUG_DEVICE_ID

Smart plug

enumerator ESP_ZB_HA_WHITE_GOODS_DEVICE_ID

White Goods

enumerator ESP_ZB_HA_METER_INTERFACE_DEVICE_ID

Meter Interface

enumerator ESP_ZB_HA_ON_OFF_LIGHT_DEVICE_ID

On/Off Light Device

enumerator ESP_ZB_HA_DIMMABLE_LIGHT_DEVICE_ID

Dimmable Light Device

enumerator ESP_ZB_HA_COLOR_DIMMABLE_LIGHT_DEVICE_ID

Color Dimmable Light Device

enumerator ESP_ZB_HA_DIMMER_SWITCH_DEVICE_ID

Dimmer Switch Device

enumerator ESP_ZB_HA_COLOR_DIMMER_SWITCH_DEVICE_ID

Color Dimmer Switch Device

enumerator ESP_ZB_HA_SHADE_DEVICE_ID

Shade

enumerator ESP_ZB_HA_SHADE_CONTROLLER_DEVICE_ID

Shade controller

enumerator ESP_ZB_HA_WINDOW_COVERING_DEVICE_ID

Window Covering client

enumerator ESP_ZB_HA_WINDOW_COVERING_CONTROLLER_DEVICE_ID

Window Covering controller

enumerator ESP_ZB_HA_HEATING_COOLING_UNIT_DEVICE_ID

Heating/Cooling Unit device

enumerator ESP_ZB_HA_THERMOSTAT_DEVICE_ID

Thermostat Device

enumerator ESP_ZB_HA_TEMPERATURE_SENSOR_DEVICE_ID

Temperature Sensor

enumerator ESP_ZB_HA_IAS_CONTROL_INDICATING_EQUIPMENT_ID

IAS Control and Indicating Equipment

enumerator ESP_ZB_HA_IAS_ANCILLARY_CONTROL_EQUIPMENT_ID

IAS Ancillary Control Equipment

enumerator ESP_ZB_HA_IAS_ZONE_ID

IAS Zone

enumerator ESP_ZB_HA_IAS_WARNING_DEVICE_ID

IAS Warning Device

enumerator ESP_ZB_HA_TEST_DEVICE_ID

Custom HA device for test

enumerator ESP_ZB_HA_CUSTOM_TUNNEL_DEVICE_ID

Custom Tunnel device (should declared in private profile)

enumerator ESP_ZB_HA_CUSTOM_ATTR_DEVICE_ID

Custom Attributes Device

enum esp_zb_zcl_cluster_role_t

ZCL cluster role enum.

Values:

enumerator ESP_ZB_ZCL_CLUSTER_SERVER_ROLE

Server cluster role

enumerator ESP_ZB_ZCL_CLUSTER_CLIENT_ROLE

Client cluster role

enum esp_zb_zcl_cluster_id_t

ZCL cluster identifiers.

Values:

enumerator ESP_ZB_ZCL_CLUSTER_ID_BASIC

Basic cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_POWER_CONFIG

Power configuration cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_DEVICE_TEMP_CONFIG

Device temperature configuration cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_IDENTIFY

Identify cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_GROUPS

Groups cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_SCENES

Scenes cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_ON_OFF

On/Off cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_ON_OFF_SWITCH_CONFIG

On/Off switch configuration cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_LEVEL_CONTROL

Level control cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_ALARMS

Alarms cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_TIME

Time cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_RSSI_LOCATION

RSSI location cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_ANALOG_INPUT

Analog input (basic) cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_ANALOG_OUTPUT

Analog output (basic) cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_ANALOG_VALUE

Analog value (basic) cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_BINARY_INPUT

Binary input (basic) cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_BINARY_OUTPUT

Binary output (basic) cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_BINARY_VALUE

Binary value (basic) cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_MULTI_INPUT

Multistate input (basic) cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_MULTI_OUTPUT

Multistate output (basic) cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_MULTI_VALUE

Multistate value (basic) cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_COMMISSIONING

Commissioning cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_OTA_UPGRADE

Over The Air cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_POLL_CONTROL

Poll control cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_GREEN_POWER

Green Power cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_KEEP_ALIVE

Keep Alive cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_SHADE_CONFIG

Shade configuration cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_DOOR_LOCK

Door lock cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_WINDOW_COVERING

Window covering cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_PUMP_CONFIG_CONTROL

Pump configuration and control cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_THERMOSTAT

Thermostat cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_FAN_CONTROL

Fan control cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_DEHUMID_CONTROL

Dehumidification control cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_THERMOSTAT_UI_CONFIG

Thermostat user interface configuration cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_COLOR_CONTROL

Color control cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_BALLAST_CONFIG

Ballast configuration cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_ILLUMINANCE_MEASUREMENT

Illuminance measurement

enumerator ESP_ZB_ZCL_CLUSTER_ID_TEMP_MEASUREMENT

Temperature measurement

enumerator ESP_ZB_ZCL_CLUSTER_ID_PRESSURE_MEASUREMENT

Pressure measurement

enumerator ESP_ZB_ZCL_CLUSTER_ID_FLOW_MEASUREMENT

Flow measurement

enumerator ESP_ZB_ZCL_CLUSTER_ID_REL_HUMIDITY_MEASUREMENT

Relative humidity measurement

enumerator ESP_ZB_ZCL_CLUSTER_ID_OCCUPANCY_SENSING

Occupancy sensing

enumerator ESP_ZB_ZCL_CLUSTER_ID_CARBON_DIOXIDE_MEASUREMENT

Carbon dioxide measurement

enumerator ESP_ZB_ZCL_CLUSTER_ID_PM2_5_MEASUREMENT

PM2.5 measurement

enumerator ESP_ZB_ZCL_CLUSTER_ID_IAS_ZONE

IAS zone

enumerator ESP_ZB_ZCL_CLUSTER_ID_IAS_ACE

IAS ACE

enumerator ESP_ZB_ZCL_CLUSTER_ID_PRICE

Price cluster identifier.

enumerator ESP_ZB_ZCL_CLUSTER_ID_METERING

Metering

enumerator ESP_ZB_ZCL_CLUSTER_ID_METER_IDENTIFICATION

Meter Identification cluster identifier

enumerator ESP_ZB_ZCL_CLUSTER_ID_ELECTRICAL_MEASUREMENT

Electrical measurement

enumerator ESP_ZB_ZCL_CLUSTER_ID_DIAGNOSTICS

Home Automation Diagnostics

enum esp_zb_zcl_status_t

ZCL status values.

Values:

enumerator ESP_ZB_ZCL_STATUS_SUCCESS

ZCL Success

enumerator ESP_ZB_ZCL_STATUS_FAIL

ZCL Fail

enumerator ESP_ZB_ZCL_STATUS_NOT_AUTHORIZED

Server is not authorized to upgrade the client

enumerator ESP_ZB_ZCL_STATUS_MALFORMED_CMD

Malformed command

enumerator ESP_ZB_ZCL_STATUS_UNSUP_CLUST_CMD

Unsupported cluster command

enumerator ESP_ZB_ZCL_STATUS_UNSUP_GEN_CMD

Unsupported general command

enumerator ESP_ZB_ZCL_STATUS_UNSUP_MANUF_CLUST_CMD

Unsupported manuf-specific clust command

enumerator ESP_ZB_ZCL_STATUS_UNSUP_MANUF_GEN_CMD

Unsupported manuf-specific general command

enumerator ESP_ZB_ZCL_STATUS_INVALID_FIELD

Invalid field

enumerator ESP_ZB_ZCL_STATUS_UNSUP_ATTRIB

Unsupported attribute

enumerator ESP_ZB_ZCL_STATUS_INVALID_VALUE

Invalid value

enumerator ESP_ZB_ZCL_STATUS_READ_ONLY

Read only

enumerator ESP_ZB_ZCL_STATUS_INSUFF_SPACE

Insufficient space

enumerator ESP_ZB_ZCL_STATUS_DUPE_EXISTS

Duplicate exists

enumerator ESP_ZB_ZCL_STATUS_NOT_FOUND

Not found

enumerator ESP_ZB_ZCL_STATUS_UNREPORTABLE_ATTRIB

Unreportable attribute

enumerator ESP_ZB_ZCL_STATUS_INVALID_TYPE

Invalid type

enumerator ESP_ZB_ZCL_STATUS_WRITE_ONLY

Write only

enumerator ESP_ZB_ZCL_STATUS_INCONSISTENT

Supplied values are inconsistent

enumerator ESP_ZB_ZCL_STATUS_ACTION_DENIED
enumerator ESP_ZB_ZCL_STATUS_TIMEOUT

Timeout

enumerator ESP_ZB_ZCL_STATUS_ABORT

Abort

enumerator ESP_ZB_ZCL_STATUS_INVALID_IMAGE

Invalid OTA upgrade image

enumerator ESP_ZB_ZCL_STATUS_WAIT_FOR_DATA

Server does not have data block available yet

enumerator ESP_ZB_ZCL_STATUS_NO_IMAGE_AVAILABLE
enumerator ESP_ZB_ZCL_STATUS_REQUIRE_MORE_IMAGE
enumerator ESP_ZB_ZCL_STATUS_NOTIFICATION_PENDING
enumerator ESP_ZB_ZCL_STATUS_HW_FAIL

Hardware failure

enumerator ESP_ZB_ZCL_STATUS_SW_FAIL

Software failure

enumerator ESP_ZB_ZCL_STATUS_CALIB_ERR

Calibration error

enumerator ESP_ZB_ZCL_STATUS_UNSUP_CLUST

Cluster is not found on the target endpoint

enumerator ESP_ZB_ZCL_STATUS_LIMIT_REACHED

Cluster is not found on the target endpoint

enum esp_zb_zcl_attr_type_t

ZCL attribute data type values.

Values:

enumerator ESP_ZB_ZCL_ATTR_TYPE_NULL

Null data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_8BIT

8-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_16BIT

16-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_24BIT

24-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_32BIT

32-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_40BIT

40-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_48BIT

48-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_56BIT

56-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_64BIT

64-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_BOOL

Boolean data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_8BITMAP

8-bit bitmap data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_16BITMAP

16-bit bitmap data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_24BITMAP

24-bit bitmap data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_32BITMAP

32-bit bitmap data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_40BITMAP

40-bit bitmap data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_48BITMAP

48-bit bitmap data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_56BITMAP

56-bit bitmap data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_64BITMAP

64-bit bitmap data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_U8

Unsigned 8-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_U16

Unsigned 16-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_U24

Unsigned 24-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_U32

Unsigned 32-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_U40

Unsigned 40-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_U48

Unsigned 48-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_U56

Unsigned 56-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_U64

Unsigned 64-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_S8

Signed 8-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_S16

Signed 16-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_S24

Signed 24-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_S32

Signed 32-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_S40

Signed 40-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_S48

Signed 48-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_S56

Signed 56-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_S64

Signed 64-bit value data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_8BIT_ENUM

8-bit enumeration (U8 discrete) data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_16BIT_ENUM

16-bit enumeration (U16 discrete) data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_SEMI

2 byte floating point

enumerator ESP_ZB_ZCL_ATTR_TYPE_SINGLE

4 byte floating point

enumerator ESP_ZB_ZCL_ATTR_TYPE_DOUBLE

8 byte floating point

enumerator ESP_ZB_ZCL_ATTR_TYPE_OCTET_STRING

Octet string data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_CHAR_STRING

Character string (array) data type

enumerator ESP_ZB_ZCL_ATTR_TYPE_LONG_OCTET_STRING

Long octet string

enumerator ESP_ZB_ZCL_ATTR_TYPE_LONG_CHAR_STRING

Long character string

enumerator ESP_ZB_ZCL_ATTR_TYPE_ARRAY

Array data with 8bit type, size = 2 + sum of content len

enumerator ESP_ZB_ZCL_ATTR_TYPE_16BIT_ARRAY

Array data with 16bit type, size = 2 + sum of content len

enumerator ESP_ZB_ZCL_ATTR_TYPE_32BIT_ARRAY

Array data with 32bit type, size = 2 + sum of content len

enumerator ESP_ZB_ZCL_ATTR_TYPE_STRUCTURE

Structure data type 2 + sum of content len

enumerator ESP_ZB_ZCL_ATTR_TYPE_SET

Collection:set, size = sum of len of content

enumerator ESP_ZB_ZCL_ATTR_TYPE_BAG

Collection:bag, size = sum of len of content

enumerator ESP_ZB_ZCL_ATTR_TYPE_TIME_OF_DAY

Time of day, 4 bytes

enumerator ESP_ZB_ZCL_ATTR_TYPE_DATE

Date, 4 bytes

enumerator ESP_ZB_ZCL_ATTR_TYPE_UTC_TIME

UTC Time, 4 bytes

enumerator ESP_ZB_ZCL_ATTR_TYPE_CLUSTER_ID

Cluster ID, 2 bytes

enumerator ESP_ZB_ZCL_ATTR_TYPE_ATTRIBUTE_ID

Attribute ID, 2 bytes

enumerator ESP_ZB_ZCL_ATTR_TYPE_BACNET_OID

BACnet OID, 4 bytes

enumerator ESP_ZB_ZCL_ATTR_TYPE_IEEE_ADDR

IEEE address (U64) type

enumerator ESP_ZB_ZCL_ATTR_TYPE_128_BIT_KEY

128-bit security key

enumerator ESP_ZB_ZCL_ATTR_TYPE_INVALID

Invalid data type

enum esp_zb_zcl_attr_access_t

ZCL attribute access values.

Values:

enumerator ESP_ZB_ZCL_ATTR_ACCESS_READ_ONLY

Attribute is read only

enumerator ESP_ZB_ZCL_ATTR_ACCESS_WRITE_ONLY

Attribute is write only

enumerator ESP_ZB_ZCL_ATTR_ACCESS_READ_WRITE

Attribute is read/write

enumerator ESP_ZB_ZCL_ATTR_ACCESS_REPORTING

Attribute is allowed for reporting

enumerator ESP_ZB_ZCL_ATTR_ACCESS_SINGLETON

Attribute is singleton

enumerator ESP_ZB_ZCL_ATTR_ACCESS_SCENE

Attribute is accessed through scene

enumerator ESP_ZB_ZCL_ATTR_MANUF_SPEC

Attribute is manufacturer specific

enumerator ESP_ZB_ZCL_ATTR_ACCESS_INTERNAL

Internal access only Attribute