Yesterday, 05:43
Hi,
I'm having an issue with getting datetime. I used a script from the Logicmachine site:
Date and time works (0/0/2 and 0/0/1) but 0/0/3 gives no output.
What am I doing wrong?
I'm having an issue with getting datetime. I used a script from the Logicmachine site:
Code:
-- get current date as table
now = os.date('*t')
-- write to bus
grp.write('0/0/2', now, dt.date)
grp.write('0/0/1', now, dt.time)
-- system week day starts from sunday, convert it to knx format
wday = now.wday == 1 and 7 or now.wday - 1
--- 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, OCT07, OCT06, OCT05, OCT04, OCT03, OCT02, OCT01)
grp.write('0/0/3', date_time)Date and time works (0/0/2 and 0/0/1) but 0/0/3 gives no output.
What am I doing wrong?