LogicMachine Forum
Send time in Group Address - Printable Version

+- LogicMachine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Send time in Group Address (/showthread.php?tid=4029)



Send time in Group Address - Bergman - 03.05.2022

Hi,

Are trying my first scripts.
Want to use time of the device and send as a 3-byte time of day in a group address.

I've been able to send date using os.date.
But i need help with the time. Tried os.time but couldn't use it in the same manner and now im stuck.  Shy

Anyone with a script lying around?

Cheers


RE: Send time in Group Address - Daniel - 03.05.2022

Resident or scheduled script
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, } -- write to bus grp.write('1/1/2', time, dt.time) grp.write('1/1/1', date, dt.date)



RE: Send time in Group Address - Bergman - 09.06.2022

Thanks, works perfectly.