Custom/Synthetic Capabilities?


#1

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.


#2

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.


#3

Awesome, thanks!

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


#4

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.