Can someone please explain "time periods" and how to do 24x7 room lighting?

I'm trying to do something rather simple but I'm having a really hard time understanding how to do it with Room Lighting, specifically because "time periods" are vexing: the terminology of a "period" implies there's a beginning and an end, but I just can't seem to grok how to understand the start and end for each period given the UI and docs only let you set a single bound.

I want a light that has 3 period, where one of them crosses the midnight boundary so I'll describe it with a single 24hr cycle:

00:00 - (sunrise) => overnight
(sunrise) - (sunset+60min) => general daytime
(sunset+60) - 23:00 => evening
23:00 - 24:00 => overnight (same as above, so really 23:00 - sunrise-of-the-next-day)

My goal is to have an automated RGB nightlight that uses a combination of motion detectors and door sensors to activate, automatically turn off (subject to some criteria), change RGB color (red overnight, 3000k during day), and change intensity (varying percentages).

You may want to consider using Modes. You have described your "Modes" perfectly.

2 Likes

A time period simply stays true until another time period takes over. So the first time period "general daytime" starts at sunrise. The second time period "evening" starts at sunset+60 minutes. It stays true until the third time period "overnight" starts at 23:00 and ends when "general daytime" begins.

EDIT: And I believe Modes work the same way, but then allow you to use them in other rules. I would use Modes.

1 Like

So I started my journey using modes and moved away from them for a few reasons: it got a bit weird with the complication between presence (which of a handful of devices are home), timing (the aforementioned times and 24hr cycle), and overriding commands (have I manually put the system into "alarm set"?) to handle simple lighting that I happen to always want on a plain schedule.

Assuming I ignore the initial day / period when I create the rule, I'm reading the consensus here, "the time defined in a period is simply the trigger to transition into this new period from whatever it was in before with no regard for the midnight crossing." Unfortunately I'm actually here having kicked off this thread because I had a rule that was three simple periods and it consistently would never do the "general daytime" portion. The other two periods worked great.


here's my new attempt at a rule from scratch. let's see how it goes!

That should work how you expect it too, though you don't show the triggers or ways to turn off the lights. But during the day it'll be 100% and white, in the evening 100% and red, and at night 13% and red.

I started with modes and moved away from them too in Room Lighting. I found that I always wanted more time periods that modes. For example, I tend to put a mode that goes from sunrise - 30 to sunrise +30 that's a little brighter than nighttime, but not as bright as daytime as a sort of transition period so one minute its' not low ambient light and the next minute it's super bright, Especially since I was just waking up around this time and my eyes need more time to adjust in the morning. I know there are "transitions" built in, but I never figured out how to use them right so I just make my own.

Broadly, my modes are morning, day, night, sleeping. One thing you can do that I plan on doing and just haven't yet is to use variables as the start time. So for example, my hub goes into sleeping mode either at 2am or if I manually trigger my goodnight routine. I could set the current time to a SleepingTime variable when the goodnight routine is run and then use that time to start a time period in RL.

I want this to be OR() functions to trigger and AND() to turn off, which I don't think I've figured out yet. "Activate the light if a specific motion sensor goes active OR if a door contact opens. Leave the lights on until the motion sensor shows no activity for 10 minutes and the door has been closed for 5.""


^ this

So you can't really do an AND for the turn off because of how the system is event driven. Consider this scenario: You open the door intending to go into the basement. You open it about a foot when for whatever reason, you decide "I don't want to go into this room after all" so you shut the door.

The light will turn on when you open the door from the contact sensor but if the turn off is an AND they will never turn off. We are going to assume you did not go into room far enough to trigger the motion sensor. The part of the off trigger that matters most is the becomes inactive. If the motion was never active, it cannot become inactive. So these lights would stay on.

What you can do is this.

That doesn't give you the two separate timers, but there is a way around that too. You could use a hub variable. In fact, this nearly exact same scenario is why I made a feature request to have this added a while back and Bruce was nice enough to put it in.

What you'd need to do is create a variable called something like BaseCabLightTime. Create a new rule in rule machine with the logic you want to set the variable time. Then in the means to turn off you'd select variable elapsed time as the means to turn off.

2 Likes

interesting. For now I'm happy to set both timers to the same value, for the record. Ill play with the adjustments you've got here... actually, the activation still isnt working so I'm going to simplify things to a pure countdown timer for now and then come back to the shutoff logic once I have activation nailed.

So I’ve simplified my rules to be “when motion, turn on, leave on for 10min since last activation event”

With that simplification I’ve determined my confusion stems from the light not activating property if I spec a Color Temperature (I thought the problem was time periods when it’s actually the CT call itself that’s not working, thus I don’t see my light coming on). I’m only using CT mode during my daytime (trying to get 3000k). Both my later periods use RGB mode to set pure red with two levels of brightness. The CT completely fails, the reds both work flawlessly.

If I go over to my device and manually set a CT it works fine. So what’s different about how the lighting app initiates a CT call compared to issuing it from the individual devices tab?