Page 1 of 1

Delay for sending alarm

Posted: Saturday 10 August 2019 21:37
by teemurama
What / where I should set .afterSec(10) when I want alarm started with 10 sec delay.

I have now code like this,

Code: Select all

return
{
    on  = { 
                devices = { 'Kuisti' , 'Porch movement' }
          },
          
    execute = function(dz, item)
        
        local alarm = dz.devices('Xiaomi Gateway Alarm Ringtone')
        local gateway = dz.devices('Xiaomi RGB Gateway')
        
        if item.active then
            dz.notify("HÄLYTYS ULKO-OVI","Ovihälytys",dz.PRIORITY_EMERGENCY,nil,nil,dz.NSS_PUSHOVER)

Re: Delay for sending alarm

Posted: Saturday 10 August 2019 21:58
by hoeby
Could you explane what the script needs to do?
You made 2 local, but don't use them.

Re: Delay for sending alarm

Posted: Sunday 11 August 2019 17:30
by waaren
teemurama wrote: Saturday 10 August 2019 21:37 What / where I should set .afterSec(10) when I want alarm started with 10 sec delay.
Try this

Code: Select all


return
{
    on  = { 
                devices = { 'Kuisti' , 'Porch movement' }
          },
          
    execute = function(dz, item)

        local alarm = dz.devices('Xiaomi Gateway Alarm Ringtone')
        local gateway = dz.devices('Xiaomi RGB Gateway')

        if item.active then
            dz.notify("HÄLYTYS ULKO-OVI","Ovihälytys",dz.PRIORITY_EMERGENCY,nil,nil,dz.NSS_PUSHOVER)
            alarm.switchOn().afterSec(10)
        end    
    end
}