property of active timer(name)
Posted: Wednesday 10 April 2019 20:12
Does dzvents has a property for the active timer, by example: Tuinirrigatie_gazon instead of the value of this timer
I like to shorten my script, by replacing all the IF ELSIF END by:
something like dz.devices(item.name).switchOn().checkFirst()
item.name must be: ' Tuinirrigatie_gazon' for example
I like to shorten my script, by replacing all the IF ELSIF END by:
something like dz.devices(item.name).switchOn().checkFirst()
item.name must be: ' Tuinirrigatie_gazon' for example
Code: Select all
--local Tuinirrigatie_border_links = 'at 19:00 on mon,tue,wed,thu,fri,sat,sun'
local Tuinirrigatie_border_rechts = 'at 19:15 on mon,tue,wed,thu,fri,sat,sun'
local Tuinirrigatie_gazon = 'at 20:05 on mon,tue,wed,thu,fri,sat,sun'
--local Tuinirrigatie_planten = 'at 19:45 on mon,tue,wed,thu,fri,sat,sun'
return {
on = {timer = {Tuinirrigatie_border_links,Tuinirrigatie_border_rechts,Tuinirrigatie_gazon,Tuinirrigatie_planten}},
logging = { level = domoticz.LOG_DEBUG ,
marker = "Timers irrigatie"},
execute = function(dz,item,info)
if (item.trigger == Tuinirrigatie_border_links) then
dz.devices('Tuinirrigatie_border_links').switchOn().checkFirst()
elseif (item.trigger == Tuinirrigatie_border_rechts) then
dz.devices('Tuinirrigatie_border_rechts').switchOn().checkFirst()
elseif (item.trigger == Tuinirrigatie_gazon) then
dz.devices('Tuinirrigatie_gazon').switchOn().checkFirst()
elseif (item.trigger == Tuinirrigatie_planten) then
dz.devices('Tuinirrigatie_planten').switchOn().checkFirst()
end
dz.log("Script: " .. info.scriptName .. " is aangezet ", dz.LOG_INFO)
end
}