I think there are two different concerns here:
- how to represent this on the Hubitat side as a device with (standard or custom) attributes; and
- how to display this on a Dashboard
For point 1, the Hubitat side, the switch
attribute, at least as part of the (standard) Switch
capability, won't work, as it has exactly two states, "on"
or "off"
. See the Capability Docs for more. This in and of itself is not a problem, as you don't need to stick to standard capabilities/attributes; you could have a custom driver with a custom attribute like dogBark
and have your device driver set it to whatever values you want.
But since you want a UI for this, point 2 is, of course, also relevant. The advantages of Capabilities is that they come with standard commands and attributes, so apps "know" how to work with them. This includes Dashboard, where the "Switch" template will look for devices with capability Switch
, knowing that they'll implement a switch
attribute that has one of two values and that it can send an on()
or off()
command to manipulate the device, all defined parts of this capability.
Dashboard doesn't totally leave out custom devices (non-standard attributes, at least) here; the "Attribute" template allows you to pick any attribute you want and display its value on a tile. Unfortunately, there is no direct way to use Dashboard to send custom commands, which, depending on how the driver is set up, might be necessary to change this attribute value. If it's something you plan to change manually, I agree with the suggestion above that also making this device a virtual button would be one way to work around this problem. I'm not even sure that you technically need to implement the PushableButton capability since this command isn't part of that, though most devices do it; what you can make a button tile on a Dashboard do is send the push()
command to a device with a specific button number. So you could have push(1)
, push(2)
, and push(3)
do different things on your device and cause the custom attribute to get updated appropriately.
The above would still leave you with three Dashboard buttons plus a fourth to display the current state. All hope isn't lost here, but it does bring us to a different, related issue. There are "tricks" some people use to make one tile look like it has two or more different things on it. In this case, making your Dashboard three times as tall (or wide) as you want and making each of your "normal" tiles actually have a height of 3 while leaving these virtual buttons at height 1 would make it look like you have one tile with three actions on it. You could even increase this to 4 and cram the attribute text in the same "tile," too.
All this assumes you have a custom driver or maybe driver/app combo. It's nothing you couldn't also carefully do yourself with rules, global variables, or any method of your choosing, but if you have the ability to write apps, sometimes that's less convoluted.