Sunrise-Sunset and Calendar functions for edge

Hi @Mariano_Colmenarejo ,

Has anyone come across an issue where the offset doesn’t allow a negative value? See below where I don’t have that option:

@Mariano_Colmenarejo - wow, thanks for your work. I understand this, but obviously, it had not occurred to me. From a logic point of view - it doesn’t make sense to be like this, so I agree that the Smartthings team should have a look at the strange behaviour. (I actually had faced the problem with a lux sensor in the past and was stumped - ended up removing lux from the Routine and based it solely on time, which is not ideal).

I thought I would fix it by following what you did, but in my case, I probably cannot as I have three conditions for three different irrigation switches which do not all go on at the same time so need to be OR. What I will do is:

  1. Remove the Precondition, i.e. set the Condition (currently a Precondition) as a Normal Condition. Save.
  2. Change the Operator from OR to AND. Save.
  3. Re-set the days’ range condition to a Precondition. Save.
  4. Change the operator back to OR. Save.

Hopefully, it will work like this - but I have doubts. I will keep you informed.

@andresg - please let us know if this is going to be fixed.

I have done all of the above in my last post, and now will wait for the conditions to kick in - that will be this evening.

Hi @johnconstantelo

This had already happened once before and we considered it resolved, on android it’s fine.

You can write negative value in another app or chrome, copy and paste it in the offset field

Now that’s a good idea, thanks! I was on my Android phone when I tried, but I’ll try another device too.

1 Like

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?

This post was flagged by the community and is temporarily hidden.

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