Thanks to certain users on this forum, I have learned to incorporate a Lutron Pico device. Then I created a rule:
Button 1: Turn Device On
Button 2: Turn Device Off
I'm proud of myself, too.
Now I want to write a conditional rule.
IF Button 1 = Off, Turn Device On
ELSE IF Button 1 = On, Turn Device Off
I've not seen any examples of this. Can you point me to a doc or a post that covers this?
Thanks...
I expect what you are after is to use the device in your condition, not the button. A button does not have a state of on or off, think of a button like a button on a TV remote, whereas a switch has an on or off state.
From what you have posted I expect you may not need a conditional action, you may be able to use a toggle action instead.
That's a good doc for those who wish to take up programming.
A Toggle Action, eh? I found this on the Basic Rule page, and I put one together. It looks promising, I'd like to try it out. Can I attach a Basic Rule to an existing device?
I expect there will be some details in the link @rlithgow1 provided, but you can also look at this option when creating an action.
I've never seen the Create New Action panel. Got a link?
After you create your rule and give it a name, click on the Actions section:
Then Create New Action:
Everything above "Rule Machine API" is just a high level intro to how automations in Hubitat work. The concepts apply whether your writing code or creating a rule in Basic Rules/Rule Machine/Button Controller/etc. There's also a link to Rule Machine 5.1 that dives into using RM specifically.
I must be asking the wrong question. Our docs are not a "How To" guide, unfortunately. That's why I ask my questions on the forum. I'll try again.
This is the Rules 5.1 doc: Rule 5.1 | Hubitat Documentation
I've created a Basic Rule. I used Basic Rule because I didn't see how to do this in the Button Controller app. It toggles a light switch (I hope) on and off with a single button, just as an actual light switch does. Now I want to test it. To do so, I must attach it to an existing device. The device I wish to attach it to is a Button Controller.
How can I get an existing Button Controller device to utilize an existing Basic Rule?
Which app did you use? "Rule Machine" or "Basic Rules". The Rule 5.1 documentation linked to above relates to "Rule Machine", not "Basic Rules". Here's the Basic Rules documentation:
Thank you, this is not in the TOC. I took a quick look through it. Unsurprisingly, there was nothing in it about how to utilize the Basic Rule once it is completed. The Button Controller UI should allow for this option, but it does not.
OK, I'm going to make what engineers used to call a "Wild A55 Guess" (WAG).
1.) When I create a Basic Rule, it is automatically attached to the device I have assigned to it. No action in the Button Controller is required.???
2.) If the Button Controller already has an action assigned to it in the Button Controller UI, this action will take precedence. The Basic Rule will not be acknowledged.???
Right or wrong?
If you have a Basic Rule triggered by the pressing of a button, along with a Button Controller setup for the same button press, the actions defined in both will be run. So I would suggest picking one to do what you want.
They can't both be run, they are contradictory. The Button Controller turns the light on. The Basic Rule toggles the light. It appears that the Button Controller action takes precedence. Does that make sense?
Whether they do or not you wouldn't want them setup that way. You could turn on debug logging to test the theory, but in the end you should just configure one of them to do the job you want done.
Why not use one or the other? Button Controller (BC) is perfect for button rules and is like RM specifically for remotes/buttons. However, anything in BC can be created in Rule Machine (RM). I personally use BC for all my button/remote routines.
I have not found how to access the Toggle function from the Button Controller app. If I knew how, I would do it. Basic Rule provides easy access to the Toggle function.
At the moment I am learning by trial and error. I know that functions in both places are not needed. I'm lucky I can get the job done any way at all.
To add. Here's a very simple way to make a button press/push toggle your switch using button controller.
You select your button/remote from the button devices. Then it'll generate a grid with all the actions your button can do. Such as Pushed, Held, DoubleTapped for my button.
You select create button rule for Pushed. It'll bring you to the actions page for the Pushed command you'd like to program.
Then you select control switches and selection Toggle switches, then select your switch.
EDIT:
Be sure to pause/stop/remove any other rules you have that is controlling that button. Before testing/using your new BC rule.
I'm going to try this right now.





