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.

KNX 19.001 datatype
#2
(19.04.2019, 19:58)KristianSl Wrote: Hi
I`m trying to write time and date to a group adress with datatype 19.001. Have been looking in the example: http://openrb.com/example-write-lm2-data...addresses/
but can`t really see there how I`m supposed to Write the actually value to the Group adress. (I`m really new at this Undecided )

Can you help me?

-Kristian

Use the code below and modify as needed

Code:
-- 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
time = {
day = wday,
hour = now.hour,
minute = now.min,
second = now.sec,
}

-- date table
date = {
day = now.day,
month = now.month,
year = now.year,
}

--- full date bits
OCT08 = now.year - 1900
OCT07 = now.month
OCT06 = now.day
OCT05 = bit.bor(bit.lshift(wday, 5), now.hour)
OCT04 = now.min
OCT03 = now.sec
OCT02 = 0 -- subfields like working day and dst not specified in this sample
OCT01 = 0 -- subfields like quality of clock not specified in this sample

-- write to bus
date_time = string.char(OCT08) .. string.char(OCT07) .. string.char(OCT06) .. string.char(OCT05) .. string.char(OCT04) .. string.char(OCT03)  .. string.char(OCT02)  .. string.char(OCT01)
grp.write('Date', date, dt.date)
grp.write('Time', time, dt.time)
grp.write('DateTime', date_time)
Reply


Messages In This Thread
KNX 19.001 datatype - by KristianSl - 19.04.2019, 19:58
RE: KNX 19.001 datatype - by gtsamis - 19.04.2019, 21:36
RE: KNX 19.001 datatype - by KristianSl - 21.04.2019, 21:43
RE: KNX 19.001 datatype - by zuuper - 19.12.2019, 13:48
RE: KNX 19.001 datatype - by Daniel - 19.12.2019, 14:51
RE: KNX 19.001 datatype - by zuuper - 19.12.2019, 14:55
RE: KNX 19.001 datatype - by admin - 19.12.2019, 14:55
RE: KNX 19.001 datatype - by zuuper - 19.12.2019, 15:21
RE: KNX 19.001 datatype - by zuuper - 19.12.2019, 15:50
RE: KNX 19.001 datatype - by Daniel - 19.12.2019, 15:53
RE: KNX 19.001 datatype - by zuuper - 19.12.2019, 15:58
RE: KNX 19.001 datatype - by Daniel - 19.12.2019, 16:09
RE: KNX 19.001 datatype - by zuuper - 19.12.2019, 16:45

Forum Jump: