Is there any way to create a custom time period that only uses Sunset or Sunrise and not both?

Say I want my location mode to be set to ‘Evening’ if I come home between Sunset and 22:00, but if I come home after between 22:00 and midnight it should set it to ‘Night’.

Right now I can only set “If Geolocation = Home and Precondition = Sunset to Sunrise, Location = Evening” and “If Geolocation = Home and Precondition = 22:00 to 00:00, Location = Night”. But both of these overlap, because 22:00 is after sunset, so there’s no saying which will run first.

How do I possibly set this up to work correctly? Thank you! :slight_smile:

1 Like

I would create a virtual switch “Sunset - 22:00” with two routines:

  • turn ON at sunset.
  • turn OFF at 22:00.

Then add routines for:

  • Precondition If virtual switch ON (so we know its between sunset and 22:00)
  • If Geolocation = Home
  • Set Mode = Evening

And then:

  • Precondition If time between 22:00 and 23:59
  • If Geolocation = Home
  • Set Mode = Night
1 Like

Interesting! How do I create a virtual switch? I don’t see a ‘Labs’ option in my (Galaxy S21) phone.


You don’t have Labs under the 3 bar far right “Menu” option?

What country are you in? The labs options vary by region. :thinking:

Right now Germany.

In that case, do you have a SmartThings/Aeotec hub? And if so, which model?

Personally I feel this should be a feature of regular automation.

All my lighting should come on at Sunset +/- x minutes and then turn off at 23:00 at bedtime. It’s crazy to expect my interior lighting to either be dusk till dawn or regress to manually turn it off.

Of course it can.

Create a routine to turn it on at sunset plus or minus.
Create a routine to turn it off at 2300.

The OP was questioning it because they have staged logic within the time periods. A switch (virtual or otherwise) can always turn on and off at different time types.

1 Like

It’s easily doable with routines, it’s just that you need two of them, one to turn on and one to turn off. Which seems unnecessary, but it’s how they designed it. :thinking:

2 Likes

Aeotec… Smartthings Hub? I only found one. It has Matter and everything, so should be the latest one.

Excellent. If it’s the Aeotec hub, that’s the most recent one. So in that case, you can use an edge driver to create virtual switches that will run locally on your hub.

There are several popular ones created by the community, each with slightly different features. You can find all of them on the quick browse lists in the community- created wiki. Look for the list for “virtual devices.”

In all cases, you will follow a link that the author gives you, subscribe to that author’s channel, choose the edge driver you want to download to your own hub, and then wait.

It can take as much as 12 hours before it gets downloaded, but usually it’s quicker than that.

Once it is downloaded, then you can get to it through the app. The different drivers do have somewhat different instructions, so ask any further questions in the author thread for the driver you are going to use.

https://thingsthataresmart.wiki/index.php?title=Quick_Browse_Lists_for_Edge_Drivers

For the purpose as described in this thread of just creating a single virtual switch, I’d suggest starting with the following:

The first install of a driver happens within seconds. Its the later updates that can take up to 12 hours to propagate to all hubs.

1 Like

Yah, the needing two things to do one defeats the purpose to me. It’s needlessly complicating things.

1 Like

The Smartlighting app supports mixing Sunrise/Sunset with specific times. So, if that is supported where you are, it’s another option. Downside is that it doesn’t run local on your hub.

You might also be able to do it with SmartTools, but again, doesn’t run locally.

Haven’t looked at whether the Rules API supports it or not.

I prefer the method that @JDRoberts suggested and is what I migrated to from using Smartlighting.

1 Like

I’m not seeing where the old Smart Lighting app allowed mixing sunrise/sunset with specific times. If you create an automation to turn on at sunset, you can choose the toggle to also turn off at sunrise, but its just a toggle.

Regardless, the new “Smart lighting” (small L) replacement doesn’t support this feature. However, it does run local to your hub (at least for devices that are also local).

The old Smart Lighting smartapp will be sunset (see what I did there?) with the rest of Groovy/DTH.

1 Like

It definitely did, that was a very frequently cited advantage of using it.

I used to use it, and we had porch lights set to turn on from 15 minutes before sunset to 11 PM. :first_quarter_moon_with_face:

Also, the old groovy smart lighting was one of the only things that did run local, at least for most of its automations. Another frequently cited advantage. But I don’t know if that applied to something using Sunset. :thinking:

Yep, it did and still does as mentioned by @JDRoberts

Example:

1 Like

Well I’m not able to see how to do it with just simple on at sunset, off at midnight…

Im sure I’m overlooking something.

Oh you mean setting an “only during this time” prerequisite. That I can see allowing a mix between sunrise/sunset and a specific time.

I meant a “turn light on at sunset, off at XXX” type rule. I can’t make any automations that allow that on either version of the smart app now - maybe it was at one point.