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

Thanks Morpheus.  I have it working along with the keypad built from your webpages.  It is very simple but works well

   0
  •  
  • Please login or register to see this link.

Link to comment
Share on other sites

  • 0

@morpheus75,

 

Thank you for sharing! Nice work. But I have following situation and I like to know your opinion on how to solve it. Description of my situation: 

 

LEAVING HOUSE - I live in house with garage attached to it but to get to garage we have to exit entrance door and open side door to enter garage. So when we are leaving house we arm alarm with delay of at least 3 minutes. I have a script that first checks status of all doors and windows except entrance door and both garage doors. Then we first close entrance door and enter garage using that side door, close it and open garage door and gateway. When we get out from garage, garage door closes and also gate. Usually this is always done under 3 minutes. After 3 minutes script is checking remaining three doors (entrance and garage doors) and if closed then arming sensors else if something stay open sends notification. 

 

RETURNING HOME - Just before coming to the gate I open gate and garage door which sensor is armed. Also motion sensor in garage is armed. When we enter garage gate and garage door closes but then we open garage side door and then also entrance door and they are all armed same as motion sensor in the hallway behind entrance door. All this takes about 5 minutes from opening garage door until we enter the house. At the moment we disarm alarm while we are still driving home. I wanted to use geofencing and location services but Fibaro application is battery eater and also is not reliable enough to use for this purpose. I don't want to use IFTTT because it is insecure and any other solution that requires opening port to the HC2.

 

So, my question is, is it possible to make this arming/disarming alarm more smart with your solution and this rfid keypad?

 

Link to comment
Share on other sites

  • 0

@Sankotronic, Do you use apple or android? I use android and have a subscription from 

Please login or register to see this link.

 so I can use all his Tasker plugins. I use autolocation to set my phone in "Home mode", that sends a https command using "join" to my tablet and the tablet sends an autoremote request over lan only that presses the Home button on my VD, outside the circle "Homenear-far" it puches the away button. Same for my wife, one or both of us home  = presentstate Home, both away is state away.

 

When at home autonotification creates a notification with my most used home actions (like starting Kodi, radio, starts fibaro app ect) which is dismissed when I leave the geo fence.

Link to comment
Share on other sites

  • 0

Hi @jimicr,

 

I'm stuck with Apple so no Tasker or anything similar due to Apple policy of closed system. But still, I think that Fibaro should do something with their app. If other apps can work reliable with location services and not eat battery in one afternoon then their app should be able too. For my situation geofencing is the best solution. At the moment I have to press button in mobile app to start scene when we are arriving home and enter PIN what is not really easy to do while driving car. 

Link to comment
Share on other sites

  • 0

I don't know if you are always driving home from the same location? Lets say from your work is a 30 minute drive to home.

Create a scene with a delay  timer so you run before getting in your car.

But the house disarms minutes before you arrive.

 

Link to comment
Share on other sites

  • 0
27 minutes ago, Sankotronic said:

Hi @jimicr,

 

I'm stuck with Apple so no Tasker or anything similar due to Apple policy of closed system. But still, I think that Fibaro should do something with their app. If other apps can work reliable with location services and not eat battery in one afternoon then their app should be able too. For my situation geofencing is the best solution. At the moment I have to press button in mobile app to start scene when we are arriving home and enter PIN what is not really easy to do while driving car. 

 

A wild idea.. perhaps...

 

for arriving....

could you use when you phone connects to your wifi ( in your driveway or garage) as a trigger to turn off the alarm, or perhaps a combination of triggers to ensure the house knows it's you ( or a member of the family)

 

for leaving.. 

set the house in a 'semi armed' state and when you phone leaves wifi or garage door or gate closes the house arms itself.

 

i've be toying with this for our house.

when we open the gates and drive into the driveway the phones connect to wifi and by the time we get out and open the front door there is loads of time for the house to disarm itself. I haven't had much time to implement with the other HA projects I've got going on at the moment..... 

 

 

 

 

Link to comment
Share on other sites

  • 0
54 minutes ago, jimicr said:

I don't know if you are always driving home from the same location? Lets say from your work is a 30 minute drive to home.

Create a scene with a delay  timer so you run before getting in your car.

But the house disarms minutes before you arrive.

 

 

@jimicr,

 

I'm working offshore and my wife is a freelancer so when we leave our hose and coming back it is always at different times and distances. That's why geofencing would be nice for both situations leaving and returning back home.

Link to comment
Share on other sites

  • 0
31 minutes ago, AutoFrank said:

 

A wild idea.. perhaps...

 

for arriving....

could you use when you phone connects to your wifi ( in your driveway or garage) as a trigger to turn off the alarm, or perhaps a combination of triggers to ensure the house knows it's you ( or a member of the family)

 

for leaving.. 

set the house in a 'semi armed' state and when you phone leaves wifi or garage door or gate closes the house arms itself.

 

i've be toying with this for our house.

when we open the gates and drive into the driveway the phones connect to wifi and by the time we get out and open the front door there is loads of time for the house to disarm itself. I haven't had much time to implement with the other HA projects I've got going on at the moment..... 

 

 

@AutoFrank,

 

