Page 1 of 1

dzvents script does not trigger

Posted: Monday 08 October 2018 18:42
by manjh
I am very sure this is a solid user error on my side, but I have been staring at this for a while and simply donot see what is wrong.
I want to create a dzvents script that is triggered every minute.
Using the Domoticz editor, I created a script:
Name "test", type "dzVents", triggered by "all" (I also tried "timer")

Code could not be simpler:

Code: Select all

return {
	active = true,
	on = {
		['timer'] = 'every 1 minutes'
	},
	execute = function(domoticz)

		domoticz.log('@@@@@@@@@@@@@@@@@@@@@@@@@@ test', domoticz.LOG_INFO)

	end
}
I expect to see the line of text every minute, but nothing happens.
Checked in Setup-->Settings-->Other: dzVents is enabled, log is on "Errors+forced messages".

As said, I am sure I am missing something but I don't see it.

Help?

Re: dzvents script does not trigger

Posted: Monday 08 October 2018 19:22
by dannybloe
Please look at the timer examples in the documentation carefully. You have to use the proper syntax:

Code: Select all

on = {
    timer = { 'every minute' }
}

Re: dzvents script does not trigger

Posted: Monday 08 October 2018 22:00
by manjh
dannybloe wrote: Monday 08 October 2018 19:22 Please look at the timer examples in the documentation carefully. You have to use the proper syntax:

Code: Select all

on = {
    timer = { 'every minute' }
}
Thanks, makes sense. It was a user error, but in my defense: I "borrowed" a script from the forum and inherited the error... :mrgreen:

It now stumbles over this statement:

Code: Select all

local minutes = domoticz.devices[name].lastUpdate.minutesAgo
Error is "attempt to index field 'devices' (a function value)".

Re: dzvents script does not trigger

Posted: Monday 08 October 2018 22:14
by manjh
Sorry, got it. Similar mistake.
This one works:

Code: Select all

local minutes = domoticz.devices(name).lastUpdate.minutesAgo