About This File
Universal alarm v1.0
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!
Recommended Comments
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.