[2.4.2.134] RM every wait for event time causes rule to trigger a additional time

Why is this rule double and triple triggering? Seems like every time it waits for a time it then adds another instance. Or is there a better way to do this with the staggered shut off times?

Wild one. What is happening at midnight ?

As for workarounds, I see two possibilities:

  • remove the wait for 2am and make the next action a delayed action (4 hours)
  • move the actions at sunrise + 15 minutes to a second rule with that as a trigger.
1 Like

What about setting each of those times as trigger events.

Then, putting in an if then/else if/.../else statements to get the time and take the desired action(s)...then exiting the rule.

I mean... I could, but that seems more complicated.

It could also just work correctly as written, unless I am doing something wrong?
Is there an issue with a wait inside an IF block? Looking at it logically I don't see any problems.

I'm not sure exactly how rule machine handles all those waits.

From what I gather, I think it halts execution and sets another event to fire at the expiration of the wait.

I'm any case I'm leary about long, sequenced waits like that.

For one, I think "saving" the rule might cancel them all out. While I think a reboot is safe, I'm not sure what happens if the hub is down when the wait expires (a trigger might not fire then either, but you don't have a rule in progress either).

Second, rule behavior when invoked while another instance is running can lead to "unpredictable results".

By letting the rule fire, do it's thing, then exit, you avoid a lot of those potential complications.

Instead of using logic to determine what actions to take based on the time, you could also create a few very simple rules, one for each desired time.

1 Like

I'll be curious to hear Bruce's thoughts here, but it sure seems like the oddness begins at right at midnight.

I can't remember the exact circumstances, but a long time ago, I ran into issues with rules that crossed over midnight... And still to this day, I won't do it -- I figure out some other way to handle it instead.

I'm curious if Hubitrep's first bulleted suggestion would be more immune to the midnight-threshold oddness - it may be worth a shot.

If this was me, I'd probably just split it up into 3 time-based rules (sunset & 10pm in one, 2am, sunrise), simply because I'm confident that would work well and it'd be the fastest way to wash my hands of it all :sweat_smile:

5 Likes

I’ve seen this before with a couple of my rules. If I remember correctly, it ends up not affecting them as things run the way that they should.

With that said, I’m almost positive what you are seeing is related to the rule “resubscribing” to sunset for the next day. The hub’s sunrise and sunset times (I think) for the upcoming day are run right after midnight. So, it’s not “retriggering”. It’s getting the rule ready to run the next day at the next sunset.

The duplication of 2am is probably an artifact of the rule still running, but also updating its trigger. If you want to clean up your logs, most likely you’ll need to get rid of the waits that extend over midnight. Basically, have two rules…one for on and one for off.

1 Like

Hmm... sounds like a bug to me.

2 Likes

@bravenel any ideas on this?

Still activating multiple times after delays.

I made it so the delays ae not inside the IF block

Seems like this is getting worse.
I guess its just broken and I will have to split it into two rules so it does not cross over midnight.

Currently just scheduled once, I agree it seems to start exponentially getting worse after midnight.

New rules... :face_with_raised_eyebrow: :disappointed_relieved:

Hopefully this will at least make it stop triggering multiple times after midnight.

2 Likes