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] Universal alarm {v1.0}


Sankotronic

Question

Universal alarm v1.0

 

Please login or register to see this image.

/monthly_2017_01/58834681666f4_Universalalarmgui.jpg.874b18ee8bdfbeb0b6c7baaf96837dc6.jpg" alt="Universal alarm gui.jpg" />

 

Hello everyone!

 

Here is one simple scene that can be used for FIRE, FLOOD or OTHER ALARM purpose. When triggered by sensor it will send you popup, push and e-mail notification. It can also activate additional alarm sounders. You can also add additional actions to turn On lights, lower blinds or whatever action you like to happen when alarm is breached and also when sensor get back to safe state.

 

There is no global variables needed! If you use HomeTable then you can just uncomment line where this table is read to the scene.

 

SCENE SETUP

First you need to decide for what you will use this scene. You can use it for FIRE ALARM or for FLOOD ALARM or for any other purpose that you can think off. Just for setup example I will show here how to set it up for FIRE alarm. Same setup can be done for FLOOD alarm.

 

First you need to add all your smoke detectors to scene header so that it is triggered when any of this sensors detects fire and get breached:

Please login or register to see this code.

Then you can setup devices to which you want this scene to send push notifications. As already mentioned in my other threads, to find ID of your mobile devices you can enter this link in your browser:

 

http://<YOUR_HC_IP>/docs/#!/iosDevices/getIosDevices

 

and then press on button TRY IT! You will get ID numbers of all mobile devices that you can enter here:

Please login or register to see this code.

 

Then you can setup messages text, translate it to your language:

Please login or register to see this code.

Here you can setup users that will receive e-mail message. Same as for mobile devices, you can find users ID by entering following link in your browser:

 

http://<YOUR_PC_IP/docs/#!/users/getUserss

 

and then press button TRY IT!. You will get ID numbers of all users that you can enter here:

Please login or register to see this code.

In above settings you can also setup first part of the e-mail message. Scene will on that part add room and name of the sensor that is breached!

 

If you want to activate additional sounders because fire and flood sensor sounder is not enough then you can setup here additional sounders to be activated when alarm is activated:

Please login or register to see this code.

And for the end, if this is not enough for you and you want more action to be executed when alarm is breached, like close water valves, close blinds or turn on some lighting then you can add that code yourself. There are three functions where you can add code:

Please login or register to see this code.

If you want some action before notifications are send and sounders activated then you add code to function extraUserCodeBreachFirst(). If you want some action to be executed after notifications are sent and sounders activated then you add code to function extraUserCodeBreachLast(). When sensor goes back to safe state scene is activated again. It will not send any messages but will stop sounders and if you want some more action then you can add code to function extraUserCodeSafe().

 

So, one copy of this scene you can setup for FIRE ALARM. Another copy you can setup for FLOOD ALARM, and if you have something else then you can setup third copy for that OTHER ALARM.

 

NOTE!

This scene is tested on my HC2 with software 4.110 by breaching FIRE & FLOOD sensors and found to work flawlessly. If you encounter any problems then please first check your settings and look for typos. If you are still unable to make it work then please send me copy of complete scene code and screenshot of debugging window to my private message and I will help you to make it work!

Please, I will appreciate very much any feedback and requests for additional features!! Example of debug window when scene is activated:

 

Please login or register to see this attachment.

 

ICONS DOWNLOAD

Icons for this scene you can find here:

SCENE DOWNLOAD FILE

 

Please click bellow to download:

[SCENE] Universal alarm scene {v1.0} as TXT file -------------------->  

Please login or register to see this attachment.

[SCENE] Universal alarm scene {v1.0} as LUA file --------------------> 

Please login or register to see this attachment.

 

NOTE

LUA version of scene code is saved by ZeroBrane Studio v1.50. You can download it at this link: 

Please login or register to see this link.

 

 

 

Link to comment
Share on other sites

