Custom/Synthetic Capabilities?

I have a FGRGBWM-441 that I have wired up to a 12V (dumb) motion sensor and a dimmer potentiometer.

I have it all "working" with the motion sensor triggering lights via the 10v inputs and such but for now I'm just using a ported version of this handler for verifying my breadboard wiring.

The next step is a custom device handler, ideally I "hide" the real capabilities of the FGRGBWM-441 and have the handler expose a device that actually has:

capability "Configuration"
capability "Energy Meter"
capability "Motion Sensor"
capability "Polling"
capability "Power Meter"
capability "Refresh"
capability "Switch Level"
capability "Switch"

To make it look like a motion sensor dimmer switch with energy usage monitoring.

Is it as simple as just declaring the capabilities I want and making sure the logic in the handler does the right thing?

Thanks for helping a noob device handler author.

1 Like

Yes, pretty much. Each capability has commands that must be implemented. You can find the commands each capability has here.

https://docs.hubitat.com/index.php?title=Driver_Capability_List

Implement a method for each command (plus any helper methods you need) and you're essentially done.

1 Like

Awesome, thanks!

So the capabilities declared in the handler are orthogonal to the actual ZWave events the handler uses to communicate with the device?

I would say they can be directly related or not. Some of the capabilities have a z-wave message that nearly directly associates to the capability. Others, there is a z-wave message for multiple capabilities.

There are lots of GitHub.com drivers for Hubitat devices. Take a look at one of them. There is typically a parse method for every type of Z-Wave message the device supports. The response from each command is parsed in those methods and the device's states are updated.

1 Like

Capabilities define a device driver interface specification.
It is an abstraction layer that exists between the physical device command layer (zigbee, zwave, lan, whatever...) and Hubitats event and command schema.

The role of a driver is to translate the required capability commands and attributes back and forth using the devices native protocols.

A given capabilities commands are converted to device specific commands and sent to the device.
The device responses are converted into capability attributes and sent to the event system.

3 Likes

All very interesting! My first Hubitat hub is on order, when I get it I'll be aiming to port all my device handlers over... though it seems like others have already beaten me to it! :slight_smile:

3 Likes