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

Alarm for HomeCenter 2 - Multiple Modes Supported


morpheus75

Question

 

I messed up some code tags so re-posting...

Hi

Here is my small tutorial on the alarm system code i use to complement the rfid keypad system.

Firstly you need to create an 'ALARM' variable with at least 2 values.

one variable will be OFF

second variable will be FULL (or whatever name you want to give)

you could if you wanted create many more variables for different zone eg i have a 3rd called DOWN

 

you then programme the keypads (or any other scene) to change the variable to the alarm mode you want

 

Please login or register to see this code.

 

From above i have 2 keypads.

I have put triggers under the properties for both ON and OFF when i press the 'ON' button once it changes the VARIABLE to PART,

if i then press again it changes the VARIABLE to FULL.

If you wanted you could continue this for more zones but it can get a bit complicated......

Finally if either of the OFF buttons are pressed the VARIABLE is set to OFF.  

 

Next part is the actual setting of the alarm..

 

Please login or register to see this code.

this looks big but you only need to add the device ID's of your FULL mode,  DOWN mode and any other message once the alarm has been set. Remember to separate your ID numbers with a comma

The code is triggered by a change in the global variable called 'alarm'.

This then starts the scene. The time delay gives you time to press again for different modes and also to leave the house and make sure that all sensors become safe. (i have set my motion sensors to show as being safe after 5 secs, the default is around 15 secs).

After the time delay it checks which variable is set, then it only checks those sensors to make sure they are all SAFE.

If they are SAFE then it proceeds to ARM those sensors and then sends you a push message that the alarm has been set and will run any additional code you have added eg turn off the lights, heating etc

If they are UNSAFE then it aborts the arming procedure and sends you a message that 'a named sensor is unsafe to arm',

you can then investigate and make sure it is safe before starting again. examples include if a door was left ajar or window is left open etc  

 

Next part is the ACTIVATION code:

 

Please login or register to see this code.

firstly you need to enter the ID numbers of all your sensors in the properties section as triggers except the entry zones

also the fullArmIds and downArmIds need to match the previous arming code except for the entry doors we have a separate entry code to give us a time delayed entry

1st block is the function activation(), this basically tells me via push message and email which sensor triggered my alarm

2nd block checks to see which mode the alarm is in and therefore will only monitor those specific ID's

3rd block will cause the alarm to trigger if our 'armed' devices are breached and run the activation code

 

Entry code is below this as name suggests gives us a defined time to enter property and switch off alarm before it activates:

 

 

Please login or register to see this code.

 

to start with set the ID of your entry zones under properties, and update the ID 82 and 83 with your own.

If you have just 1 then delete accordingley and more than 2 then just add the extra as needed

the function is same as before

the final block checks if the doors have been opened if they are armed and the alarm is NOT set to off it then starts a 30 sec timer.

Just amend 30 to whatever time you need.

once the timer has counted down it will check the variable again and if you have turned alarm off then code aborted.

if alarm not switched off then activation procedure starts just as before and sends push message, email and siren activates for 10 mins.  

 

 

Final part is turning the alarm off

 

Please login or register to see this code.

fill the deviceIds with the values of ALL YOUR SENSORS - incl entry sensors

the trigger for this is the global variable alarm

if its in the 'off' setting then it will send me a push message and send an 'off' command to siren (just in case it was activated)

it will then go through the sensors 1 by 1 and disarm them all

 

I hope this helps all of you and any questions and feedback and comments please feel free to leave them

 

thanks

 

 

 

 

 

Link to comment
Share on other sites

Recommended Posts

  • 0

I know that the script gets triggered, when I activate the alarm it gives: [DEBUG] 12:28:27: nil

But when breaching the alarm, nothing seems to happen after 30s

 

This is the script I have:

 

Please login or register to see this code.

 

Edited by comfix
Link to comment
Share on other sites

  • 0
  • Inquirer
  • Please login or register to see this code.

     

    why is the  local alarm = fibaro:getGlobalValue("alarm")  

    commented out

    Link to comment
    Share on other sites

    • 0
    2 minutes ago, morpheus75 said:

    Please login or register to see this code.

     

    why is the  local alarm = fibaro:getGlobalValue("alarm")  

    commented out

    Because it is already defined above. Even when it is active, still nothing happens after 30 seconds.
    Just tried the other script standard breach and it sends right away a push message.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • it needs to check again to see if you havent turned the alarm off before activating

    Link to comment
    Share on other sites

    • 0
    4 hours ago, morpheus75 said:

    it needs to check again to see if you havent turned the alarm off before activating

     

    There seems to be something wrong with the following part:
     

    Please login or register to see this code.

    I have based the entry delay script on the script of the ACTIVATION code, add sleep into it and use only ID of the front door sensor. This is working fine.

    Edited by comfix
    Link to comment
    Share on other sites

    • 0

    @morpheus75 it seems that when the alarm has been triggered (so during alarm going off)  it also notifies when an unarmed sensor has been triggered. Noticed this during testing and my wife was in the kitchen.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • On 9/11/2021 at 4:31 PM, comfix said:

    @morpheus75 it seems that when the alarm has been triggered (so during alarm going off)  it also notifies when an unarmed sensor has been triggered. Noticed this during testing and my wife was in the kitchen.

    an unarmed sensor will trigger the scene as this sensor ID would be in the triggers section. however if an alarm is activated it would just check all the sensors in the array again irrespective of what triggered it thats why an unarmed sensor can effectively re-trigger the scene and give you notifications.

     

    Re entry delay just post the full scene please

    Link to comment
    Share on other sites

    • 0
    2 hours ago, morpheus75 said:

    an unarmed sensor will trigger the scene as this sensor ID would be in the triggers section. however if an alarm is activated it would just check all the sensors in the array again irrespective of what triggered it thats why an unarmed sensor can effectively re-trigger the scene and give you notifications.

     

    Re entry delay just post the full scene please

     

     

    This is my entry delay scene at the moment:

     

    Please login or register to see this code.

     

    Some parts are commented out as I don't want them to be triggered in test modus.

    Have currently my former alarm still active.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • the red that you have commented out will always work irrespective of the entry delay as you have added this after the 'end' so its not actually checking the condition :

    if (alarm == 'off')

     

    move those lines above the end command so the last three lines are just 

     

    end

    end

    end

     

    also the print(statusMessage) wil always give you 'nil' as it hasnt been defined

    Link to comment
    Share on other sites

    • 0
    13 hours ago, morpheus75 said:

    the red that you have commented out will always work irrespective of the entry delay as you have added this after the 'end' so its not actually checking the condition :

    if (alarm == 'off')

     

    move those lines above the end command so the last three lines are just 

     

    end

    end

    end

     

    also the print(statusMessage) wil always give you 'nil' as it hasnt been defined

    You are right... yesterday I already cleaned up the code :) thanks

    Now I also implemented Pushover which works great and gives more options like priority, retry, expire,...

     

    Link to comment
    Share on other sites

    • 0

    Today I breached the alarm, also a good test and it seems that the siren still counts to go off:

     

    Please login or register to see this code.

     

    Maybe I need to add to stop all current running scenes so it also stops counting? Or is there any better solution...

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • what is device ID 168?

     

    Also your alarm OFF scene should include the command to kill this running scene otherwise your timers still continue

     

    Link to comment
    Share on other sites

    • 0
    On 10/11/2021 at 7:02 PM, morpheus75 said:

    what is device ID 168?

     

    Also your alarm OFF scene should include the command to kill this running scene otherwise your timers still continue

     

    True I did this because forgotten and my wife was not happy with the indoor 110dB triggered twice ?

    Edited by comfix
    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...