Saving a date - 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: Saving a date (/showthread.php?tid=73) |
Saving a date - RSV4 - 03.09.2015 Hi all, what is the best way of saving a date within the LM? Saving it in a group address? I could check this myself tonight, but will ask this now anyway: Is the required data type 11.001 and/or 19.001 (date with time) available in the LM3? Best regards, Robin RE: Saving a date - admin - 03.09.2015 Depends on your task, you can use group address (both date and time types are supported) or save to storage (you can save either a formatted string or Lua table). This example might be useful: http://openrb.com/example-write-lm2-datatime-to-knx-group-addresses/ RE: Saving a date - RSV4 - 03.09.2015 Perfect, thank you. Will use group address as in your example. RE: Saving a date - gtsamis - 11.06.2018 (03.09.2015, 09:11)admin Wrote: Depends on your task, you can use group address (both date and time types are supported) or save to storage (you can save either a formatted string or Lua table). Can you please provide the grp.write function for DPT 19.001 to use with the above script RE: Saving a date - Erwin van der Zwart - 11.06.2018 Hi, DPT 19 is not available in the controller, only way to do it is to use the 250 byte object (raw dpt) and build the telegram yourself. You can try this sample, it's not 100% filled according the standard but for time and date it should work, if you want it 100% correct you need to complete OCT2 and OCT1 Code: now = os.date('*t') Erwin RE: Saving a date - admin - 12.06.2018 You should use bit operations Code: OCT05 = bit.bor(bit.lshift(now.wday, 5), now.hour) RE: Saving a date - Erwin van der Zwart - 12.06.2018 (12.06.2018, 07:08)admin Wrote: You should use bit operations I was looking for this but could not figure it out so soon, the solution with functions works but your solution is cleaner (: I updated the sample Thanks! BR, Erwin |