I have a script in dzVents turning every 2 minutes using a timer trigger. In that script, the first thing I do is check if a specific value is ON and if it is the case I peform some actions. The script looks like this:
Code: Select all
return {
active = true,
on = {
timer = {
'Every 2 minutes'
}
},
execute = function(domoticz)
if(domoticz.devices(automation).state == 'On') then
-- Perform some actions and checks every 2 minutes
end
endI was wondering if it would be possible to optimise this by triggering the timer call every 2 minutes only when the switch is ON, something looking a bit like that basically:
Code: Select all
return {
active = true,
on = {
timer = {
'Every 2 minutes' if domoticz.devices(automation).state == 'On'
}
},
execute = function(domoticz)
-- Perform some actions and checks every 2 minutes
endCheers