Delay for sending alarm

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
teemurama
Posts: 12
Joined: Saturday 09 June 2018 19:40
Target OS: Linux
Domoticz version:
Contact:

Delay for sending alarm

Post 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)
hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: Delay for sending alarm

Post by hoeby »

Could you explane what the script needs to do?
You made 2 local, but don't use them.
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Delay for sending alarm

Post 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
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest