What is wrong? Simple Rule Machine Rule

Does anyone know what's wrong here?

image

It means that you have multiple instances of the same rule being executed at the same time. This happens when there are triggers configured that could happen simultaneously. While it is not necessarily causing an issue, it is advised to make "simple" rules or debounce rules, especially when you are dealing with delays. You can debounce rules by using the private boolean. Here is an example of debouncing with a variable which is the same as using the private boolean:

2 Likes

Can I just do the following?

If Private BOolen is False Exit Rule
After THEN
Private Boolean False
ELse
Private Boolean True
Cancel Delayed Actions

Almost, you also need to set the private boolean to true after the delay is over (e.g. right before open() on Echo - Xbox) to reset the PB when the rule finished

1 Like

You mean Private Boolean after the Echo Xbox Close?

1 Like

Yes

1 Like

Will this work?

You want to move the

IF (Private Boolean is false) Then
  Exit Rule
End-if

all the way to the top of the rule. It should be the first thing to test so you don't have simultaneous rules calling Cancel Delayed Actions

2 Likes

This doesn't look right.

Because it would exit and never cancel the delayed actions if the motion sensors become active again.

You are correct. Sorry about that. Move it back to where you had it and then add another one with the inverted condition in the else part

IF (Not Mode Pause) Then
  IF (Any Motion inactive) Then
     If (Private Boolean is false) Then
       Exit Rule)
     End if
     Set Private Boolean False
     Delay
     Off
     Open
     close -> delay 5
     Set Private Boolean True
   Else
     If (Private Boolean is True) Then
       Exit Rule
     End If
     Cancel Delay Actions
     Set Private Boolean True
  End if
End if

Okay I think I got it?

Looks good to my eyes

Okay this makes sense. The private booleans are there to not re-run the rule basically.

One motion sensor is active and another one becomes active it won't re-run the whole rule. And vice versa.

Is that correct?

That is correct

Awesome.

Thanks for the help. I have to update another rule I have just like this one.

1 Like

I have anothe rule.

WOuld this work

Trigger:

All motion sensors Inactive

Actions:

If all motion inactive AND iphones all not preset and OccupancyAway is off THEN
Set Private Boolean False
Delay 45 (Canceable)
On: OccupanyAway
Private Boolean on

ELSE-IF Motion Sensors any active AND OccupancyAway is on THEN
Cancel Delayed Actions
Off: OccupancyAway

ELSE-IF Private Boolean is False THEN
Cancel Delayed Actions
Set Private Boolean True

END-IF

No, there are some logic breaks in your design and you will still have way to many instances running of that rule due to all the motion sensors used as triggers. The Else-if construct you have is getting you into trouble

How about something like this:

Trigger: Motion sensor **changes**
Action:

IF all motion inactive and iphones not present and Occupancy Away is off Then
  If (Private Boolean = False)
    Exit Rule
  End If
  Set Private Boolean False
  Delay 45 (cancable)
  On: OccupancyAway 
  Set Private Boolen True
Else-if (occupancy away is on)
  If (Private Boolean is true) then
    Exit Rule
  End if
  Cancel Delayed Actions
  Off: Occupancy Away
  Set Private Boolean True
End If

Problem is nothing will cancel the delay if it doesn’t match the switch being on.

Than make the else-if just an Else without condition

For some reason my brain won't wrap around that rule. Just the way I think I guess.

I made this rule. I think this should acheive the same results.