Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Scene motion detection ALARM


et1961

Question

Hi, I'm looking for a scene for my alarm. I have multiple motion sensors in different rooms and I want to trigger the alarm only if 2 or more motion sensors detect motion (armed and breached) within a period of 20 seconds.

 

This to avoid false alarms, because at least 2 motion sensors has to detect motion within a short time interval.

 

Who can help me with a nice LUA script?

 

Thanks in advance! ETienne

Link to comment
Share on other sites

19 answers to this question

Recommended Posts

  • 0

as idea

 

Please login or register to see this code.

 

PS: You may replace call 

Please login or register to see this code.

Please login or register to see this code.

on 

Please login or register to see this code.

Link to comment
Share on other sites

  • 0
  • Inquirer
  • @10der thanks for your help. Can you please explain how your script works, an can you tell me where i have to edit my device ID's?

     

    Thanks in advance,

    With kind regards,

     

    Etienne

    Link to comment
    Share on other sites

    • 0

    if you set (or remove) carefully this opt-in in each device

    Please login or register to see this image.

     

     this function 

    Please login or register to see this code.

    automatically grab your devices

    otherwise, you may setup it manually in code:

     

    local security_devices = {123, 45, 24, 77}

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • @10der Hi,

     

    If i arm my motionsensors ID/s 165, 408, 51, 79, 411, 299 and 296 and within 20 seconds i breached multiple (more then 1) of these motionsensors, i expect that device ID 81 will turn on, but unfortunately nothing happens....

     

    Any idea, what i'm doing wrong?

     

     

    --[[
    %% properties
    %% weather
    %% events
    %% globals
    --]]

    -- Only allow one instance of the current scene to run at a time
    if (fibaro:countScenes() > 1) then
      fibaro:debug('Scene dubbel gestart!')
      fibaro:abort()
    end


    local security_devices = {165, 408, 51, 79, 411, 299, 296}

     

    while true do

        local breached_devices = {}

        for key, device_id in pairs(security_devices) do
            if (tonumber(fibaro:getValue(device_id, "value")) == 1 and tonumber(fibaro:getValue(device_id, "armed")) == 1) then
                table.insert(breached_devices, 1, device_id)
            end
        end

        if (#security_devices == #breached_devices) then
        fibaro:call(81, "turnOn");    
        
        end

        fibaro:sleep(20 * 1000); -- 20 sec loop
    end

    Link to comment
    Share on other sites

    • 0

    one remark here. all devices should be in ARM  mode.

    plus 

    Quote

    more then 1

     

    please change code 

     

     if (#breached_devices > 1) then
        fibaro:call(81, "turnOn");    
     end

    oh, right! the next question how to set a device to ARM mode.

     

    Please login or register to see this image.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Motion sensors are ARMED,

     

    If i breach 2 motion sensors within 20 seconds, the device 81 will not turn ON. Probably because the sensor status "Breached" changes within 1,5 second back to "Safe",

     

    See below the event panel. I breached the armed MS Keuken, and the armed MS eetkamer within few seconds but the device 81 was not turned on.

     

     

    --[[
    %% properties
    %% weather
    %% events
    %% globals
    --]]

    -- Only allow one instance of the current scene to run at a time
    if (fibaro:countScenes() > 1) then
      fibaro:debug('Scene dubbel gestart!')
      fibaro:abort()
    end


    local security_devices = {165, 408, 51, 79, 411, 299, 296}

    --local security_devices =
        --fibaro:getDevicesId(
        --{
            --enabled = "true",
            --visible = "true",
            --interfaces = {"fibaroAlarmArm"},
            --isTypeOf = "com.fibaro.doorSensor",
            --properties = {alarmExclude = "false"}
        --}
    --)

    while true do

        local breached_devices = {}

        for key, device_id in pairs(security_devices) do
            if (tonumber(fibaro:getValue(device_id, "value")) == 1 and tonumber(fibaro:getValue(device_id, "armed")) == 1) then
                table.insert(breached_devices, 1, device_id)
            end
        end
        if (#breached_devices > 1) then
        
        fibaro:call(81, "turnOn");    
        
        end

        fibaro:sleep(20 * 1000); -- 20 sec loop
    end

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    add print and see log.

     

    if (tonumber(fibaro:getValue(device_id, "value")) == 1 and tonumber(fibaro:getValue(device_id, "armed")) == 1) then

                print(device_id);
                table.insert(breached_devices, 1, device_id)
    end

     

    also

     

    fibaro:sleep(1 * 1000);

     

    if oK, you can add an additional check on false positive

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Thanks for your prompt reply!

     

    Where do i have to add the print instruction? And is this "print" similar to the debug function?

     

     

    Link to comment
    Share on other sites

    • 0
    Just now, et1961 said:

    And is this "print" similar to the debug function?

    yep!

     

    not sure but something like this

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi @10der

     

    I tried the  latest script (scene) you send me. I armed my motionsensorsm started the scene as you can see in the debug window. After that breached the motionsensors multiple times with short intervals (less then 5 seconden) but unfortunately nothing happens, even the breached devices are not printed.

     

    Please login or register to see this attachment.

     

    Hi @10der

     

    If the motion sensors are NOT armed, then after breach one of them i received the print message "ALARM!!!"

     

    See screenshot

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    yeah! for debugging purpose I am turned off alarm checking please return comment line to code!

     

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • i added the comment line

     

    script is now like this

     

    --[[
    %% properties
    %% weather
    %% events
    %% globals
    --]]

    -- Only allow one instance of the current scene to run at a time
    if (fibaro:countScenes() > 1) then
          fibaro:abort()
    end

    function tablelength(T)
      local count = 0
      for _ in pairs(T) do count = count + 1 end
      return count
    end


    local security_devices = {432, 408, 51, 79, 411, 299, 296}
    local breached_devices = {}

    print("Started...");
    while true do
        for key, device_id in pairs(security_devices) do
            and (tonumber(fibaro:getValue(device_id, "armed")) == 1)
            if (tonumber(fibaro:getValue(device_id, "value")) == 1)  then
                  print("Breached: " .. device_id);
                  breached_devices[device_id] = tonumber(fibaro:getValue(device_id, "lastBreached"))
            end
        end
      
        for device_id, v in pairs( breached_devices ) do
            if os.time()-v  > 60 then
                  breached_devices[device_id] = nil;
              end
        end

        if (tablelength(breached_devices) > 1) then
            -- clear
            breached_devices = {}
            -- alarm
            fibaro:call(81, "turnOn");        
            print("ALARM!!!!!!");
        end
        fibaro:sleep(1 * 1000);
    end
     

     

    When i start the scene, i receive this debug message:

     

     

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    Please login or register to see this image.

    /monthly_2018_07/image.jpeg.31b3da2fd7a2089dc95360c6df5fca94.jpeg" alt="image.jpeg.31b3da2fd7a2089dc95360c6df5fca94.jpeg" />

     

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • scene is running, i will do some test (multiple breached motion sensors) and revert back to you.

     

    Many thanks @10der for helping me out! 

     

    Please login or register to see this image.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi @10der, i intergrated your LUA script for multiple motion detection in my alarmsystem and till so far it works perfect.

     

    Many thanks for your help!

     

    Have a nice day,

     

    With kind regards,

     

    Etienne

    • Thanks 1
    Link to comment
    Share on other sites

    • 0

    Hi@et1961

     

    Can you please share your working LUA code?;)

    Also, the scenes of your alarm system?

    Thank you ;D

    Edited by silvinnio
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi Silvinnio,

     

    This is the motion detection scene, as you can see that will trigger the alarm when multiple motion sensors detects motion within 45 seconds time  interval.

     

    --[[
    %% properties
    %% weather
    %% events
    %% globals
    --]]

    -- Only allow one instance of the current scene to run at a time
    if (fibaro:countScenes() > 1) then
          fibaro:abort()
    end

    function tablelength(T)
      local count = 0
      for _ in pairs(T) do count = count + 1 end
      return count
    end


    local security_devices = {432, 408, 51, 79, 411, 299, 296} --motio sensors
    local breached_devices = {}

    print("Started...");
    while true do
        for key, device_id in pairs(security_devices) do
            if (tonumber(fibaro:getValue(device_id, "value")) == 1) and 
                (tonumber(fibaro:getValue(device_id, "armed")) == 1) then
                  print("Breached: " .. device_id);
                  breached_devices[device_id] = tonumber(fibaro:getValue(device_id, "lastBreached"))
            end
        end
      
        for device_id, v in pairs( breached_devices ) do
            if os.time()-v  > 60 then
                  breached_devices[device_id] = nil;
              end
        end

        if (tablelength(breached_devices) > 1) then
            -- clear
            breached_devices = {}
            -- alarm
            fibaro:call(377, "turnOn"); 
            fibaro:call(397, "sendDefinedPushNotification", "400");
            print("ALARM!!!!!!");
        
        fibaro:call(248, "turnOn"); --sirene 
        fibaro:call(419, "turnOn"); --sirene 
        fibaro:call(423, "turnOn"); --sirene 
        fibaro:call(436, "turnOn"); -- outdoor sirene
          
       
     end
        fibaro:sleep(1 * 1000); 
      
    end

    =================================================================================================================================================================
     

    This scene arm my motion sensors, and turn on the outdoor light at my frontdoor for 1 minute. And it send a push notification "motion sensors armed"

     

    --[[
    %% properties
    33 sceneActivation
    %% weather
    %% events
    %% globals
    --]]

    -- Only allow one instance of the current scene to run at a time
    if (fibaro:countScenes() > 1) then
      fibaro:debug('Scene dubbel gestart!')
      fibaro:abort()
    end

    local startSource = fibaro:getSourceTrigger();
    if (
     ( tonumber(fibaro:getValue(33, "sceneActivation")) == 15 )
    or
    startSource["type"] == "other"
    )
    then
        fibaro:call(84, "turnOn"); -- buitenlamp
        fibaro:call(432, "setArmed", "1"); --MS woonkamer
        fibaro:call(408, "setArmed", "1"); --MS eetkamer
        fibaro:call(51, "setArmed", "1"); --MS keuken
        fibaro:call(79, "setArmed", "1"); --MS entree
        fibaro:call(411, "setArmed", "1"); --MS garage
        fibaro:call(299, "setArmed", "1"); --MS overloop 1
        fibaro:call(296, "setArmed", "1"); --MS overloop 2

      
        setTimeout(function()
                fibaro:call(84, "turnOff"); -- buitenlamp 
        end, 60000)
       fibaro:call(397, "sendDefinedPushNotification", "398");
    end

     

    ===================================================================================================================================================================

     

    With this scene i arm my window and door sensors:

    It will also sound 1 of the sounders (sirene) for 1 second, so i know the sensors are armed.

     

    --[[
    %% properties
    33 sceneActivation
    %% weather
    %% events
    %% globals
    --]]

    -- Only allow one instance of the current scene to run at a time
    if (fibaro:countScenes() > 1) then
      fibaro:debug('Scene dubbel gestart!')
      fibaro:abort()
    end

    local startSource = fibaro:getSourceTrigger();
    if (
     ( tonumber(fibaro:getValue(33, "sceneActivation")) == 15 )
    or
    startSource["type"] == "other"
    )
    then
        fibaro:call(84, "turnOn"); -- buitenlamp
        fibaro:call(393, "setArmed", "1");--deur terras woonkamer
        fibaro:call(403, "setArmed", "1");--raam 1 wk voor
        fibaro:call(400, "setArmed", "1");--raam 2 wk voor
        fibaro:call(414, "setArmed", "1");--deur terras keuken 1
        fibaro:call(75, "setArmed", "1");--deur terras keuken 2
        fibaro:call(14, "setArmed", "1");--deur kantoor
        fibaro:call(82, "setArmed", "1");--garage deur
        fibaro:call(360, "setArmed", "1");--raam garage
        fibaro:call(66, "setArmed", "1");-- raam slk ET
        fibaro:call(406, "setArmed", "1");-- raam slk achter
        fibaro:call(20, "setArmed", "1");--deur garage
        fibaro:call(277, "setArmed", "1");--raam 1 slk voor
        fibaro:call(62, "setArmed", "1");-- raam 2 slk voor
        fibaro:call(443, "setArmed", "1");--deur overloop 2
        fibaro:call(446, "setArmed", "1");--deur slk ET
        fibaro:call(449, "setArmed", "1");--deur slk Mi
      
      
      
        fibaro:call(248, "turnOn"); --sirene 1
        fibaro:call(311, "turnOn");
        fibaro:call(397, "sendDefinedPushNotification", "376");
        setTimeout(function()
            fibaro:call(248, "turnOff");--sirene 1
        end, 1000)
        setTimeout(function()
            fibaro:call(11, "setArmed", "1");
        fibaro:call(84, "turnOff");
        end, 60000)
    end
    ==================================================================================================================================================================

     

    This scene will generate the alarm when a door window/sensor is breached ) only if the sensor is armed! There is also a timeout for the sounders (sirenes) of 400 seconds.

     

    --[[
    %% properties
    75 value
    446 value
    449 value
    443 value
    414 value
    11 value
    14 value
    82 value
    20 value
    360 value
    393 value
    66 value
    277 value
    62 value
    403 value
    400 value
    406 value
    75 armed
    446 armed
    449 armed
    443 armed
    414 armed
    11 armed
    14 armed
    82 armed
    20 armed
    360 armed
    393 armed
    66 armed
    277 armed
    62 armed
    403 armed
    400 armed
    406 armed
    %% weather
    %% events
    %% globals
    --]]

    local startSource = fibaro:getSourceTrigger();
    if(startSource["type"] == "other") then
        fibaro:call(397, "sendDefinedPushNotification", "111");
        setTimeout(function()
            fibaro:call(248, "turnOn");
        fibaro:call(419, "turnOn");
        fibaro:call(423, "turnOn");
        fibaro:call(436, "turnOn");
        fibaro:call(435, "turnOn");
        end, 5000)
        setTimeout(function()
            fibaro:call(248, "turnOff");
        fibaro:call(419, "turnOff");
        fibaro:call(423, "turnOff");
        fibaro:call(436, "turnOff");
        end, 400000)
    else
    if (( (tonumber(fibaro:getValue(75, "value")) > 0 and tonumber(fibaro:getValue(75, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(446, "value")) > 0 and tonumber(fibaro:getValue(446, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(449, "value")) > 0 and tonumber(fibaro:getValue(449, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(443, "value")) > 0 and tonumber(fibaro:getValue(443, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(75, "value")) > 0 and tonumber(fibaro:getValue(75, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(414, "value")) > 0 and tonumber(fibaro:getValue(414, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(14, "value")) > 0 and tonumber(fibaro:getValue(14, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(82, "value")) > 0 and tonumber(fibaro:getValue(82, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(20, "value")) > 0 and tonumber(fibaro:getValue(20, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(75, "value")) > 0 and tonumber(fibaro:getValue(75, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(75, "value")) > 0 and tonumber(fibaro:getValue(75, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(360, "value")) > 0 and tonumber(fibaro:getValue(360, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(393, "value")) > 0 and tonumber(fibaro:getValue(393, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(66, "value")) > 0 and tonumber(fibaro:getValue(66, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(277, "value")) > 0 and tonumber(fibaro:getValue(277, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(62, "value")) > 0 and tonumber(fibaro:getValue(62, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(403, "value")) > 0 and tonumber(fibaro:getValue(403, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(400, "value")) > 0 and tonumber(fibaro:getValue(400, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(406, "value")) > 0 and tonumber(fibaro:getValue(406, "armed")) > 0) ) or ( (tonumber(fibaro:getValue(11, "value")) > 0 and tonumber(fibaro:getValue(11, "armed")) > 0) )) then
    local delayedCheck0 = false;
    if ( (tonumber(fibaro:getValue(75, "value")) > 0 and tonumber(fibaro:getValue(75, "armed")) > 0) ) then
        delayedCheck0 = true;
    end
    local delayedCheck1 = false;
    if ( (tonumber(fibaro:getValue(446, "value")) > 0 and tonumber(fibaro:getValue(446, "armed")) > 0) ) then
        delayedCheck1 = true;
    end
    local delayedCheck2 = false;
    if ( (tonumber(fibaro:getValue(449, "value")) > 0 and tonumber(fibaro:getValue(449, "armed")) > 0) ) then
        delayedCheck2 = true;
    end
    local delayedCheck3 = false;
    if ( (tonumber(fibaro:getValue(443, "value")) > 0 and tonumber(fibaro:getValue(443, "armed")) > 0) ) then
        delayedCheck3 = true;
    end
    local delayedCheck4 = false;
    if ( (tonumber(fibaro:getValue(75, "value")) > 0 and tonumber(fibaro:getValue(75, "armed")) > 0) ) then
        delayedCheck4 = true;
    end
    local delayedCheck5 = false;
    if ( (tonumber(fibaro:getValue(414, "value")) > 0 and tonumber(fibaro:getValue(414, "armed")) > 0) ) then
        delayedCheck5 = true;
    end
    local delayedCheck6 = false;
    if ( (tonumber(fibaro:getValue(14, "value")) > 0 and tonumber(fibaro:getValue(14, "armed")) > 0) ) then
        delayedCheck6 = true;
    end
    local delayedCheck7 = false;
    if ( (tonumber(fibaro:getValue(82, "value")) > 0 and tonumber(fibaro:getValue(82, "armed")) > 0) ) then
        delayedCheck7 = true;
    end
    local delayedCheck8 = false;
    if ( (tonumber(fibaro:getValue(20, "value")) > 0 and tonumber(fibaro:getValue(20, "armed")) > 0) ) then
        delayedCheck8 = true;
    end
    local delayedCheck9 = false;
    if ( (tonumber(fibaro:getValue(75, "value")) > 0 and tonumber(fibaro:getValue(75, "armed")) > 0) ) then
        delayedCheck9 = true;
    end
    local delayedCheck10 = false;
    if ( (tonumber(fibaro:getValue(75, "value")) > 0 and tonumber(fibaro:getValue(75, "armed")) > 0) ) then
        delayedCheck10 = true;
    end
    local delayedCheck11 = false;
    if ( (tonumber(fibaro:getValue(360, "value")) > 0 and tonumber(fibaro:getValue(360, "armed")) > 0) ) then
        delayedCheck11 = true;
    end
    local delayedCheck12 = false;
    if ( (tonumber(fibaro:getValue(393, "value")) > 0 and tonumber(fibaro:getValue(393, "armed")) > 0) ) then
        delayedCheck12 = true;
    end
    local delayedCheck13 = false;
    if ( (tonumber(fibaro:getValue(66, "value")) > 0 and tonumber(fibaro:getValue(66, "armed")) > 0) ) then
        delayedCheck13 = true;
    end
    local delayedCheck14 = false;
    if ( (tonumber(fibaro:getValue(277, "value")) > 0 and tonumber(fibaro:getValue(277, "armed")) > 0) ) then
        delayedCheck14 = true;
    end
    local delayedCheck15 = false;
    if ( (tonumber(fibaro:getValue(62, "value")) > 0 and tonumber(fibaro:getValue(62, "armed")) > 0) ) then
        delayedCheck15 = true;
    end
    local delayedCheck16 = false;
    if ( (tonumber(fibaro:getValue(403, "value")) > 0 and tonumber(fibaro:getValue(403, "armed")) > 0) ) then
        delayedCheck16 = true;
    end
    local delayedCheck17 = false;
    if ( (tonumber(fibaro:getValue(400, "value")) > 0 and tonumber(fibaro:getValue(400, "armed")) > 0) ) then
        delayedCheck17 = true;
    end
    local delayedCheck18 = false;
    if ( (tonumber(fibaro:getValue(406, "value")) > 0 and tonumber(fibaro:getValue(406, "armed")) > 0) ) then
        delayedCheck18 = true;
    end
    setTimeout(function()
    local delayedCheck19 = false;
    local tempDeviceState19, deviceLastModification19 = fibaro:get(11, "value");
    if (( (tonumber(fibaro:getValue(11, "value")) > 0 and tonumber(fibaro:getValue(11, "armed")) > 0) ) and (os.time() - deviceLastModification19) >= 10) then
        delayedCheck19 = true;
    end

    local startSource = fibaro:getSourceTrigger();
    if (
     ( delayedCheck0 == true  or  delayedCheck1 == true  or  delayedCheck2 == true  or  delayedCheck3 == true  or  delayedCheck4 == true  or  delayedCheck5 == true  or  delayedCheck6 == true  or  delayedCheck7 == true  or  delayedCheck8 == true  or  delayedCheck9 == true  or  delayedCheck10 == true  or  delayedCheck11 == true  or  delayedCheck12 == true  or  delayedCheck13 == true  or  delayedCheck14 == true  or  delayedCheck15 == true  or  delayedCheck16 == true  or  delayedCheck17 == true  or  delayedCheck18 == true  or  delayedCheck19 == true )
    or
    startSource["type"] == "other"
    )
    then
        fibaro:call(397, "sendDefinedPushNotification", "111");
        setTimeout(function()
            fibaro:call(248, "turnOn");
        fibaro:call(419, "turnOn");
        fibaro:call(423, "turnOn");
        fibaro:call(436, "turnOn");
        fibaro:call(435, "turnOn");
        end, 5000)
        setTimeout(function()
            fibaro:call(248, "turnOff");
        fibaro:call(419, "turnOff");
        fibaro:call(423, "turnOff");
        fibaro:call(436, "turnOff");
        end, 400000)
    end
    end, 10000)
    end
    end
    ==================================================================================================================================================================

     

    This scene i for turning off the alarm and bring the sensors in a safe state.

     

    --[[
    %% properties
    33 sceneActivation
    %% weather
    %% events
    %% globals
    --]]

    -- Only allow one instance of the current scene to run at a time
    if (fibaro:countScenes() > 1) then
      fibaro:debug('Scene dubbel gestart!')
      fibaro:abort()
    end


    local startSource = fibaro:getSourceTrigger();
    if (
     ( tonumber(fibaro:getValue(33, "sceneActivation")) == 14 )
    or
    startSource["type"] == "other"
    )
    then
        --fibaro:call(33, "turnOn"); --verl entree
        fibaro:call(66, "setArmed", "0");
        fibaro:call(99, "setArmed", "0");
        fibaro:call(75, "setArmed", "0");
        fibaro:call(74, "setArmed", "0");
        fibaro:call(11, "setArmed", "0");
        fibaro:call(414, "setArmed", "0");
        fibaro:call(82, "setArmed", "0");
        fibaro:call(20, "setArmed", "0");
        fibaro:call(102, "setArmed", "0");
        fibaro:call(277, "setArmed", "0");
        fibaro:call(62, "setArmed", "0");
        fibaro:call(400, "setArmed", "0");
        fibaro:call(403, "setArmed", "0");
        fibaro:call(406, "setArmed", "0");
        --fibaro:call(393, "setArmed", "0");--deur terras woonkamer
        fibaro:call(432, "setArmed", "0"); --MS woonkamer
        fibaro:call(408, "setArmed", "0"); --MS eetkamer
        fibaro:call(51, "setArmed", "0"); --MS keuken
        fibaro:call(79, "setArmed", "0"); --MS entree
        fibaro:call(411, "setArmed", "0"); --MS garage
        fibaro:call(299, "setArmed", "0"); --MS overloop 1
        fibaro:call(296, "setArmed", "0"); --MS overloop 2
        fibaro:call(443, "setArmed", "0"); --deur overloop 2
        fibaro:call(446, "setArmed", "0"); --deur slk ET
        fibaro:call(449, "setArmed", "0"); --deur slk Mi
      
          fibaro:call(248, "turnOff"); --Sirene 1 OFF
        fibaro:call(419, "turnOff"); --Sirene 3 OFF
        fibaro:call(423, "turnOff"); --Sirene 4 OFF
        fibaro:call(435, "turnOff"); --Sirene (buiten) OFF
        fibaro:call(436, "turnOff"); --Sirene (buiten) OFF
          fibaro:call(311, "turnOff"); --Alarm ARMED indicator OFF 
        fibaro:call(397, "sendDefinedPushNotification", "399");
      setTimeout(function()
            fibaro:call(33, "turnOff"); --verl entree
        end, 5000)
      fibaro:killScenes(18); 
      fibaro:killScenes(17); 
      fibaro:killScenes(91);
      fibaro:killScenes(92);
    end

     

    ========================================================================================================================================================================

    This last scene i use to switch of the sounders automaticly, after 400 seconds.

     

    --[[
    %% properties
    248 value
    419 value
    423 value
    436 value
    %% weather
    %% events
    %% globals
    --]]

    local startSource = fibaro:getSourceTrigger();
    if(startSource["type"] == "other") then
        fibaro:call(397, "sendDefinedPushNotification", "402");
        setTimeout(function()
            fibaro:call(248, "turnOff");
        fibaro:call(419, "turnOff");
        fibaro:call(423, "turnOff");
        fibaro:call(436, "turnOff");
        end, 40000)
    else
    if (( tonumber(fibaro:getValue(419, "value")) > 0 ) or ( tonumber(fibaro:getValue(423, "value")) > 0 ) or ( tonumber(fibaro:getValue(436, "value")) > 0 ) or ( tonumber(fibaro:getValue(248, "value")) > 0 )) then
    local delayedCheck0 = false;
    if ( tonumber(fibaro:getValue(419, "value")) > 0 ) then
        delayedCheck0 = true;
    end
    local delayedCheck1 = false;
    if ( tonumber(fibaro:getValue(423, "value")) > 0 ) then
        delayedCheck1 = true;
    end
    local delayedCheck2 = false;
    if ( tonumber(fibaro:getValue(436, "value")) > 0 ) then
        delayedCheck2 = true;
    end
    setTimeout(function()
    local delayedCheck3 = false;
    local tempDeviceState3, deviceLastModification3 = fibaro:get(248, "value");
    if (( tonumber(fibaro:getValue(248, "value")) > 0 ) and (os.time() - deviceLastModification3) >= 5) then
        delayedCheck3 = true;
    end

    local startSource = fibaro:getSourceTrigger();
    if (
     ( delayedCheck0 == true  or  delayedCheck1 == true  or  delayedCheck2 == true  or  delayedCheck3 == true )
    or
    startSource["type"] == "other"
    )
    then
        fibaro:call(397, "sendDefinedPushNotification", "402");
        setTimeout(function()
            fibaro:call(248, "turnOff");
        fibaro:call(419, "turnOff");
        fibaro:call(423, "turnOff");
        fibaro:call(436, "turnOff");
        end, 40000)
    end
    end, 5000)
    end
    end
     

    Link to comment
    Share on other sites

    • 0

    hi @et1961

     

    I want to create a system alarm and I read your post.

     

    But I don't understand 2 value:

     

    33 sceneActivation --> id of your?

     

    ( tonumber(fibaro:getValue(33, "sceneActivation")) == 15 ) --> 15 what is it?

     

    Thanks

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...