Sunrise-Sunset and Calendar functions for edge

You should be sleeping at this time, so that the neurons are cooled :wink:

1 Like

Lol, I’m an early riser and have already been at the gym! Back to bed though for a little sleep. Hopefully I’ll awake to no more craziness with ST and undocumented changes…

1 Like

Hi @Mariano_Colmenarejo and @andresg

I tried with this method and it didn’t work for me. The difference between my Routines and Mariano’s is that I reset the operator back to OR after setting the range to a Precondition, because in my case I need the Routine to run every time that any one irrigation switch goes on (not when all irrigation switches are on at the same time as that never happens).

So basically, I will “resolve” it now, temporarily, by disabling all my routines bar one (the Summer one), but in my view it is a bug and a serious logic flaw of the Routines.

Hi @martin.borg

Yes, I tried two devices with a OR condition and the precondition with intervals check always works as OR condition too instead a precondition.

For now, you can try a virtual switch that turns On when any of the irrigations is On.
So you do the routines with just the period precondition and the virtual device.

Then in each routine, when you put the irrigation Off, you also turn off the virtual switch so that it fires again the routine when another irrigation is activated.

1 Like

Yes - this sounds like a good workaround. Thank you :pray:

It’s important for @andresg though to understand that what I will have is a workaround and it is a bug, and the Smartthings team should acknowledge it and schedule it for a fix.


This driver has been added to Virtual Appliances Mc, in order to reduce the number of drivers in hub.

In this link is the steps to change this device to the Virtual Appliances Mc without Lost any Routine or scene.

I don’t use “Virtual Appliances MC”, so I’ll keep this driver.
You will not delete it, right?

I don’t have in mind to delete anything, don’t worry

1 Like

Hi @Mariano_Colmenarejo - just to let you know that it is working, for now, with a virtual switch as you suggested, and the respective schedules switched to Autumn yesterday as expected.

@andresg, has the Smartthings team acknowledged the existence of a bug in this case? I have changed Account Data Access to say “Until Turned Off”, but should I keep it on ow? The problem is that I have had to change these rules in order to get them to work, so they are barely useful to you now. However I am certain that what @Mariano_Colmenarejo explained in the example he gave is currently a universal behaviour and if you do an example like @Mariano_Colmenarejo’s, you will certainly have the same outcome.

I’m trying to make a routine that will turn on a light if the time is between sunset and sunrise, but it does not work.

Then I removed the sunrise option and the pre condition of the motion sensor and worked.
So why can’t I use it with the pre condition???

Will I have to make 2 routines?? One for each offset? Since the pre condition is not working, I can’t see another way to do it…

Is very easy!
Try this routine

1 Like

Yes, first tests worked ok.
Since I use your driver, I guess I forget the other options :grinning:

I’ll keep testing.

1 Like

Ok, I’ve looked at this for awhile and I still don’t see a way to create a single routine to do something for a time range like 10:00pm to Sunrise or 45 mins before Sunset till 1:00am. Anybody else got routines like this working?


With a single routine you can’t do it.
It can be done with smartLighting, if it’s available in your location and since we know it won’t go away with groovy

Yeah, I’m doing it currently with SmartLighting but was hoping to get away from using it and just do Routines. I keep hoping that the stock routines would add this capability, but doesn’t seem to be in the cards right now.


@Mariano_Colmenarejo, @martin.borg & @montyfert, sorry guys I am just answering this. I agree with you that this is a counter intuitive behaviour, and this was reported to the team. @Mariano_Colmenarejo great job finding the error.


@andresg I have had to remove the Routines in question as I needed to move them to SharpTools
after I hit the dreaded 200 limit, so you won’t find my respective Routines in there regrettably. Hopefully, the team has understood what’s wrong with it and can fix it without Routines.

Hi, @martin.borg

Thank you for letting us know. We noticed that, nevertheless, @Mariano_Colmenarejo find the clue on what the root cause was, so now the focus of investigation is different, and maybe we don’t need those examples anymore.


@Mariano_Colmenarejo can you understand why this routine was executed today?

It should have stopped yesterday…

It should have stopped yesterday if the routines worked well, but unfortunately they are making changes daily and stop working some things and solve others.

They have added the intervals and they do not work well, other days the comparison equal to has not worked.

The driver is sending a value 10, (October)

Try to do it with local month >=5 and local month two <=9, this works today, tomorrow I do not known