endpoints, these are collections of
clusters. A cluster is essentially a capability of a Zigbee device.
BoundClusterto receive and handle the incoming commands in your app. For more information on implementing a
BoundClustercheck out the API section.
productIdand endpoint definitions, the driver's manifest can be created. This is where is defined that this driver is for a Zigbee device, for which Zigbee device specifically (hence the
productId), and what the endpoints and clusters of this Zigbee device are (hence the endpoint definitions).
zigbeeobject to the driver's manifest.
zigbeeobject contains the following properties:
manufacturerName: This is the manufacturer id which is needed to identify the device.
productId: This is the product id which is needed to identify the device. It is possible to add multiple product ids if the driver targets a couple of very similar devices with different product ids.
endpoints: This is the endpoint definition for the device. Only the endpoints and clusters listed here will be available on the
ZCLNodeinstance (see the documentation on
zigbee-clustersin below in the API section). The keys of the
endpointsobject refer to the endpoint id of the node.
clusters: This lists the cluster ids we want to implement as client. This means, the clusters we want to send commands to, or read attributes from, on the remote node.
bindings: This lists the cluster ids we want to implement as server. This means, the clusters we want to be able to receive commands on from a remote node. For each entry in
bindingsa bind request will be made to the remote node during pairing. In case you want to implement attribute reporting for a specific cluster, add the cluster id here and the required binding will be made during pairing.
/drivers/my_driver/device.js. Please refer to the Drivers guide for more information on this topic.
homey-zigbeedriver, which is a library we've created which does a lot of the heavy lifting for Zigbee apps. Take a look at the API section for the specifics of this library. Below, a number of basic implementations of various aspects of a Zigbee driver is demonstrated based on
It is not recommended to keep this debug logging enabled when publishing your app.
zclNodeis an instance of
ZCLNodeas exported by
zigbee-clusters(check the API section for more information on this library). It can be used to directly communicate with the node using the Zigbee Cluster Library (ZCL).
homey-zigbeedriverit is very easy to map Homey's capabilities to Zigbee clusters. The library contains a set of system capabilities, which are basically very common mappings between capabilities and clusters. It is possible to extend these system capabilities when registering them, for more information take a look at the
homey-zigbeedriverdocumentation and API section.
bindingsproperty. After that, the attribute reporting must be configured on the node's cluster. The example below demonstrates two ways of configuring attribute reporting:
BoundCluster(this is exported by
Deviceyou need to define a
devicesproperty in your Zigbee driver's manifest. The keys of this object represent a unique sub device ID which will be added to the device data object as
subDeviceId. For example, based on the manifest below:
device.jsto discern between the root device, and the various sub devices.
capabiltiesproperties that are omitted in the sub device will be copied over from the root device. If the sub device should not get the same settings as the root device, make sure to add the
settings: property to the sub device, as demonstrated below.
Devicewill have access to the same
ZCLNodeinstance and can access all endpoints. By default, for each sub device a device instance, as exported in
device.js, will be created. If the implementation of
device.jsis quite different between sub devices you can use
Driver#onMapDeviceClass()to properly separate the logic for the root and sub devices by implementing multiple
ZigBeeDevice. This class handles getting a
zigbee-clustersto extend the ZigBeeNode with Zigbee Cluster Library (ZCL) functionality. Doing this enables a developer to directly communicate with the ZigBeeNode using ZCL very easily. The basic usage is demonstrated below, for more in-depth information take a look at the
homey-zigbeedriverdocumentation or the source code on GitHub.
lib/clusters. It is very easy to add new clusters, or add attributes or commands to an existing cluster, merely by changing the definition in one of the cluster files (e.g. the onOff cluster). If you are interested in how this library works, take a look at the Zigbee Cluster Specification (PDF). The basic usage of this library is demonstrated below, note that it is usually better to use
ZigBeeDeviceexported by homey-zigbeedriver instead.
homey-zigbeedriverabout which cluster we are targeting we need to import the cluster specification from
zigbee-clustersas demonstrated below.
bindingsarray in the driver's manifest. Please refer to Implementing a bound cluster for more information on how to create a
BoundClusterin your driver.
ZigBeeNodeif needed. In general it is advised not to use this API and take a look at zigbee-clusters and homey-zigbeedriver which are libraries built on top of the Zigbee API which do most of the heavy lifting and make it even easier to develop Zigbee apps for Homey.