Error : Cannot pop() an empty list

Yeah but nowhere before the "exit" is there a way to change it back to true. So there for it will always be false and will always exit.

I'm not saying I would write the rule this way, but it should still work this way. The delay is never cancelled. So at either 6 AM, sunrise-15 if between 4 and 6:01 AM, or the first time motion becomes active during that same timeframe, the lights will turn on and the delay will get scheduled. The next action after the delay is, effectively, setting the variable (or PB in the original rule) to True. That will always happen regardless of what happens in the interim; by this time the next day (much sooner in the latest revision above), the variable will have been reset.

Exactly! This way the lights are only turned on ONCE per day and off at 11pm. I think I could get it working if I moved the SET VARIABLE TRUE right after the delay (since the POP() failure isn't until the END-IF).

But I shouldn't HAVE to do that, right? This should work as written from what I understand.

How could you write the rule differently? I did it this way to test PB for my more complex rules. But, I could have written with a variable that tracks the DATE and only executes if the DATE != %date%. That should work as well. But, again, I shouldn't HAVE to do that right?

It sets it back to true after the delay (at the bottom).

No, it will not. Because you get the POP error, the bottom of the rule never runs so the PB is never set back to True. That's why it's easier to have a rule that doesn't need Private Boolean or Delays in it. :slight_smile:

I think there is at least one more suggestion above, but I would probably separate the "on" and "off" actions into separate apps/rules. This isn't an overly complex rule by any means, but in general, if you want different sets of actions (on vs. off) to get performed by different triggers (completely different times of day), it would be a good idea to separate them. (A "motion changed" trigger with "IF THEN/ELSE/END-IF" that turns lights on if active and off when inactive, often with a delay before "Off" and a cancellation in the other half of the conditional, is an example of when it does make sense to keep these together.)

If you just want the "Off" to happen at 11 PM, you don't even need RM for that; Hubitat Simple Lighting (soon to be renamed Simple Automation Rules) can handle that. But you could also use a separate rule. Either would simply your triggers and actions in this rule. It's unlikely it would address the pop() issue, but I'm not sure that's a problem if it's not causing any for you (I'm not sure my previous guess was correct anymore since you are only getting one event but two logs for it).

Is there an echo in here?

@bertabcd1234 Ok, but how would you get it to only run ONCE a day for the ON part (since there are 3 triggers, I just want the first one to "win" and the others to be ignored for the rest of the day)

I wonder if it's possible to pause the On rule within itself. Only to unpause the rule within your Off rule.

I don't see how moving the "off" actions out of this rule would affect that--just remove the "Time is 11 PM" trigger and the "ELSE-IF," and the rest should continue working as it was. However, I'm wondering if there isn't an undesired effect of the way your rule is written now (and the way it would still be like this) that I didn't notice before: won't any motion active event that occurs after your delay has expired (say, at 2 AM--not just when you actually do something to turn on the lights) also cause the PB/variable to get set to false (which would presumably be the only time you'd want that to really happen)?

To address that, I'd probably write this portion of the rule as something like this:

Triggers: Master bath active OR Time is 6 AM OR Time is sunrise-15

Actions:

IF (Private Boolean is True AND Time between 4:00 AM and 6:01 AM) THEN
    Set Private Boolean False
    On: Den Lights
END-IF

Then, I'd use another rule triggered later in the day (definitely outside of your 4-6 AM timeframe here) or night to set Private Boolean to "True" on this rule. Again, you could use another rule or even something like Simple Lighting to turn the lights off--and actually, you could set this rule's PB false from your "off" rule if you end up using RM for that, so you'd only need two for this whole thing. I think this keeps things very clean and easy to follow in all rules, which is a good thing.

@bertabcd1234 Thanks for the suggestion. I would still need the IF (PB is FALSE) THEN EXIT at the top, I assume.

This would certainly work. I could also get it working by just setting the variable to TRUE right after the DELAY (since it crashes on the END-IF).

The consensus seems to be that RM will cause a POP() error when a triggered rule is in a delay and another is triggered (even if the second triggered rule doesn't execute the delay). That's an unfortunate limitation, but I appreciate everyone helping be diagnose this. Is there a place where we can submit suggestions? Not sure where the developer would prioritize this one, but I'd like to get it on the list.

Curious if there are other rule apps available that I should look at?

No. If PB is false, my IF (Private Boolean is True AND... will be false, and since the entirety of this rule's actions are contained in that block, nothing will happen.