I'm trying to build an alarm script in DzVents and want to turn on the Siren for 10sec, then 5sec off then 10sec on etc etc so lang a dummy switch "Alarm_BG" is turned on.
I was thinking that repeatAfterSec could help me with that.
This is what i have so far, not very much but it's just a start.
Code: Select all
return {
on = {
devices = {
'Alarm_BG'
}
},
execute = function(domoticz,trigger)
if domoticz.devices("Alarm_BG").state == "Off" and domoticz.devices("Sirene").state == "On" then
domoticz.devices("Sirene").switchOff()
elseif domoticz.devices("Alarm_BG").state == "On" then
domoticz.devices("Sirene").switchOn().forSec(10).repeatAfterSec(16, 30)
end
end
}