Sunset and lights

Hey everyone,

I am new on Sharptools, but having a lot of fun so far.

So I was setting up a rule to turn on my light an hour before sunset. As soon as they are switched on, I want them to start fading from 100% to 60% over a period of 60 minutes and I want this to only happen when my phone is registered as being home.
I can easily make a different rule that says that when I come home after sunset the lights just turn on at 60% except for when there is already a scene running or lights turned on (girlfriend already home and having lights on).

All of the above I can manage on my own. The thing I run into is how to make a rule for the time between these two rules.

I can use a trigger for when I come home, but I can’t set in the flow a time period between, for example, 59 minutes before sunset to 45 minutes to sunset. In the flow I can set between times, but they are static times and don’t follow sunset. I don’t want to have my light turn on at 100% 5 minutes before sunset and I don’t want them to turn on at 5pm in the summer.

Is there a way to resolve this issue. (Not looking for minute to minute sollutions, but different settings for every 15 minutes is fine by me).

@Dutch_Drifter, welcome to the community. You can create another rule and update a TRUE/FALSE variable’s value as shown in the screenshot below. (You can name the variable whatever you want.)

Then in your light automation rule, you’ll check if this variable is true or not to decide if you want to turn to fade the light, or turn it to 100% or 60% directly based on you need, since this variable should only be true between 59 minutes before the sunset and 45 minutes before the sunset.

1 Like

Thank you for the welcome and the response.

So I am trying to wrap my head around it. This is a variable I can implement in my rule?

So I would leave my one hour before sunset triggered rule as is.

Make a new rule that triggers when I arrive home and then checks what part of the hour before sunset it is by using that variable.
Or does this only check once every 15 minutes?

Yes, you can create Variables in SharpTools and use them in both Dashboards and Rule Engine. See more details in the article below.

Can you post your rule just so I can make sure I understand it 100% and provides the correct feedback?

That’s right, if I understand your needs correctly. Use the arrival as the rule trigger, and an IF condition in the Flow to check the variable and take actions accordingly. The variable will only be true during 59 minutes before the sunset to 45 minutes before the sunset.

2 Likes

Thanks again

Variables sound like magic to me now. As in it sounds really cool and I have no clue how it works. Need to dive into that then.

The rule I have setup now is pretty simple and needs some more conditions to be added:

So the rule will pretty much become:

Trigger: coming home presence change.

Flow: if condition and: lights are off and use variable to check if it is between 59-45 min before sunset.

True: apply lights on settings and fade

False: if condition and: check lights are off and check if it is between 44 and 30 min before sunset.

Rinse and repeat.

That’s correct, and you may use a TEXT or NUMBER variable instead of multiple TRUE/FALSE variables to track the time periods before the sunset to keep things easier.

2 Likes

“That’s correct, and you may use a TEXT or NUMBER variable instead of multiple TRUE/FALSE variables to track the time periods before the sunset to keep things easier.”

Didn’t quite get this untill I was finished. I have a load of different variables now wich I could have reduced to one.

So far the result is:

Will bring this down to one variable.

This goes on trough every 15 minutes to sunset. After that it stays at 60% when i come home up untill sunrise.

I had to make a virtual switch in smartthings to report back if any light in the room is on. If one or more are it doesn’t switch the other lights on. When the lights switch on due to this rule, the virtual switch will also switch on. Will this be a problem?

I didn’t have to program the light to turn on. Adjusting the level turns the lights on automatically. Is this true for all smartlights?

Not necessarily. Most lights automatically come on when their level is adjusted, but it’s not technically required so I wouldn’t be surprised if there’s some light out there that doesn’t come on.

I don’t see why it would be an issue as long as that grouping works. :slight_smile:

I’ve noticed other community members using rules to group the status of lights into a variable. That way they can add the variable to their dashboard to easily the status of a group of lights. Sounds like the same concept you’ve applied with a virtual switch.

2 Likes

"I’ve noticed other community members using rules to group the status of lights into a variable. That way they can add the variable to their dashboard to easily the status of a group of lights. Sounds like the same concept you’ve applied with a virtual switch.”

I couldn’t figure out how to do that. I just now noticed I can probably see the lights on or off status by using the switch option changing to on on on the lights.

2 Likes

You could create another rule for aggregating status similar to this one from a different post by James:

Request: Link to Dashboard from Aggregated Data - #6 by James

2 Likes