We use only Apple products. I read somewhere that iPhones does not report when they are sleeping even when are in range of WiFi and can connect to it what is really lame. Am I right or wrong?

Link to comment
Share on other sites

  • 0
13 minutes ago, Sankotronic said:

 

@AutoFrank,

 

We use only Apple products. I read somewhere that iPhones does not report when they are sleeping even when are in range of WiFi and can connect to it what is really lame. Am I right or wrong?

 

We use android phones but have some ipads as well

I did a quick test and it would appear you're correct :-(

... but what if you could send your phone a notification or anything (perhaps when you open the gates, garage door) that would wake it up for a few seconds and would be enough to register it on your wifi and detect it and trigger from there...

 

I used the following code to do a quick check and if I press the home button on my ipad it registers almost immediately on the VD and stays online for about 25 seconds. I think the same analogy would apply if the iDevice was woken up by a notification.... 

Please login or register to see this code.

 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • @

    Please login or register to see this link.

    ,

    Firstly thanks for the feedback on code. It was given to me by a friend and then i adapted it for my alarm needs and posted on here so a lot of the programming was actually done by a friend, im still not that technical when it comes to coding but understand enough to make it work for me.

     

    secondly your alarm dilemma: 

    to be honest there is nothing in this code that is different and also the RFID is just a trigger similarly like pressing the button on your phone.

    as suggested above the best option is some sort of geofencing.  

    what you need is related to the timing of everything and a two tiered timing approach to arm the house first and then arm final 3 doors after about 3 mins would mean if any house door/window was left open you wont be too far away to come back. then after your 3 mins arm the final 3 sensors.

    coming home is trickier to do via automation and apart from having a shortcut widget on your phone which is pin protected i cannot think of another way to do (apart from geofencing which has already been mentioned).

     

    thanks

    Edited by morpheus75
    Link to comment
    Share on other sites

    • 0
    Guest eileff

    First of all, thank you for a great script. It works almost perfectly. But I still have the same arming/disarming dilemma as @Sankotronic. 

     

    One possible scenarios that could help on the arming part;

    - first one extra zone for arming, lets call it "transit"

    - you arm the house while leaving your house through with garage open or through the inner door to the garage after arming the alarm.

    - if garage inner door or garage are opened within a minute after arming this will ensure that this "transit" zone will not yet be armed.

    - if you just leave through the front door and garage are not opened within a minute, this will ensure that this "transit" zone are armed as well.

    - if using "transit" zone, this zone will have arming triggered by garage door closed(or gate, whatever last closes) - and checking that innerdoor are closed as well.

     

    This will make sure you just activly arm it once - rest is based on your behavior.

     

    Disarming process if using a car arriving could be solved by using a Long-distance RFID reader with a chip on the car. This could disarm the "transit" zone (gate with a delay). As only "transit" zone will be disarmed your house is secure and ready to be disarmed when you enter through the innerdoor to disarm.

     

    I can not write this in LUA, so if anyone dare to try - I will be happy to try it. :)

     

    /E

    Edited by eileff
    Link to comment
    Share on other sites

    • 0
    On 2017-1-6 at 11:58 AM, Sankotronic said:

     

    @AutoFrank,

     

    We use only Apple products. I read somewhere that iPhones does not report when they are sleeping even when are in range of WiFi and can connect to it what is really lame. Am I right or wrong?

     

    Hi @AutoFrank same problem here. I don't need a high-end alarm system but my motion sensors would be great as security detection. But we also use iPhones and the battery drain is too poor and tasker is no option.. I saw this solution on the forum: 

    Did you already tried this? 

    Edited by pnutp0wer
    Link to comment
    Share on other sites

    • 0

    @morpheus75 Great script!

     

    Wondering for the walk-out, the front door sensor to arm it after 30 seconds instead of implementing a sleep timer before all other sensors to arm.
    This way I can trigger a walk out sound notification/beep.

    So I would leave the front door sensor out of the ArmIds and put lines under the following rule:

    Please login or register to see this code.

    Then add something like:

    Please login or register to see this code.

     

    As we only leave the house via the front door, it wouldn't be an issue to be safe.

     

    BTW I have the Philio PSK01 where I trigger the variables to enable or disable the alarm and everspring voice siren. Both devices not really templated for HC2, but it is working. Standard siren works out of the box, I get the voices to speak up when changing the parameter value all the time. ?

    Edited by comfix
    Link to comment
    Share on other sites

    • 0

    @morpheus75 the entry code seems not to be working for me. When the frontdoor breaches, nothing seems to happen after 30s.

    Debug shows nothing and no triggers at all.

    Ofcourse when I push start in debug then it gets en error because it is not triggered the right way "[ fatal] Unknown exception: /opt/fibaro/scenes/90.lua:14: Assertion failed: Expected number"

     

    Any advise?

    Link to comment
    Share on other sites

    • 0
    55 minutes ago, SmartHomeEddy said:


    Did you actually fill in the id ?

    Yes this is the script to set alarm and working fine how I adapted it.

    But the entry delay script isn’t doing anything.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • did you fill in this part with your entry zone ID's

     

    Please login or register to see this code.

    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...