Step-by-step guide to writing a z-wave driver

Hello,
I wanted to ask if there is a step-by-step guide to writing a z-wave driver yourself.

Maybe there are example codes that describe exactly what happens when.

Can anyone give me a few tips?

thx

1 Like

There are hundreds of examples out there. But, no, I've never seen a step by step guide.

Closest I've seen is the smartthings documentation, which is quite good. Still not a step by step, but that was the main resource I used when I started writing zwave device drivers.

Maybe start with a very simple driver, like a switch, and just start walking your way through it.

1 Like

As mentioned above, Hubitat certainly has no such guide. The "classic" (not new) SmartThings docs are about as close as it gets, but you can consult the Hubitat documentation for exact method names and things as you eventually may need them (but most are again the same). The biggest differences are summarized in this thread: App and driver porting to Hubitat.

But before you even start a driver at all, there are parts of the Hubitat architecture I'd make sure you are familiar with. A "Device Capability" is a sort of abstract declaration that guarantees a driver will implement certain commands and attributes and allows users to select devices in apps based on those capabilities (for example, the "Switch" capability requires the on() and off() commands, plus a switch attribute with a value of either on or off--that's just a simple example). If you aren't already familiar with that, you'll need to be before you even get to the Z-Wave part. ST has docs here for that: App and driver porting to Hubitat, and Hubitat's (most are the same except for buttons, plus they added some like Change Level and Light Effect) are here: Driver Capability List - Hubitat Documentation.

Z-Wave-specific documentation for ST is here: Z-Wave Primer — SmartThings Classic Developer Documentation. If you aren't familiar with how Z-Wave works behind the scenes, that is probably a good place to get the basics. Most is the same on Hubitat (except as noted above, and Hubitat either currently does or will soon implement slightly newer versions of some command classes than ST). But if you aren't already familiar with how to write a driver on Hubitat--even a "virtual" driver that does nothing except take commands and report attributes--that would be a better place to start. Then you can add in the "Z-Wave parts" that make it actually talk to (and receive communication from the device) when you're comfortable.

Just some ideas!

1 Like