Toggle multiple commands with a single button

In iRule you can set a buttons properties to “toggle commands” which will allow you to add two or more commands to a button which will fire incrementally on each button press. For example my DENON has an ECO button which has three states ON, OFF and AUTO. I would like to combine these commands into one button instead of three. Is this possible in THR? Every attempt I have made so far results in the commands all firing one after another on a single click.

Thanks

Toggle buttons only have 2 states, Checked & Unchecked. You can run a set of actions when it is Checked & you can run another when it is Unchecked. You can’t do 3 states. I’ve included a link to Brian’s video because he gives a great overview that will help you understand exactly how Toggle Switches & Toggle Buttons work.

You could probably get similar behavior by using a standard button and a variable that tracks its current state, so that you could both (1) send the appropriate command and (2) update the label/button state. I gave an example of this in a slightly different context here, but you should be able to do effectively the same thing with multiple data/event triggers on the same button. That said, I haven’t tried this out, so there may be some other limitation I’m overlooking at the moment.

You can do this by layering 2 buttons one on top of the other and using visibility. One button controls two states and the other controls the third.

The attached project should give you an idea.

demo.hrp (101.7 KB)

Thanks, I will give it a try.

I accomplished this for a Thermostat HVAC Mode: Off, Heat, Cool, Auto. To do this,

  1. I first created a button (regular button not toggle) that would be the HVAC Mode button.
  2. Created a DataTrigger for each state (Binding to the HVAC Mode, and Value for each value in HVAC Mode.
  3. In each DataTrigger, have one “setter” that sets the icon to the state received from the binding
  4. Create an EventTrigger for each state.
    5 . All EventTriggers have a “Clicked” event
  5. Have a conditional set in each EventTrigger
  6. In the conditional bind to the HVAC Mode and set the Value for each
  7. In the action set the binding to the HVAC Mode, but set the value to the next value you want the button to increment to (this is what will “cycle” your button to the next button state when clicked)
  8. Test.