persistent data and Time object & functions

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
ricorico94
Posts: 94
Joined: Monday 26 October 2015 10:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

persistent data and Time object & functions

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests