Smart lighting and sunrise/sunset

First some background: I use the Smart lighting automation to turn on/off various z-wave switches based on a combination sunrise/sunset and offsets or fixed times and it has been working well. The on/off times shift as the daylight hours changes. Recently I added a Leviton wifi outlet plugged into a regular outlet in my detached garage as the z-wave signal was insufficient and I already had a wifi access point in the garage. Smartthings is linked to My Leviton using the linked services.

Here’s the problem: I noticed that the Smart lighting routine for the wifi outlet doesn’t change time each day. It seems to stick to the time on the day that I saved the routine. For example, I had the outlet turn on at sunset - 10 minutes. So that day it turned on at 9:05 pm, and it has turned on every day since at 9:05 pm. My z-wave switch on it’s own routine turned on at 9:05, then slowly earlier each day until last night it turned on at 8:59 pm. This is the behaviour I expect.

The other thing I see is that the name for the routine for the switch has the little house symbol with the check mark appear after the name which I assumed meant it ran locally in my Aeotec hub vs the outlet which doesn’t have the house symbol.

Why doesn’t the timing of the outlet work the same way as the switch?

Have you tried moving the wifi outlet to the routine with the switch to see if it turns on at the same time?

In recent months there have been reports of sunrise and sunset not updating in Smart lighting. They using Routines, as no problems have been reported with Routines.

It was getting on for two years ago that I reported that Rules were not updating sunrise and sunset daily (and Routines and Smart Lighting are implemented as Rules). This behaviour was immediately reproduced by the developer support team, though it was rather inconsistent. After several months of occasional nudging it was finally realised that there was a repeatable issue. Local Rules, which were the big thing at the time, were fine but cloud based Rules didn’t update. I had a Rule execute at 5:18am this morning. Sunrise was 5:18am this morning. Unfortunately the rule is supposed to run 31 minutes after sunrise. So it remains broken after all this time.

Fortunately it only really makes a noticeable difference for one Rule of mine, and that Rule is a bit crappy anyway. So I just reload the Rules from time to time. It only takes me a few seconds if I am on a laptop. I am not particularly happy about it and I really was intending to draw the line at the beginning of September this year and move elsewhere, but I doubt I will as I’ve invested too many hundreds and and thousands of hours in SmartThings and there are other interesting things to see now that the legacy stuff is finally on its last legs. It is just a shame that they just seem to have let the public Rules API rot in favour of the Noddy and Big Ears stuff for the app.


I have them separate right now because I actually have the switch set to a different offset time than the wifi outlet. But for testing purposes, I could live with them being the same.

Update: I added the wifi outlet to the working Smart lighting routine of the switch. The Save choice was not activated (so there’s a bug), so I went into the time settings, tapped on Sunset, tapped done without making a change, and then Save was active. I tapped Save, and when it went back to the list of Smart lighting routines, the icon of the little house with the checkmark was gone. If I remove the wifi outlet, the icon reappears.

I’m going to give @Paul_Oliver 's suggestion a try.

To get around the old bug with Sunrise/Sunset not being adjusted with Smart lighting, I just used a local virtual switch that turned on/off with Sunrise/Sunset via routines. Then Smart lighting routines can react to that instead. Works fine for anything you want to do +0 minutes or greater from sunrise / sunset events. Negative offsets of course don’t work.

1 Like

Good suggestion. That will work for my Sunset usage (positive offset) but not the sunrise (negative offset).

But what I don’t get is why does my z-wave switch work ok with sunrise/sunset under Smart lighting? And your virtual switch. But not a wifi outlet that is a linked service. You would think that a “device” is a “device” is a “device” and they should all work consistently regardless of what they truly are under the hood if you are just turning them on/off.

If your offsets are the same for several of your devices, just set the virtual to trigger at those times via the routine.

For example, if you want all your smartlighting sunrise/sunset events to occur at sunrise + 30 minutes and sunset - 45 minutes, then set your virtual to turn on/off via its direct routines with those parameters. It will adjust and do the offsets correctly and your smart lighting routines will be none the wiser.

I thought you said earlier that negative offsets don’t work?

You can’t do the negative offset in the smart lighting routine acting on the virtual (you can’t have a concept of reacting X minutes BEFORE a [virtual in this case] switch turns off).

But you can set the negative offset on the routine that TURNS the virtual itself off. When defining the routines that activate the virtual, you can do any positive/negative offsets on sunrise/sunsets you want.

In other words, you’re using the offsets in the routines to turn your “Sun is Out” virtual switch on/off. Not in the Smart Lighting routines to turn your porch light on/off.

Ahhh, got it now, thanks. I was tempted to just move it over to my Sharptools account. But I wanted to keep all the simple stuff that ST was supposedly capable of doing within ST, and the more complicated stuff to Sharptools.

It’s frustrating to have to work around things. And I only have 46 devices spread out among 2 homes on 2 hubs. I can’t imagine what some of you go through with hundreds of devices.

1 Like

I found like almost everything on this platform blow your device or routine away and recreate it. That will generally resolve the issue.

I reported the sunrise/sunset to support in January.
We went through the normal mindless logs and try this and offsets and are you sure you dont want a set time???

Recreate and everything works.

Well I switched the wifi outlet to it’s own routine in ST (not using Smart lighting), but I can’t declare it a complete success yet. The last 2 days, it did turn on at shifting sunset times, and turned off at a later time yesterday. But today it didn’t turn off at all. However, I think there was a problem with Leviton cloud services because I couldn’t even get in to the My Leviton app. So I will have to wait at least one or two more days to see if this is the fix.

Why cant I use sunset and time i n the same routine. I want some light turn on at sunset but turn off or change color on certain time.
How do I do that? It was possible in the old ST classic app.
Thanks for any suggestions.

You have to use 2 routines. One to turn on at sunset and one to turn off at a fixed time.

1 Like

Thanx, I will do that. I was hopping to minimize number of Routine. Its easier to debug.

Thanks @Paul_Oliver, you were correct. Using 2 routines (one for on, one for off) directly for my wifi outlet did the trick. It’s on/off times have been shifting as the days get shorter.

It’s kind of dumb that I have some routines in Smart lighting and others in the routines section of the device itself, but you gotta do what you can to get things to work. Need to create a spreadsheet that shows where everything is between routines, ST apps, and Sharptools.

For what it’s worth:

  • each automation in Smart lighting counts as one routine same as Routines.
  • There’s no difference between Smart lighting and Routines as far as local execution is concerned.
  • Automations in Smart lighting are not listed in the Routines tab of devices in the app
  • Automations in Smart lighting are listed under Lighting Automations in @TAustin’s SmartThings API Browser+ but it’s difficult to see what devices are affected
  • AFAIK, the only unique function Smart lighting can perform is to sync (mirror) devices.

I used to be a heavy user of the old Smart Lighting to get its local execution. Now that Routines will run locally, I’ve recreated all my Smart lighting automations as Routines except for a small number that sync devices.


I’ve helped people build Routines to do bi-directional sync’ing without having to use Smartlighting.

And you can create mirroring using Z-Wave Association Groups eliminating the need for Smartlighting for that type of device.

Are those done using the App or via one of the other interfaces. And have you been able to sync dim level from one device to multiple devices?

I’m about evenly split between Z-wave and ZigBee smart switches/dimmers and adding a third place where automations can be hiding isn’t my preference.