Recommended Posts

  • 0
  • Inquirer
  • 1 hour ago, Landshark said:

    @Sankotronic, I have question. Is it difficult to include a tamper function for both the water- and smoke sensor? For instance if somebody is moving the watersensor you will get notified.

     

    @Landshark,

     

    To have tamper alarm you will have to do some changes in scene code and you will have to use separate scene for tamper alarm. This is what you have to change:

     

    First in scene header setup your sensors:

    Please login or register to see this code.

    Then you will have to find code line 217 and change "value" to "tamper":

    Please login or register to see this code.

     

    Of course change messages to get appropriate information. Also, tamper needs long time to go to safe to trigger again scene to turn off sounders so I recommend to remove all sounders from setup and just leave sending push message and e-mail. Sometimes sensors are moved by accident and you don't want to sound loud alarm.

     

    Also I noticed that flood sensor once tamper is activated it stays activated for long time and will not trigger scene again. Tis is probably because after tamper is triggered it will be set to safe only during next sensor wakeup time. So, don't be surprised if you move sensor and scene is not triggered. You can check status of the tamper with this line:

    Please login or register to see this code.

    1 is for breached and 0 for safe.

     

    Link to comment
    Share on other sites

    • 0

    Great script,

    Is it wise to add in the Fire alarm version the heat detection as well? (Fibaro Smoke detector)

     

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 7 hours ago, net said:

    Great script,

    Is it wise to add in the Fire alarm version the heat detection as well? (Fibaro Smoke detector)

     

     

     

    Hi @net,

     

    It is a good suggestion.  Thank you! Will add this in next release. I also have to adapt script to better support new Fibaro CO sensor.

    Edited by Sankotronic
    • Like 1
    Link to comment
    Share on other sites

    • 0

    Hi Zoran / all,

     

    I consider to use universal alarm for my alarm system at home. For this I consider to have several copies of universal alarm running;

    1: full alarm (motion and door sensors) --> in case we are not at home --> trigger on motion breach

    2: door/window only --> in case we are sleeping --> trigger on door breach

    3: tamper alarm ---> in case the full alarm or D/W alarm is activated --> trigger on tamper

    4: smoke alarm --> trigger on smoke (or in future Co2 if I own such sensor)

    5: fire alarm  --> trigger on heat

     

    Q1: 

    What is your view on my strategy? Good idea or better suggestions? 

     

    Q2:

    Is it possible to run several versions of universal alarm parallel?

     

    Q3: 

    How can I set the universal alarm such that it triggers on motion, door breach, tamper, smoke or heat?

    I see if (StartSource['type'] == 'property') then
      local smokeID = tonumber(StartSource['deviceID']);
      local sensorD = fibaro:getRoomNameByDeviceID(smokeID).." ".. fibaro:getName(smokeID);
      if deBug then logbug("cyan", "Scene triggered by sensor "..sensorD) end;
      if (tonumber(fibaro:getValue(smokeID, "value")) == 1) then
        if deBug then logbug("viloet", "ATTENTION! Sensor: "..sensorD.." breached!") end

     

    I'm not sure what to change.

     

    Q4:

    How can I limit the sensors used to trigger the alarm? (eg exclude a certain PIR module) 

    Should I make separate copies of the home table that contain only those items that I would like to use in that particular alarm session?

    Is it possible to just ''hard'' enter the PIR/ DW id's in the code? (I only see the json option).

     

    Q5:

    How can I arm/disarm the alarm? I have created a global variable for this but your code does not seem to check any variables. Suggestions?

     

    Thanks in advance!

     

    Regards,

    Jules

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hello @julesmartens,

     

    When I was coding Universal Alarm scene all I had in mind is to provide scene that will monitor flood sensors or fire sensors and inform user if breached. As you know this sensors are not covered with Home Center Alarm panel and they don't need to be armed or disarmed. If they measure value out of range they will trigger but will trigger nothing if there is no scene to be triggered.

     

    Burglar alarm is completely different story since sensors must be armed to trigger alarm panel. Problem with Fibaro solution is that automation for burglar alarm is very basic and arming and disarming of sensors can be done only manually if not all sensors are to be armed. Universal Alarm scene does not have that ability to arm/disarm sensors, can only be used to monitor sensors and if triggered by any of monitored sensors then activate siren and send notifications.

     

    So here are my answers to your questions:

     

    1. Your strategy is good, but it can't be achieved only with Universal Alarm scene
    2. It is possible to run multiple copies of Universal alarm with different settings. For example I use one to monitor all my smoke detectors and another copy to monitor all my flood detectors.
    3. Universal Alarm scene is not meant to be used with burglar alarm and needs rewriting code
    4. UHAS™ that I'm working on will have that part solved with arming sensor depending on situation and circumstances. At the moment I have scene that arms sensors depending on some global variables settings and one scene that is triggered by alarm panel if armed sensor is breached that sends notification with buttons to decide to only silence alarm or to disarm it.
    5. I think I already answered this question under A4. To have different sets of arming sensors you need scene or VD that will arm only selected sensors depending on some settings.

    Regards

     

     

     

    Link to comment
    Share on other sites

    • 0

    Thank you very much for this code, 

    Please login or register to see this link.

     

    Please login or register to see this link.

    I have implemented fire-, flood, and tamper alerts in my system based on this code.

    I have a siren set up for fire and flood, with different sounds for each alert which is working very well. (For this I am using a VD for Aoetec Siren 5 that configures the sound and level of the siren.)

     

    However I would really like to implement a reduced sound level-alarm for tamper alerts.

    In other cases I have been using code to turn on the siren for like 500ms and then off for 2000ms and then on for 500ms and so on...

    This creates a more "soft" siren like chirps.

     

    Can anyone tell me if there is a possibility to include a loop like:

    while true do
        fibaro:call(24, "turnOn"); --24 is the siren
          fibaro:sleep(5000);
        fibaro:call(24, "turnOff");
          fibaro:sleep(5000);

    end

     

    ...or a repeat function that will actually stop, when there is no breach in sensors triggering the main scene any longer?

     

    I am able to implement the start-stop of siren in the universal alarm code under "function extraUserCodeBreachFirst()", but of course the siren then keeps turning on and off after the sensor triggering the universal alarm scene is safe.

     

    I am not very skilled in lua so I am hoping that somebody can assist on this matter. I am guessing many users would like the same possibility.

     

    Best regards

     

     

     

     

    Link to comment
    Share on other sites

    • 0

    Hello, 

     

    Tried this scene, push notification is being received but no email, also getting below highlighted error, any idea how to work around it?

     

     

    [DEBUG] 19:38:07: Scene triggered by sensor Master Bedroom Smoke Detector
    [DEBUG] 19:38:07: ATTENTION! Sensor: Master Bedroom Smoke Detector breached!
    [DEBUG] 19:38:07: Alarm sounder(s) not defined.
    [DEBUG] 19:38:07: Popup notification sent!
    [DEBUG] 19:38:07: Push notification sent to user iPhone X Ma
    [DEBUG] 19:38:07: 2019-07-21 19:38:07.605470 [ fatal] Unknown exception: /opt/fibaro/FibaroSceneAPI.lua:335: attempt to concatenate local 'deviceID' (a nil value)
    [DEBUG] 19:38:19: START - Universal Alarm scene version 1.0 - (c) 2017 Sankotronic
    [DEBUG] 19:38:19: Scene triggered by sensor Master Bedroom Smoke Detector
    [DEBUG] 19:38:19: Alarm sounder(s) not defined.
    [DEBUG] 19:38:19: ATTENTION! Sensor: Master Bedroom Smoke Detector is safe!
    [DEBUG] 19:38:19: STOP - Universal alarm scene

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