Astro binding to move switches at sunset/sunrise

In an attempt to solve this problem in a way that I actually understand, I thought, I know … I’ll just be create multiple locations that I can reference all along the same latitude. If the longitude that I reference is 15 degrees apart from my own, then the sunset times of the other location will be an hour different (360 degrees / 24hrs per day = 15 degrees per hour).

Warning (Danger Danger) - The below is not tested as of this post! Use at your own risk.

So in my things file (sanitized in this example below for my protection) I now have:

astro:sun:home [ geolocation=“45.000000,-80.000000”, interval=60 ]
astro:moon:home [ geolocation=“42.000000,-80.000000”, interval=60 ]


astro:sun:minus60 [ geolocation=“42.000000,-65.000000”, interval=60 ]
astro:sun:minus45 [ geolocation=“42.000000,-68.750000”, interval=60 ]
astro:sun:minus30 [ geolocation=“42.000000,-72.500000”, interval=60 ]
astro:sun:minus07 [ geolocation=“42.000000,-78.250000”, interval=60 ]
astro:sun:minus05 [ geolocation=“42.000000,-78.750000”, interval=60 ]
astro:sun:plus01 [ geolocation=“42.000000,-80.250000”, interval=60 ]
astro:sun:plus05 [ geolocation=“42.000000,-81.250000”, interval=60 ]
astro:sun:plus10 [ geolocation=“42.000000,-82.500000”, interval=60 ]

Then if I want to turn on a light, say 60 mins before sunset I can simply:

//  Stairwell Lights On at Sunset - 1 hour.
rule "Stairwell Lights On - Sunset - 1 hour"
when
    Channel 'astro:sun:minus60:set#event' triggered START    
then
    sendCommand(swStairway, ON)
end

It looks like this should work out well until I can figure out how to do the offsets in a file. In the end I might not want them there but I don’t understand how to use them as they are - or even how to reference them if I define them.

Bruce

3 Likes