04.10.2017, 14:50
(This post was last modified: 04.10.2017, 14:50 by Erwin van der Zwart.)
Hi Gert Jan,
Like this:
BR,
Erwin
Like this:
Code:
longitude = 6.0830219 -- Zwolle
latitude = 52.5167747 -- Zwolle
sunrise, sunset = rscalc(latitude, longitude)
sunrise_hour = math.floor(sunrise / 60)
sunrise_minute = sunrise % 60
sunset_hour = math.floor(sunset / 60)
sunset_minute = sunset % 60
-- get current data as table
now = os.date('*t')
-- system week day starts from sunday, convert it to knx format
wday = now.wday == 1 and 7 or now.wday - 1
-- time table Sunrise
sunrisetime = {
day = wday,
hour = sunrise_hour,
minute = sunrise_minute,
second = 0,
}
-- time table Sunset
sunsettime = {
day = wday,
hour = sunset_hour,
minute = sunset_minute,
second = 0,
}
grp.update('32/1/4', sunrisetime)
grp.update('32/1/5', sunsettime)
Erwin