Hi
I have a dzVents script that performs the same tasks 2 or 3 times depending on whether it was triggered by a timer or by one of a number of devices.
Is it possible to define a function within that script which I can call repeatedly for each case?
I know you can create global "helper" functions, but I'd prefer to keep it within the one script file.
Thanks
Function within dzVents script? [Solved]
Moderator: leecollings
Re: Function within dzVents script? [Solved]
For sure
Have a look to the example below
you can call this function from your code like you do with helpers.
Have a look to the example below
Code: Select all
return {
...
execute = function(dz, item)
local function myFunction(variable)
...
do your stuff
...
return result1, result2
end
local a, b = myFunction(myVariable)
...
end
}
Raspbian Buster on Raspberry pi 3 B+ Domoticz Version: 2023.2 (build 15474)
Who is online
Users browsing this forum: No registered users and 1 guest