how to cancel a delay action

Hello,

first, sorry if there is a similar topic.

Can you tell me how to annulate a delay action ?

I mean :

I have a siren, and a door sensor.
When i’m in the Away mode, and if the door is opened. I have a delay action with the siren like the siren scream 20 seconds after a delay.

If in the lap times between 0 and 20 seconds I go in the HOME Mode, I would like the action siren cancels.

Presently, I had done the test : When I open the door, the delay action runs, if I enter to the HOME Mode, it doesn’t stop the delay action…

May be someone has a solution ?

Thank you guys

PLEG.

Add a condition
SIREN-ON: (DOOR; Now>0:20) and MODE=AWAY

This would trigger 20s after the door is opened and the mode is currently away

Hi,

Without PLEG you would need to create a bit of LUA code in the scene that runs the delayed action and in that action checks the home status. Something like this, but I do not know the call_action details to sound the alarm, but I think it works like a switch.

-- replace xx with thedevice number of the Siren device.
local cALARM_DEV = xx

-- Check Home (house mode = 1) status and sound alarm if not
function finishAlarmCheck()
    local house_mode = luup.attr_get("Mode",0)
    if (house_mode ~= "1" ) then
       luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget",{newTargetValue="1"}, cALARM_DEV)
    end
end

-- Schedule for action to turn on device in 20 secs
luup.call_delay("finishAlarmCheck", 20)

-- Return True to let scene finish.
return true

Have fun.

Cheers Rene