Sunrise & sunset

3 replies [Last post]
aivo
Offline
Tallinn, Estonia
Joined: 2 Mar 2011

Found this script and adopted a bit for hah when was looking for a way to schedule Xmas lights on/off events.

Calling as /etc/plugboard/suntimes.  Added txt extension on attached and EOL is in Windows format.
Edit for your geographical location, from applet can be called e.g. like below:

local suntimesfile = "/tmp/suntimes"..os.date("%Y%m%d")..".txt"
local suntimes = nil
suntimes = io.open(suntimesfile, "r")
if suntimes == nil then
  os.execute("/etc/plugboard/suntimes")
  suntimes = io.open(suntimesfile, "r")
end
for line in suntimes:lines() do
  sunrise = string.sub(line, 1, 4)
  sunset = string.sub(line, 6, 9)
end

Regards,
Aivo

AttachmentSize
suntimes.txt2.18 KB
g7pkf
Offline
United Kingdom
Joined: 11 Jan 2011
Nice idea

But in the intrests of energy saving would it not just be better to start an on at sunset for X minutes? who wants xmass lights on for the whole night? a few hours would suffice and be "greener"

 

Dean

brett
Offline
Providence, United States
Joined: 9 Jan 2010
NICE but I think my beta idea is better

Aivo,

You posted just as I uploaded a beta with the makings of a built in scheduling engine you should give this a go.  Its' mucho easier than bolting an applet.

Brett

aivo
Offline
Tallinn, Estonia
Joined: 2 Mar 2011
I agree

Dean,

This was just to show how I would like to use scheduler :) .. our green setup would look smth like

"Weekdays at sunset x on y on"  -- on for evening (ca 15:40 today)
"Weekdays at 2200 x off y off"
"Weekends at 0630 x on y on"    -- on for morning (off ca 9:15 today)
"Weekends at sunrise x off y off"

Regards,
Aivo

Hardware Info