This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

3 byte date/time
#3
(04.10.2017, 14:50)Erwin van der Zwart Wrote: Hi Gert Jan,

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)
BR,

Erwin

thanks
Reply


Messages In This Thread
3 byte date/time - by gjniewenhuijse - 04.10.2017, 14:12
RE: 3 byte date/time - by Erwin van der Zwart - 04.10.2017, 14:50
RE: 3 byte date/time - by gjniewenhuijse - 04.10.2017, 14:52
RE: 3 byte date/time - by Mrinj - 23.10.2017, 16:55
RE: 3 byte date/time - by Erwin van der Zwart - 23.10.2017, 17:18
RE: 3 byte date/time - by gjniewenhuijse - 24.10.2017, 06:26
RE: 3 byte date/time - by Erwin van der Zwart - 24.10.2017, 06:54
RE: 3 byte date/time - by Mrinj - 23.10.2017, 19:23
RE: 3 byte date/time - by admin - 24.10.2017, 06:46
RE: 3 byte date/time - by gjniewenhuijse - 24.10.2017, 06:51
RE: 3 byte date/time - by gjniewenhuijse - 24.10.2017, 06:59
RE: 3 byte date/time - by Mrinj - 24.10.2017, 19:38
RE: 3 byte date/time - by Erwin van der Zwart - 24.10.2017, 20:00
RE: 3 byte date/time - by gjniewenhuijse - 25.10.2017, 06:03
RE: 3 byte date/time - by admin - 25.10.2017, 06:41
RE: 3 byte date/time - by gjniewenhuijse - 25.10.2017, 14:57
RE: 3 byte date/time - by admin - 25.10.2017, 15:46

Forum Jump: