
The main purpose of ZigBee networks is communication between devices in automated systems. ZigBee networking applications are the most diverse. Types and purpose of the connected devices are also very diverse. Communication can be established between the switch and the luminaire in the “smart home”, metering devices and the server of the network service company, a motion sensor and a security console. Perhaps, looking through this topic, you, without knowing it, are using the ZigBee network - many wireless mice with a 2.4 GHz USB adapter comply with the ZigBee RF4CE specification.
In this topic we will discuss the mechanisms regulated by the ZigBee specification that ensure the compatibility and interaction of automation devices (applications) through the ZigBee network.
I wrote about the construction and operation of ZigBee networks in previous topics (you can also look here ).')
Very briefly about the "iron"
ZigBee compatible automation devices are usually delivered to the "network builders" in finished form. In the form of "smart" sockets and lamps, various sensors, actuators, measuring devices, IP (Wi-Fi, USB, etc.) gateways, control panels, controllers and so on. However, lovers can work with a soldering iron can easily find ZigBee chips, and even special kits to connect them to their own devices, thereby making these ZigBee devices compatible.
Of these products, equipped with ZigBee devices, and build any automated system with wireless data transmission over the ZigBee network. How it is built, depends on the tasks. To build a ZigBee network between the mouse and the system unit, simply insert the adapter into the USB port and feed the mouse with a battery. To build an automation system for an intelligent building will require the efforts of the design organization.
ZigBee Cluster Library (ZCL)
When the hardware is designed, the moment of programming comes. And here the built-in mechanisms laid down in the ZigBee specification are a good help.
One of the main goals of the ZigBee specification was to ensure the compatibility of devices from different manufacturers. And this compatibility is provided at the application level by using the ZigBee Cluster Library (ZCL) cluster library.
A cluster is similar to a class in object-oriented programming and includes:
• description of the standard device (lamp, dimmer, counter);
• description of the standard attributes of this device (on / off, brightness control, meter reading);
• description of standard device commands (enable / disable, set brightness level, read readings).
Each cluster consists of two network-related elements — a client and a server. The connection between the cluster elements is established by the binding, which will be discussed below.

The ZigBee server stores attribute values, and the ZigBee client remotely reads or writes the value of this attribute. For example, the standard devices "light bulb" and "switch" can function as a standard cluster "on / off". In this case, the “light bulb” will be the server part of the cluster that stores the value of the “on / off” attribute. A “switch” (client) will remotely set the attribute value.
A ZigBee device can simultaneously support several client parts of some clusters and server parts of others. For example, the "switch" may also contain the server part of the cluster "configuration", with which it will receive information about the modes of operation from the configuration device.
ZigBee Cluster LibraryThe ZCL library contains a rich set of standard clusters that is constantly growing. For ease of use, clusters in the library are grouped by functional basis:
• general purpose
• work with sensors,
• lighting control,
• ventilation control,
• security management
• etc.
In accordance with the ZigBee PRO Feature Set specification, message transfer in ZigBee networks is carried out only using standard clusters.
Applications
The application is, in fact, exactly what the ZigBee specification was created for. Applications implement communication channels between devices of automation systems and provide guaranteed and safe package delivery. Each application is defined by its profile.
An application profile is a collection of network settings (ZigBee devices) that allows them to work together. The profile specification defines how to set identification parameters, network formation modes, data protection methods, list of used clusters, endpoints, bindings, etc. A profile can include clusters from different functional groups of the library.
To uniquely identify applications, each application is assigned a profile identifier.
The endpoint determines which application object from the ZigBee device is implemented by this application.
For example, in the remote control you can select the end point 10 to control the lighting in the hallway, the end point 25 to control the multimedia, and the end point 50 to control the heating. As a result, the remote control will be able to establish independent communication with the corresponding devices and to distinguish the packets intended for each application and each device.
Each ZigBee device has 240 application objects, which allows you to create up to 240 endpoints - from the first to the 240th. A null object is a ZigBee device object (ZD0) that provides control of the device itself.
BindingBinding programs the connection between the endpoints - contains the addresses of the devices and the endpoints of the client and server of a specific cluster. Each binding supports the corresponding profile of the application, and each message type is defined by a cluster in this profile.
Bindings are created both between individual endpoints and between their groups that have the same cluster ID, for example, between luminaires and switches.
Binding can be direct ("source binding"). At the same time, device addresses and endpoint identifiers of all applications with which interaction is programmed are stored in the source device.
With indirect linking, this information can be stored in a dedicated device that supports a lookup table that relates all endpoints of sources and recipients.