RM4: Is it a bug or me?

Hi all,

I've the simplest rule setup to turn the house outdoor Christmas lights on and off. But the off which should trigger at midnight doesn't. They stay on. But if I run the rule manually it turns them off.

I'm still reasonably new to Hubitat and while I'm extremely confident in the logic side of things, I've virtually no knowledge or experience of how I'd start to debug this. I've checked the logs and can see the switch did not receive a command to turn off. And I've just turned logging on for the triggers of the rule. What else do I need to do?

Triggers
Actions

Additionally, in the logs I see this:
dev:952020-11-30 00:01:10.217 infoFront Christmas Lights is on [physical]
dev:952020-11-30 00:00:00.774 infoFront Christmas Lights is on [digital]
dev:952020-11-29 23:56:10.070 infoFront Christmas Lights is on [physical]

This suggests that the rule is trying to switch the light on again doesn't it?

Interesting thought. If its for the coming sunset then that should still not match the if statement and turn them off. But is it actually using the sunset from the previous day (ie acting 24:00 rather than 00:00) while the time match is for the current day which would mean that sunset-60 of the previous day to 23:59 of the current day matching 30 or so hours, but just for the 00:00 time?

Why not just have a simple lighting rule to turn on at sunset-60 and off at midnight? Using RM seems unnecessarily complicated. Alternatively try changing the trigger to 12:01 am as a test.

1 Like

I'm going to add additional lights and switches into the rule. This was a starting point.

I've added a trigger for 00:05 and will see what happens tonight.

Thanks furom, I've had a look through and although similar in terms of trigger this seems to relate more to nested if's rather than the 00:00 trigger itself.

1 Like

try this it should be simpler
image

3 Likes

In general I would not select a time right at a transition: i.e. 12:00 AM or 12:00PM or 00:00 nor 24:00 (if this is actually valid).
I would as a minimum shift by a second or 10.

2 Likes

Another vote for Simple Automations app.

Using a rule is silly when there is an app dedicated to this exact situation. You are using a sledgehammer on a picture nail with Rule Machine. It might work, but use a more appropriate tool.

1 Like

i would do this in 2 different Simple Automations

  1. on at sunset -60 minutes
  2. off at midnight

less overhead for the hub (negligible when running a few rules, but can take a toll if a lot going on)

1 Like

In 2.2.4 this can be done in 1 automation now (previously needed 2).

I find it disappointing that you respond in this way rather than looking at the evidence of a bug. As I mentioned just 4 posts above yours I'm going to be adding complexity to this. I've been in software development for 22 years and I feel comfortable using RM and, in fact, it's the main reason I bought into hubitat. I understand there are other apps that can be used for this but this is my preference.

So I updated the rule to log what it's doing:

And it does appear there is a bug with 00:00 in Rule machine (and specifically the mechanism for finding the sunset time):
app:1462020-12-01 00:05:00.192 infoTurning Lights Off - Current Time: 00:05:00.191 - Event Date: 01-Dec-2020 - Event Time: 00:05:00.108
app:1462020-12-01 00:05:00.122 infoChristmas Triggered
app:1462020-12-01 00:00:00.336 infoTurning Lights On - Current Time: 00:00:00.334 - Event Date: 01-Dec-2020 - Event Time: 00:00:00.107
app:1462020-12-01 00:00:00.132 infoChristmas Triggered

How is it best to report this?

It is possible that your time restriction of 23:59 is far too close to 24:00 (23:59.99999 is still 23:59 as far as the rule is concerned). I'd try one last change to 23:58 prior to reporting this as it seems to me to now be a case of slight timing mismatches.

A trigger is a different scenario as it should happen as the clock just ticks over the trigger time.

1 Like

Its worth a try although the logs state that the event started at 00:00:00.107 so I'd assume the rule should have rolled and not been caught by a 23:59.99999 bug.

I've set it to 23:58 and I'll see what it does tonight.

Please post logs as screenshots. Also. please post the App Status page (gear icon), where it shows Event Subscriptions and below where it shows Scheduled Events.

1 Like

sweet, i haven't had too much of a chance to play with 2.2.4 yet since i was on vacation. planning on playing with that over the next week

2 Likes

your location is set properly for the hub, right?

2 Likes

Thanks for replying Bravenel. Please see the event subscriptions and the scheduled events below:


Yes, bang on and the sunrise / sunset time is accurate: