First ZigBee Driver

I just bought a couple new ZigBee contact sensors and when they are discovered they show as generic devices. I can change the driver type to the Generic ZigBee contact sensor and the open/close seem to work fine, but the temp doesn't appear to be working and no Tamper alert. I am no stranger to coding so I figured this is as good time as any to start learning to create custom ZigBee drivers. I have read the Hubitat and Smartthings documentation and I have downloaded the ZigBee Cluster Library document.

So based on what the sensor offers I am using these capabilities:

    capability "Configuration"
    capability "Sensor"
    capability "ContactSensor"
    capability "Battery"
    capability "TemperatureMeasurement"
    capability "TamperAlert"
    capability "Refresh"

The fingerprint was easy enough to get. Now I know I need to use the 0x0500 cluster which is the IAS Zone so I bind that cluster

"zdo bind ${device.deviceNetworkId} 0x01 0x01 0x0015 {${device.zigbeeId}} {}", "delay 333"

But when I try to trigger and Open/Close action I see this in the log

enroll request endpoint 0x01 : data 0x0015

I know that that cluster is the contact switch, but what am I missing? I have tried binding to that cluster with no luck. Any help with this would be greatly appreciated and if anyone has some helpful tips for along my journey.

1 Like

Hi @goug76 ,

For Zigbee devices that use the IAS cluster, the driver must parse the incoming "enroll request" messages and must respond with zigbee.enrollResponse() command.

You can see an example here :

Cool, I will take a look. I was just literally looking at your GitHub drivers when you responded. Really weird!

1 Like

hubitat/HubitatPublic repository in Github is a good source of information.

1 Like

Alright that seemed to do the trick. I will continue to develop this driver. Thanks for the info.

1 Like

OK, I think I have just about everything working now. The contact, tamper, temperature and I think I have the battery working, but not sure. It uses the 0x0020 cluster which is for battery Voltage. I found a couple examples online, but the math is not working out in my head. The ZigBee document says that 0x0020 should be in units of 100mV. Does anyone have a working example of how to get the percent for the battery life?

I also see that all three version I have, has cluster 0x0B05 which I believe is for diagnostics, does anyone have any information on how to implement that?

And the latest version has cluster 0xFD50, but I can't find any information on that one. Any ideas? When I call read attribute I get this in the log:

[raw:catchall: 0104 FD50 01 01 0040 00 1D16 00 00 0000 01 01 000086, profileId:0104, clusterId:FD50, clusterInt:64848, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:1D16, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:01, direction:01, data:[00, 00, 86]]

On the battery voltage convertion to battery percentage - you can look at this code as an example. I am using the same formula and very similar code in many of my drivers,

I have no experience with 0x0B05 cluster usage, although it is present in the inClusters list of some of the devices that I know.

0xFD50 is a custom cluster that I also don't have any information. The response that you receive is 'read attribute is not supported' ( code 0x86 ).

On reading custom attributes you may find some useful information in this and this post.

Thanks for getting back to me so quickly. That's pretty much the same code formula I found. I'll just have to wait for the batteries to wear down a bit. I will definitely check out those other posts. Any information is great.