Error: Cannot pop() an empty list [SOLVED]

I found this post on this topic and it appears that the issue is caused when a triggered rule is in a delay and another instance of the rule is triggered. This would certainly make sense for my rule (see below). Can anyone suggest a way around this for my specific rule? I've tried to think how to rework the rule but can't figure it out.

I have the 3 and 1 seconds delays in place to allow time for the %laylas-lights% variable to be updated so its value can be included in the notification. If there is a better way to do that please let me know.


Recommended practice is to exit rule immediately if rule's private bool is false, then set bool false. When all actions are done, set bool back to true

1 Like

Gotcha thanks makes sense, trying that now.

Your rule is triggering itself. That's crazy and is the root source of your problem. Get away from "changed" if you can, get away from self triggering, get away from delays embedded in Conditional Actions. Rethink this from scratch. If you use a local variable, there is no need for a delay for it to be "updated". This rule is crazy. You know you've turned off the light, yet you need to set a variable to the state of the switch? Why? Why not just notify that you've turned off the light?

LOL. Your own documentation recommends using "changed". But ok, I am happy to rework it, that's why I asked. :slight_smile:

I want my notification to report the actual current status of the light, to confirm that it's off, not just a static "light is turned off" message. What is the best practice to do that?

Why? Are you thinking that you can turn off the light but it doesn't actually turn off? If so, you are barking up a crazy tree. Attempting to use the platform to deal with the platform not performing is simply a dumb idea. Either the light is responding to commands, or you have much larger problems. And if you do have those problems, no rule is going to save you.

Just write down in English what this automation is trying to accomplish, minus things like 'did the light really turn off or not'.

Man did you have a bad day or something? Aren't you one of the owners? Is calling your customers crazy [EDIT: and dumb] part of some new corporate strategy I haven't heard about yet? I like it! LOL.

All I want is for the light to be turned off after X minutes of no motion and a notification confirming that. PLEASE.

LOL yourself. Would you prefer that I NOT point out your folly? I'm not being mean, and I am trying to help you.

What do you really mean by "confirming" that. If you turned it off, then you turned it off. Doesn't this rule only matter when the light was turned on? As opposed to "changed"? Aren't you missing events related to the motion sensor?

Is what you want a basic motion lighting automation that turns on a light when motion starts and turns it off 1:00 after motion has fully stopped, and then notify it's turned the light off?

The use case is simple: my daughter turns on the lights in her room using the physical switch, and then leaves the room and forgets to turn them off. So I want a rule that turns them off after X minutes of no motion. I don't need the rule to turn the lights on.

I wouldn't even know that this has happened, so I would like a notification confirming that it has. I am just a little particular like that. :blush: :hugs:

That's all.

Thanks again!

OK, so the only case you care about is the light being on when motion has become inactive and stayed inactive for a minute, right?

So perhaps a trigger on motion would work better.

Trigger Event
   Motion changed
   IF (light on AND motion inactive) THEN
       Wait for event: elapsed time: 1:00
       Off: light

Walk through what happens. She's in her room with the light on, and leaves the room. Some number of seconds later motion becomes inactive. If she turned off the light nothing happens. If she didn't turn if off, wait for 1 minute, then turn it off. The Wait is canceled when the rule is triggered. So if for example, motion becomes inactive, but then active again, the rule will cycle around. Only when motion has stayed inactive for 1 minute will it do anything, namely, turn off the light and notify.

If you actually have an issue where you've had a rule turn off a light, but it doesn't actually turn off, that would be a separate issue worth resolving -- just don't try to make the rule solve that problem (if it exists).

1 Like

That worked, thanks.