Dash board button to toggle between 2 rules

Hey Everyone

I have a Lutron 2 button remote. Button 2 is set for one rule and button 4 is set for another rule is there a way to have a dashboard button that toggles between the 2 rules ?


What do you mean toggle between the two rules? Do you mean run one rule the first time you push the button, then another rule the second time you push the button? If so, do you want a "reset" period where it will go back to the first rule after so long, or do you want it to just switch between the two regardless?

If this is what you mean, there are a few things I can think of. Do you run these rules from anything besides the buttons? If so, you could consider consolidating them into a single rule, which may make this a bit easier (you could set the rule's private boolean true or false and toggle it on every other press--but even if you keep them as two separate rules, you could use one to toggle the other's private boolean, and in either case check for the value of the private boolean before running the rule). You could also create a third rule just to handle the button presses, probably the best option if you have triggers besides the button presses themselves (or ever manually run the actions or call them from other rules). In this case, you could do something similar: toggle the private boolean for this third rule, then call the actions for either rule 1 or rule 2 depending on the state. In all cases, if you plan on tapping the button quickly in succession, you may want to use a "real" local (or global) variable instead of Private Boolean, but in most cases either should work.

A completely different idea would be toggling the state of a virtual switch with each button press, then checking the state of the switch either in each rule or in the hypothetical third rule (if you go with that idea to handle the button presses). This is mostly a workaround people used before we had variables, but there are still some neat side-effects of doing it this way, like the fact that switches are very easy to manipulate should you ever want to do so manually (device page, Dashboard, Alexa, etc.) to change the behavior for some reason.

I'm happy to go into more specifics with any of these options, but it would probably be nice to know more about exactly what you want to do and how you have (and want to have) things set up. Otherwise, if you're familiar enough with the ideas I mentioned above, you can certainly try whatever sounds best to you.

So I need to toggle between FP On and FP Off with a Dashboard Button ?

Oh and yes i can run from 2 button lutron remote 2 for on and 4 for off.

Thank you for the ideas i have it working now set up a virtual switch and call the rules that way on dashboard.

Thank you again.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.