Help with rule

I am making a rule in rule machine that is to work like this. Between 10 & 11 pm when motion is detected to turn on bathroom lights. This part is not a problem, but I want this rule to only run one time during the 1 hour period.
This is what I have made.

I need to make this run only one time.
Thanks for any help.

Add a private boolean to your rule and have that be the first action. Doing that would cause your rule to look like:

Required Expression
Mode is Home and Time Between 10-11pm and Private Boolean is True

Trigger
Motion reports active

Actions
Set Private Boolean to False
Turn on Lights
Wait for Event - Specific Time - Time is 11:01pm
Set Private Boolean to True

With the above, this will restrict the rule to running only one time; however, it will reset the Private Boolean after the time window allowing for the rule to be ready for the next day.

1 Like

Thanks, I will give that a try.

I think this is what you outlined.

Yup! That will run only once if motion becomes active, Mode is Home, and it is between 10 and 11pm.

1 Like

That should totally work fine, and I'm not trying to one-up JB10 here or anything like that, but from Bruce's posts lately, it seems like he leans toward using PBs as a Condition for the trigger (versus using the PB as a Reqd Expression).

There seem to some edge cases where PB as a Reqd Exp can end up whiffing -- those seem to be rare, but using PB as part of a Conditional Trigger apparently does a better job mitigating that circumstance.

I used to always use PB as a Reqd Exp, and I never had an issue myself. But I've since started using them instead as a Conditional Trigger (again, no issues).

Just food for thought and maybe something for your bag of tricks.

4 Likes

Also worth noting @davidcwright59 (and it may be intentional), you haven't automated the turning off of that light so it'll be 'via finger operation' unless you add something else to the rule or it gets turned off by another rule

I did what you said and added a condition of private boolean true to the motion event. The rule looks like this now.


I had never added a condition to a trigger so this was new for me.

1 Like

You are correct, There is no automation to shut the lights and fan off. I could add it to my lights out button, but then the wife would have nothing to do.

1 Like

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