Sunrise-Sunset and Calendar functions for edge

@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.

2 Likes

@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.

3 Likes

@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

Just made a test like you said and I got the notification, so it didn’t work :frowning:

I guess I have to wait a few days (months) until all is stable


The other day you mentioned a problem with the lower value when we are using limits.
And I guess the upper value has a problem to.

This worked (no notification)

So “upper value - 1” works :smile:
So, in november, my routine will finally stop :grin:

I tested the same and It works fine for mi

Deleted - moved to different thread

@andresg @nayelyz

There is some news about this erroneous behavior of routines that have a precondition and two or more OR conditions (any of the conditions is true).

We cannot use these routines with any capability, temperature, humidity
 since they behave like a multiple OR condition including the precondition as well.

If it is done with a precondition and one or more conditions type AND (that all conditions are met) then it works fine.

Maybe it would be good to create a separate thread for this problem so don’t forget it

Thanks

Hi.

I use rules rather than routines if there is any complexity involved and I’ve bumped into a little problem with sunset/sunrise. I want to be able to compare the current time with sunset/sunrise, but they are in different formats, so they never evaluate to true.

Capability Attribute Value
legendabsolute60149.sunRise sunRise “08:20:00”
legendabsolute60149.localHourTwo localHourTwo 749

Any ideas? I tried to evaluate against - time{reference: now} but it appears that it is only allowed to compare that to the internal time functions (sunset/sunrise/noon) and not to a device generated value.

Hi @mrfitz98

You have to use the sunset offset Time or sunrise Offset Time.

If you compare with sunset Offset time == 0 minutes then it means that the current time is exactly the sunset time of that day.

If Sunset Offset Time = 0 min then 

If Sunrise Offset Time = 0 min then 


You can also use x minutes before (-x) or x minutes after (x)

If Sunset Offset Time = -30 min then 

If Sunrise Offset Time = +60 min then 


With rules you must use capabilities

legendabsolute60149.sunRiseOffset1
legendabsolute60149.sunSetOffset1

Gah, so simple! Thank you.

1 Like

I suggest this long ago but it didn’t pick up any interest, instead of just sunset and sunrise and having to adjust offsets, it would be much better if we have the different twilights (at at least dusk/dawn) calculated.
Eg civil twilight, nautical twilight and astronomical twilight.

This is also useful for those located above the artic circle or below the antartic circle where the sun never sets during certain period of the year, eg Norway, Sweden, Findland and Iceland

Hi @Daijoubu

I don’t know if I understood it correctly.
I believe that the sunset and sunrise offsets are necessary and used in routines for many more reasons than the ones you describe.

I’m no expert, but I put Reykjavik’s coordinates in the virtual calendar and it calculates the same sunrise and sunset times that any weather page shows and I guess smartthings too.
I don’t know if they will be usable or will serve something throughout the year.

The calculation is Based on algorithm by United Stated Naval Observatory, Washington, from a public GitHub, I just adapted it for use at the driver edge.

  • This driver was done, because they announced that smart lighting app would disappear with groovy and in routines you could only advance or delay sunrise or sunset time by 60 minutes and here an offset of +/-10 hours was added.
  • Now it has not disappeared and sunrise and sunset can be delayed and advanced up to 23:59 hours with the smart Lighting app, in areas where it is enabled
1 Like

The idea is that for example during civil twilight, where there’s still enough light to do outdoor activities after the sunset, varies in length depending if it’s summer or winter, at my location it’s close to 30mins in winter but in the summer, it’s about 45mins.

In Iceland, during the 3 months of summer, it’s twilight all night after sunset (never gets dark)

So instead of hardcoding an offset, it would be nice if we can set an outdoor light to turn on only when it gets darker/darkest after the sunset depending on season.

2 Likes

Isn’t possible to create some state inside the calendar that act like a virtual switch when the time is between night and day?

My automation doesn’t work with the default sunset-sunrise, because it’s automatically created as a precondition, but if i create a virtual switch it works.

But since I don’t like to see a lot of virtual switch I would like if possible to be a state inside virtual calendar, like a 0 and 1.

I believe Virtual Calendar Mc from @Mariano_Colmenarejo will do what you want.

It may be useful to create a capability to activate day (sunrise to sunset) and night (sunset to sunrise) routines.
Let’s see if I have time to do it

1 Like

@h0ckeysk8er the closest thing that the Virtual Calendar Mc has it’s sunset and sunrise with a condition that equals to 0 but in my case that doesn’t fit the needs. But thank you for the suggestion! :slight_smile:

@Mariano_Colmenarejo What you described it’s exactly what I was thinking, that would be perfect! Thank you :slight_smile:

1 Like