09.07.2026, 06:52
(This post was last modified: 09.07.2026, 06:57 by Erwin van der Zwart.)
You can use updatetime for this..
grp.find('1/1/1').updatetime wil give you the unix timestamp that you can compare with os.time() to calculate the seconds the object has this value.
You can use storage to store this value when using event based scripts so you can fetch the value from storage from last event and then store new timestamp again.
You mentioned period usage, why not using a trend on a value and use trend.fetchone to get the usage over a set period?
https://kb.logicmachine.net/libraries/trends/
grp.find('1/1/1').updatetime wil give you the unix timestamp that you can compare with os.time() to calculate the seconds the object has this value.
You can use storage to store this value when using event based scripts so you can fetch the value from storage from last event and then store new timestamp again.
You mentioned period usage, why not using a trend on a value and use trend.fetchone to get the usage over a set period?
https://kb.logicmachine.net/libraries/trends/