Basic Rules not completing past endtime

Hubitat C-7 ver 2.2.8.138

I have some basic rules that run based on time restrictions. I've reported another issue previously based on sunrise/sunset offset that was resolved. This is a new issue that I just realized has been going on for a while, but only just put it together as to what was happening. I created a test rule as a POC that seems to confirm it.

The problem is that when I turn on a light by motion then wait for a certian amount of time, the rule does not complete if that wait time is beyond the end time for the rule. I would expect this rule to complete after the elapsed time.

The test rule I created looks like this. On motion turn on the light. After 20 minutes, turn the light off. I set a time restriction from 11:00am until 11:10am, thus ensuring the time delay overran the restriction. The motion sensor last triggered the light at 11:06am and manually turned the light off about 11:45am, well after the expected 20 minute wait time to turn it off.

The logs are as follows:

app:1912021-07-22 11:06:37.226 am infoact: Wait Until elapsed time of 20 minutes has passed

app:1912021-07-22 11:06:37.201 am infoact: Turn on Office White Ecosmart Light

app:1912021-07-22 11:06:37.196 am infoevt: Office Motion Sensor motion active

app:1912021-07-22 11:02:11.989 am infoact: Wait Until elapsed time of 20 minutes has passed

app:1912021-07-22 11:02:11.912 am infoact: Turn on Office White Ecosmart Light

app:1912021-07-22 11:02:11.906 am infoevt: Office Motion Sensor motion active

app:1912021-07-22 10:57:29.865 am infoapp: When Office Motion Sensor activates …

app:1912021-07-22 10:57:29.863 am infoapp: initialized

app:1912021-07-22 10:44:45.064 am infoapp: When Office Motion Sensor activates …

app:1912021-07-22 10:44:45.062 am infoapp: initialized

A complication that exists is in my 'real' rules I have the same devices trigger differently after one set of rules ends at 10pm and the next starts at 10pm and runs until sunrise. A motion sensor and lights are 100% from sunset -50 to 10pm. These same devices from 10pm until sunrise come on at 30% on motion.

I get if this is a 'working as expected' thing. If that is the case, how do I work around this to make sure that, in this case, the lights are indeed turned off after 20 minutes even if its beyond the time restriction? Something like a 'Ensure this rule completes beyond the time restriction' option?

CC: @bobbyD

1 Like

I'm pretty sure this is how restrictions in Basic Rule are supposed to work--pretty naïve, but precise in that nothing will happen when the restriction is in effect.

What you could do instead is split this into two rules. Actually, it might be a good idea to take a look at this rules's actions first: with an automation like this, most people intend to keep the lights on for 20 minutes after motion stops, not after motion starts (otherwise, it will still turn off if motion remains active!). Assuming that's really what you want, you could split this into two Basic Rules, one that turns the lights on (started by motion active) and one that turns them off (started by motion inactive). Though now that I say that there is a UI oddity or perhaps intentional choice that doesn't let you add a "Wait" as the first action, but you can do something there (anything), create a wait, create an action to turn off the light, then remove that first action...assuming that works.

Or what I'd really recommend is using one of the built-in apps for this purpose instead, like Motion Lighting or Simple Automation Rules (which was originally called Simple Lighting and was geared for purposes like this, but it has the same issue with Restrictions, so I'd really look at Motion Lighting instead, which as a ton of options, including ways to restrict the "on" and "off" halves separately).