Help with complicated automation in Rule Machine

I have a rule that I disabled. How can I tell if it’s been enabled? I unchecked disable but it didn’t run immediately. Here is a screenshot of the rule.

How did you disable it? Using the checkbox in the Apps page UI? (That's only thing literally worded "disable" or "enable," but some people loosely use this term to describe similar app-specific option like pausing the rule rather than this platform-level feature -- so just making sure.)

If so, the app is definitely not disabled because you can get into it. Disabling an app prevents all app code from running, including the code that displays the app UI. You'd also still see the disabled checkbox on the Apps page (if you have the "Disable" column visible; see Apps Page | Hubitat Documentation).

Disabling an app per se will not make anything happen. Apps do not get any notifications when they are disabled or enabled. Your rule looks like it will only run at 25 minutes after the hour. What time did you observe this behavior at? Did you not see anything happen at 25 after? (If you're in a time zone that is in even hours away from UTC, that should be soon but not likely when you posted.) If you still see anything unexpected, enable all logging for your rule and see what Logs say, per How to Troubleshoot Apps or Devices | Hubitat Documentation.

2 Likes

I had it disabled like you said. I unchecked it. Am I supposed to click Run Actions to get it started?

If you want to manually run the actions once, sure. Otherwise, from your rule, it should run on its own at 25 minutes after the hour, per my description above. (Again, re-enabling the rule won't make the actions just run, even if it missed a previous run time--but the schedule should still be there for the future.)

You did not answer the questions about what it was or was not doing, when that was, or if you have enabled logs or observed them for any output from this rule. These would be the next best things you can to to troubleshoot.

EDIT: It may also be good to verify that the device being controlled by the rule works as expected, assuming your questions above are based entirely on the observable outcome of you not thinking the switch is getting turned on/off when you expect (but that's a roundabout way to debug, so the above is a better approach to actually pinpoint the problem).

I thought that when i reenabled it that it would run immediately and then run again 25 minutes later. (It’s the way Vera works so it was reasonable of me to assume that when reenabled it would do the same.)

How does this rule work in practice using Hubitat?

Probably clear by now, but just in case: no. :smiley:

As I described above. The next time the trigger event happens, it will trigger--again, even if something happens in the meantime (disabling prevents any code from running). Logs will show you more about what is (or isn't) happening if you enable them for this rule.

If you want it to work differently, you can manually run the actions as you suggest above, or you can add another trigger event that matches whatever it is you really want or find some other way to run the automation -- options are unlimited, just depends on what you actually want and have available as a means to trigger from things the hub does know about. :slight_smile:

2 Likes

Then I should click Run Actions if I want it to happen immediately and then after that it should run every 25 minutes, am I correct? I am trying to learn how to use the software in practice so I am not thinking it's broken.

Yes, "Run Actions" will run the actions at that time (regardless of any triggers you have configured -- in fact, even you have none).

You should not need to do this to get the schedule back in effect, however. That should just happen on its own. If it gets lost for some reason, an "Update Rule" or "Done" (same thing, the latter just closes the rule page and navigates you back to the Apps list or wherever you came from) is the best way to get things back on track, keeping in mind that it can also affect waits, delays, and other pending rule actions. The docs explain quite a bit more if you have not read them: Rule 5.1 | Hubitat Documentation

2 Likes

I think you want to select this option for it to run every x minutes. You have it running at 25 minutes after the hour, so 2:25, 3:25, 4:25. Unfortunately, this option does not include 25 minutes.

Usually when I reenable a schedule now with Vera it runs immediately which is what I am used to and it means that I want the sump pump to run immediately as I have looked out my window and see that the pump needs to be turned on. I get periodic standing water and decided on this methodology and it works for me.

If that is not how unchecking the disable box works then I need to hit run action correct?

This is somewhat unfortunate in the way rule machine works if true.

Each of these: means it starts when?

Yes, re-enabling a rule will not make anything happen on its own. You need a trigger event to trigger the rule. So "Run Rule Actions" will make them run once on demand whenever you want if that is what you need.

I think of it this way: the platform cannot know what you want, but it gives you the means to do whatever you do want. I, for example, would not want most (any?) of my rules or any app to do anything on their own just because they were re-enabled (at the platform level, this isn't possible right now because there is no way for apps or drivers to know when they themselves are disabled -- it was originally designed as a troubleshooting mechanism for runaway code or other problems, though can have uses in automation like this -- though that isn't technically impossible to change).

In your case, perhaps it would be better to take another approach to your automation. For example, instead of disabling the rule, have you tried using a virtual switch, boolean hub variable, or other option as a required expression, preventing triggering when the device is in a certain state? You could also add the other state as a trigger, running the actions when that changes -- more automation than what you're doing above, and again, something the platform provides the means for you to do on your own if that is what you want. You could also use conditional actions instead of a required expression, among other possibilities.

2 Likes

What is your ultimate goal? How do you want this to happen? There may be a better way to approach your problem.

I would like to find a way in which to, whenever it rains and I push a button somewhere in Hubitat, to enable the automation. What would I do, in Hubitat's case, to prevent the triggering of the automation when it's not needed and allowing me to enable it when it's needed?

I am happy to explore other options. Which one is simplest for my application?

Yes, I see that now. Thanks!

Disabling an app is more for things where you might have something seasonal, and disable it for a majority of the year. It also is helpful when troubleshooting, or when cloning a rule to test a revised rule (where you don't want to edit the old rule).

You simply want a dashboard button, or maybe even a physical button that runs the pump when you push the button?

That should be a lot easier than you are making it. I think you have posted about this in other threads previously, is this the same pump? Rule for Sump Pump

You might not even need Rule Machine for such a simple automation.

I agree with what Robert said above, this is getting way too confusing by posting in multiple places for the same issue, I would suggest sticking with one thread so people aren't duplicating efforts and giving you conflicting advice.

2 Likes

I think they want to push a button to have the pump run now + every 25 minutes thereafter, until the button is pushed again.

Yes. I want to press a button that turns on and off the script. The button is greyed out in this script with Vera. If i press it, it turns green and starts the script. Here is a video.

Is there a way to get a button that can be installed on a Dashboard that enables and disables the automation?

Sure, you could create a virtual switch, add that switch to a dashboard, and use that switch in one of the ways I described above.

You can do this with a virtual button, too, but a switch will have two states you can use to more easily see the status, so I think that would work better. Either creates a "tile" on the dashboard you can tap or click.

5 Likes