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


1 Screenshot

About This File

Universal alarm v1.0

 

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:

--[[
%% properties
96 value
128 value
605 value
%% globals
--]]

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:

-- PUSH MESSAGES AND MOBILE DEVICE SETUP ---------------------------------
-- define mobile devices to send push messages. Enter devices inside
-- braces separated by comma
local iosDeviceID   = {206, 321};

 

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

-- PUSH MESSAGES SETUP ------------------------------------------------------
-- enter push message text for breached alarm notification
local pushMessage = "WARNING! FIRE/FLOOD/OTHER ALARM BREACHED!";

-- POPUP MESSAGES SETUP -----------------------------------------------------
-- enter popup message text and button caption for breached alarm
local popupMainTitle     = "FIRE/FLOOD/OTHER ALARM";
local popupTimeFormat    = "%H:%M:%S | %d.%m.%Y.";
local popupContentTitle  = "ALARM breached!";
local popupImgUrl        = "";
local popupButtonCaption = "OK";

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:

-- E-MAIL MESSAGE SETUP -----------------------------------------------------
-- define users for which you want to receive e-mail warning. Enter users
-- inside braces separated by comma

local userID       = {};

-- Translate this e-mail message text that will be sent to you. On this
-- part scene will add which sensor was breached.

local emailMessage = "Breached FIRE/FLLOD/OTHER sensor:"

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:

-- EXTRA SOUNDER SETUP ------------------------------------------------------
-- define alarm sounder ID inside braces. You can define more than one just
-- separate them with comma.
local sounderID    = {128, 210};

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:

-- EXTRA FUNCTIONS WHERE YOU CAN ADD YOUR CODE ----------------------------
-- use this function to add code that will be executed before all other
-- code when sensor is breached

function extraUserCodeBreachFirst()
  -- your code goes here
  
end

-- use this function to add code that will be executed after all other
-- code when sensor is breached

function extraUserCodeBreachLast()
  -- your code goes here

end

-- use this function to add code that will be executed when sensor is
-- back to safe state

function extraUserCodeSafe()
  -- your code goes here

end

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.

 

Also please check this video by Mr Apple @MarcoTorino71:

 

 

NOTE!

This scene is tested on my HC2 with software 4.110 up to 4.510 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!

  • Like 3
  • Thanks 1


User Feedback

Recommended Comments

FibNisse

Posted (edited)

Thank you for this easy script!

 

Have so far tested it for Fire alarm, Water alarm, and Tamper alarm.

 

For setting up tamper you just have to change two lines, correct ?

 

under %% properties i changed to

<id> tamper

 

and in line aprox 221 the line i changed "value" to "tamper".

 

  if (tonumber(fibaro:getValue(smokeID, "tamper")) == 1) then

 

Tamper alarm triggers on all my fibaro smoke alarms, and water sensors,  and i get push notification + pop-up in fibaro app, and an email.

 

This should be built-in functionality in the HC2 i think, as they even promote it in their videos.. had to come to forum and register and insert LUA script to make it work. Steep learning curve, but very fun!

Edited by FibNisse
MarcoTorino71

Posted

Hi @Sankotronic

 

great scene.

 

Just a question.

 

I have 5 door/windows sensor and it works perfectly.

 

But, is it possibile to exclude some sensor by reading a global variable?

 

For example: if myVar1 is set to true, the scene check all sensor. If myVar2 is set to true check 4 sensor and exclude 1 of them?

Guest Sankotronic

Posted

Hi @MarcoTorino71 ,

 

This is a very simple scene that will be triggered if any of the devices which ID is added to scene header is breached and there is no extra check. It is more suitable for smoke, flood and tamper alarms where sensors does not need to be armed.

 

For burglar alarm only scene that will send notifications and sound sounders is needed and added to the burglar alarm panel as an extra action.

Join the conversation

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

Guest
Add a comment...

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