I have simle script to set "armed away" security state after 30 sec. And i want send notification about it, but afterSec(30) doesnt works with notify for me (domoticz latest betta). It sends notification instantly.
How i can get notification with delay?
Code: Select all
local SEC_BUTTON = 'knopka_test'
--local SEC_BUTTON = 'knopka_prihojaya'
local SEC_PANEL = 'Domoticz Security Panel' -- or the name of your Security Panel
local TIME_TO_ARMING = 30
return {
active = true,
on = {
devices = {SEC_BUTTON}
},
execute = function(domoticz, device)
local but = domoticz.devices(SEC_BUTTON).state
local sec_panel = domoticz.devices(SEC_PANEL)
if but == 'Click'
then
if (sec_panel.state == 'Disarmed')
then
domoticz.devices(SEC_PANEL).armAway().afterSec(30)
domoticz.notify('Security', 'Domoticz Arming in 30 sec!')
domoticz.notify('Security', 'Domoticz state: ' .. sec_panel.state).afterSec(35)
else
domoticz.notify('Security', 'Domoticz already Armed!')
end
end
if but == "Double Click"
then
if (sec_panel.state == 'Armed Away')
then
domoticz.devices(SEC_PANEL).disarm()
domoticz.notify('Security', 'Domoticz Disarmed!')
else
domoticz.notify('Security', 'Domoticz already Disarmed!')
end
end
end
}