Page 1 of 1

persistent data and Time object & functions

Posted: Tuesday 18 April 2023 23:59
by ricorico94
Hi,

I used to have dzvent script working in a former version of DZvents (in 2021.xx of domoticz).
The script was using statements like:

Code: Select all

data = {
	     resetUPS = {initial='Off'},
	     lastReset = {initial=""}
	},
[...]	
	local now= Time()
	dz.data.lastReset = now
if (dz.data.resetUPS == 'On' and dz.data.lastReset.minutesAgo < unplugduration) then

So I was getting Time information in a persistent data variable and I was using ".minutesAgo" to measure time since last update of this variable.
I had no error message..
So was I just lucky that it worked despite it shouldn't ?
Now, with DZvents 3.1.8 in Domotice 2023.1, I can't use anymore functions like minutesago, getiso, etc.
I couldn't understand from the wiki if the persistent data behave like objects or Global Variables, so if anymore could explain to me what's possible or not with persistent data, I'd appreciate. Or if you have scripts using persistent data and Time objects, they'd welcome..
Thanks
Ricorico94