Driver code samples

We have published some example driver code in our public Github repo.
These are actual production drivers included in the HE platform.

Currently published:
Generic Zigbee RGBW bulb
Virtual Lock driver
and the Generic Z-Wave Central Scene Dimmer

13 Likes

Thanks, Mike. When I have time, I will modify and re-release the code using your internal capability, commands, and structure, etc. Should make it sing better with the chorus.

Noted that the RGBW bulb does not have a capability Polling. People have been asking for Polling in thread above (and it is now supported in HE). Any problems adding?

Dave

polling usually ends up being an alias for refresh, no need for two commands when one will do.

The sample Zigbee driver seems to use mostly raw Zigbee commands. Is that the only way to build a Zigbee driver, or are there commands and methods built in to the Hubitat, and if so, can you publish a sample that uses them?

No, there are helper methods, while not completely finished, it's a start at least.
https://docs.hubitat.com/index.php?title=Zigbee_Object

Just wanted to say thanks for this @mike.maxwell. I needed to make a very small change to use as a virtual device to lock and unlock my car. Having it available was greatly appreciated.

1 Like

Any chance of getting the example codes for the generic zigbee white bulbs (both normal and CT)? Would be a great help in understanding how to write drivers for HE.

There is an example zigbee rgbw driver in the repo, remove the color bits and you have a ct driver, if you remove the color and ct bits you have a dimmer.

Ah I see, makes sense, thanks!

Greetings, any chance of adding the code for the Virtual Thermostat to the repo? Would help me to avoid a plethora of Rules Engine rules to get the stock one to 'front' 6 real thermostats doing various things. Thanks!

1 Like

Can you please post the code for the 'Virtual Button' Driver?

is it okay to write my own driver code based on these example codes and publish it on github?
are there any license restrictions?

Is it possible to publish the driver for Generic Z Wave Motion Sensor?

@mike.maxwell can you guys publish the virtual devices? That would make a good starting point for anyone who wants to make their own device driver.

1 Like

They published the Virtual Omnisensor a while back, which has a lot of capabilities, though not many of the "switch"/actuator types. But it's good starting point for either removing what you don't want or adding what you do. Most are pretty easy if you already have a template like this to start from, since they don't really do anything besides accept the commands required for the capability and send an event (modify the attribute) as expected if were a "real" device. You can find commands and attributes for each capability in the docs. The driver is here:

There are also lots of virtual community drivers.

5 Likes

Please, I would like to request if it´s possible to post an example of a television driver using these capabilities:
https://docs.hubitat.com/index.php?title=Driver_Capability_List#SamsungTV
https://docs.hubitat.com/index.php?title=Driver_Capability_List#TV
I'm trying to develop a driver for TV but I'm having difficulty including it in the dashboard and also working on Alexa and homebridge

1 Like

See the link below. It is a working driver for Samsung TV (2016 and later). Dave Gutheinz

https://raw.githubusercontent.com/DaveGut/HubitatActive/master/SamsungTvRemote/SamsungTVRemote.groovy

3 Likes

@mike.maxwell, can you please post the code for the 'Aurora Zigbee Switch' Driver?

1 Like

Download the Hubitat app