Sunrise & sunset
29 November, 2011 - 19:05
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
Attachment | Size |
---|---|
suntimes.txt | 2.18 KB |
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