Help with Rule - Multiple If/Then's each with a 'wait'

It looks like I've made a mess of this rule. I assumed (wrongly) that a 'wait for event' in one IF/THEN statement in the rule, would not stop the rest of the rule from running, just the remaining elements before the corresponding END IF. Unfortunately everything stops at the first open window. My rule is below. Is there a better way of doing this? I want the curtains to close at a given time but if the corresponding window is open I want it to notify me and wait until the window is closed. However I don't want to hold up the actions at the other windows. I also don't want 1 rule per window.

I suppose I could make it carry out the actions for every curtain where it's window is closed first, before rerunning again for open windows:

If Window 1 closed, close curtain 1
End If
If Window 2 closed, close curtain 2
End If
If Window 1 open, wait until window 1 closed, close curtain 1
End If

etc, etc. It seems a bit pants though

Why not? Makes the most sense.

:laughing: I knew you'd say that @bravenel - "rules are free". I suppose I can do one rule, clone it and change the appropriate devices to suit.

Some of us however just thrive on complication, 'how can I do this', 'how can I improve that', 'this god damn thing isn't working'.........but oh the smug satisfaction I feel when I take something simple, make it stupidly complicated than it need be and finally get it to work - that's priceless!

I have something similar for locks - I don’t want my locks to lock if the door is open, so I created “sub” rules that I call from other rules.

The “sub” rules have a wait condition, and will only run once it is fulfilled. The main rule just runs each rules one after the other. It doesn’t care whether the rule in question is in a wait state or not.

I also call the “sub” rules from any other rule where I want to door locked.

1 Like

might break up the notifications into one group of if statements, and the wait conditions in a separate set of if statements

i've also thought about using binary for these types of rules. assign each device to a power of 2, and add that value if it's open. then at the end, depending on the total value, i could notify for the specific devices

I'd go with 1 window 1 rule, but

What about 2 rules, first one similar to what you have now, if window is closed then move blind else notify. Second rule, required expression - "closing time", trigger - windows closes, action - close blinds.

1 Like

That would be easy. So Main Rule would trigger at the times I specified. Action would be run window 1 rule, run window 2 rule etc. The sub rules (window 1, window 2) would have no trigger and the actions would be the appropriate section from what I tried earlier:

That sound interesting - do you have an example of how that might work?

So I've implemented the method that @Sebastien suggested - a main rule running the actions of sub rules. Also in the main rule are actions for:

  • windows where there is a curtain to be closed but the window has no contact to monitor
  • an open command for the lounge curtain which is closed independently

The main rule:

One of the sub rules:

I've also installed the Device Status Announcer suggested by Sebastien in another thread and set it to run 5 minutes before the above main rule.

Thanks for everyones suggestions, they're very much appreciated.

1 Like

Counter = 0
Counter += 1
Counter += 2
Counter += 4

you can continue this for each device. then at the end, you can just have IF statements for each combination

IF Counter = 7 THEN
everything is open
IF Counter = 6 THEN
DOORC and DOORB are open
IF Counter = 5 THEN
DOORC and DOORA are open

this isn't something i've utilized in RM, but have used it in other programs i've done