Button Push with Variables

TL;DR It appears that a Button Push in RM4 won't take a variable as its button number. Is that correct? If so, is there a workaround?

I have a 15-button device (virtual, of course) that I originally setup to drive a set of related actions from a dashboard. I now would like to expose the same behavior through speech via Alexa. Alexa doesn't support buttons, so I was thinking of using a dimmer or even a few switches strung together logically as a binary number, and then passing along that value to the button device. It works great in every respect, except I don't know how to push a virtual button with a GV as button number.

Appreciate any input.

I use a virtual switch with auto-turn off at 1500 ms to communicate back from Alexa, in order to cause actions such as mode/scene change, etc. Alexa can handle switches exposed from Hubitat.

Instead of using RM’s Button push or held action, try using a Custom Action to call the virtual button device’s push() or hold() command, as you should be able to pass in an argument to those commands this way.

Here is an example. However, replace the “15” with your variable.


Absolutely brilliant and elegant workaround. Much appreciated!

1 Like

Appreciate the thought, but that only works if you are driving a single or binary action. For a 15-button device, it would require at least 4 switches and a bunch of math to make it work.