Question regarding the absence of "button capability" and if it acts different that a typical device

I read in a post comment from Mike Maxwell that Hubitat folks don't like the "button" capability. Stating the proper way to initialize a button is to use the functional capability ( i.e. capability.pushableButton). I've not tested but one might assume to subscribe to a "HoldableButton" an additional input statement would be required.

However for the thermostat, from the single input statement (as below) will allow access to all the capabilities of that thermostat.

Does anyone know why the "button" is discouraged (or not allowed) causing it to act differently than all/most other devices?

def mainPage() {
    dynamicPage(name: "mainPage", title: " ", install: true, uninstall: true) {
        section {
            input "thermostatID", "capability.thermostat", title: "Thermostat", multiple: false, required: true
            input "buttonID", "capability.pushableButton", title: "button", multiple: false, required: true
            // input "buttonNumber", "number", title: "Select Button Number", required: true } (for future reference)

Thanks to csteel for his "Get Attributes App"

Device Sonoff Zigbee Button Controller
    -= Capabilities =-
    [Configuration, Actuator, Battery, HoldableButton, PushableButton, DoubleTapableButton]
    -= Attributes =-
    [pushed, numberOfButtons, battery, doubleTapped, held]
    -= Commands =-
    [configure, doubleTap, hold, push]

We felt it wasn't very extensible, didn't make much sense once you got beyond pushed and didn't reflect the range of button operations available.

It really doesn't, not all button controllers have all of the four button capabilities that hubitat supports, having them be independent better describes the capabilities of the device.

1 Like

Adding to the above: no, once you get a reference to a device from an input, you have full access to any attributes and commands, regardless of what capability you filtered the input with (though, of course, the only ones you can depend on being there are the ones from that particular capability).

1 Like

Thank you for the clarification and perspective. I'm not good at following directions I don't understand.

Robert (I hope you don't mind me using this).
Thank you for the clarification of what I was a little unsure about AND more importantly the statement:

the only ones you can depend on being there are the ones from that particular capability

What I meant is that if you select for capability.pushableButton, then you can really only depend on attributes and commands that this capability requires: pushed and numberOfButtons for attributes, pushed() as a (somewhat unusual) command. You don't know that released would be there, for example, though it could be for some devices. (If you need that, select for capability.releaseableButton instead, or just write your code in such a way that it gracefully handles things that could be available but happen not to be on any specific device.)

1 Like