Logic Machine Forum
Modifying (writing) LM system date/time - Printable Version

+- Logic Machine 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: Modifying (writing) LM system date/time (/showthread.php?tid=2576)



Modifying (writing) LM system date/time - SigmaTec - 13.04.2020

Hi all,

is there any way in Lua to update the LM system date/time in order to adjust it with a script ?

Many thank's in advance for your help.

All the best from France.


RE: Modifying (writing) LM system date/time - balatis - 13.04.2020

(13.04.2020, 09:46)SigmaTec Wrote: Γεια σας όλα,

υπάρχει κάποιος τρόπος στο Lua να ενημερώσετε την ημερομηνία / ώρα του συστήματος LM για να το προσαρμόσετε με ένα σενάριο;

Πολλοί ευχαριστώ εκ των προτέρων για τη βοήθειά σας.

Όλα τα καλύτερα από τη Γαλλία.
Hi 
I use resident script rate 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
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('9/1/3', time, dt.time)
grp.write('9/1/2', date, dt.date)


RE: Modifying (writing) LM system date/time - SigmaTec - 13.04.2020

Hi Balatis,

thank's for your answer.

But I don't want to read and copy date/time in a LM object as in your script (I know how to do that), that I want is to modify (write) directly the system date/time internal to the LM, because after a long inactivity this system date/time is erased in the LM and I want to offer a possibility to my end users to update it with a script, not with the admin login and the classic LM menu.

Hoping it's more easy to understand my question now !

All the best.


RE: Modifying (writing) LM system date/time - admin - 13.04.2020

See this: https://openrb.com/example-change-timedate-from-lua-script-on-lm2/


RE: Modifying (writing) LM system date/time - SigmaTec - 13.04.2020

Perfect Admin, as usual !


RE: Modifying (writing) LM system date/time - Carlos Padilla - 13.04.2020

(13.04.2020, 16:43)SigmaTec Wrote: Perfect Admin, as usual !
Yo see too this topic https://forum.logicmachine.net/showthread.php?tid=2207