Turning on a light when it is dark out (but not before 9am)

I feel this should be simple, but I can’t get it to work right. Often at 9am it’s still dark enough outside to want an inside light on (despite it being after sunrise).

I’m trying to do this with the built-in Routines feature. What appears to be happening is that the light will turn on, but only if illuminance transitions below 150 during the 9am-9pm timeframe. Meaning it has to brighten up above that threshold (unlikely on a winter morning), and them dim below 150 for the Routine to finally trigger.

Is there anything I can tweak in the Routine to fix this? I’m trying to avoid over-complicating it with virtual switches.

BTW the “For 1 minute” was just me trying various settings - the behavior is the same either way.

This is on a V2 hub if that matters.

Thanks for any suggestions.

Swap precondition and condition


Precondition if Illuminance eaual or less than 150lux
Condition

I tried that, but it won’t let me remove precondition from the time range clause (the option is not shown at all) and if I change the illuminance clause to a precondition it won’t let me save because now I don’t have any non-preconditions.


Don’t do time range, do at specific time

How are you using location modes? At our house, we have something very similar, but instead of using a specific time frame, we have it set to run during our “home” mode, which is set from sunrise to sunset as long as someone is home. So it’s our daytime light rule. :thinking:

Also if you want your light to come up at 9pm regardless of Illuminance add those Fast Actions


With those you can mix sunset/sunrise with specific/periond of time

Wouldn’t that cause the light to only come on if it is dark at 9am? What if it is bright at 9am then darkens at 10am?

I would have thought this would be a common use case, but maybe it’s too complex for SmartThings Routines.

The developers are in CA, maybe they don’t get heavy enough clouds like here in WA :smiley:

Oops, I completely missed 9am part

I use them for Home and Away, but those are tied to our locations (2 of us), rather than how bright it is outside.

No worries. I had wondered what the Routines on each device’s page were for (they are not the same as Routines under Automations).

Understand, I’m talking more about using that as your time frame, not as the illuminance.

Your first routine is enough to turn the light on when it is dark, but you will have to do another one to turn it off if it is already light

You just have to define what is dark and light for you and translate it into two routines, one to turn off and another to turn on the light

Update:
It would need a quick routine that turns it on at 9:00 and at 9:01 it will turn off if there is enough light

They are quick routines, which are available through a slightly different architecture if you have an android phone. I don’t think they are available on iOS phones. They’re supposed to be the most common choices for that device.

I have a separate virtually-identical routine to turn the light back off if it gets light during the timeframe but that’s not the issue. Turning off if bright works for the most part because on any given day the brightness will usually at some point cross the 200 threshold that I have for turning the light back off again.

It is the turning on part that is giving me problems. My routine is identical to your first screenshot, but if illuminance is already below the threshold (150) at 9:01 am (which it often is in winter) it does not turn the light on, and will never turn the light on until the illuminance goes above 150 and then drops below 150.

I would create a virtual switch, called “is light outside” or “is dark outside”, and put all the rules about what that means into routines that turn it on and off accordingly. Then another rules I would just look at the state of the virtual switch rather than having that logic spread out everywhere.

2 Likes

It would need a quick routine that turns it on at 9:00 and at 9:01 it will turn off if there is enough light

That’s probably the way to do it, I was just trying to keep it simple (by making it complicated :smiley: )

Ah, that might work, I’ll look in to it, thanks.

I do something similar to define what is “Nighttime” and then use that as a precondition to determine the behavior of motion detection and button press on my GE Motion/Dimmer switches. Works really well and allowed me to transition off of Smartlighting with the added benefit of the Routines running locally.

Yep, it also means that the transitions (was dark, is now light) are events, which may help other rules “fire” correctly as its evaluated at the moment they change state.

1 Like