Alarm systems (Fire, intrusion, ...)
In this page some alarm systems, from different authors, are described, one section for each system.
Fire detection script based on temperature sensors
In https://github.com/CreasolTech/domoticz_lua_scripts it is' possible to find 4 files that can be used to detect fire checking the rooms temperature.
When a room temperature increases too fast, the script send an alert by Telegram specifying the room name, average temperature and new temperature.
The script:
- has a configuration file where, for each rooms, are defined the room name, temperature sensor name, deltaT to trigger the alarm
- stores in a variable, json encoded, the list of average temperatures for each room
- when in one or more rooms Temperature > Average_Temperature + deltaT => send notification by Telegram
- it works with both simple temperature sensors, and temperature+humidity(+barometric) sensors
Below the descriptions of the 4 files, that should be placed into Domoticz scripts/lua directory:
- script_time_fireAlarm.lua => lua script triggered every minute
- config_fireAlarm.lua => configuration file with rooms definition
- globalvariables.lua => another configuration file with telegram API information and something else
- globalfunctions.lua => some functions that are used from my scripts
For any suggestions, open an issue on gitHub
Simple alarm script
This script is a simple alarm.
This script has been taken from here
Dependencies - hardware / software / operating system
This script will work on all type of hardware / software / operating system.
Domoticz Setup - switches, variables, version
TBC
Installation instructions
Copy this script in your domoticz\scripts\lua\ folder.
Script with comments
local sensor = 'Bedroom 1 - Motion' local sensor2 = 'Hall - Motion' local sensor3 = 'Living Room - Motion' local sensor_out = 'Presence Detected' local sensor_out2 = 'Security Panel' commandArray = {} function timedifference (s) year = string.sub(s, 1, 4) month = string.sub(s, 6, 7) day = string.sub(s, 9, 10) hour = string.sub(s, 12, 13) minutes = string.sub(s, 15, 16) seconds = string.sub(s, 18, 19) t1 = os.time() t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds} difference = os.difftime (t1, t2) return difference end if ((devicechanged[sensor] == 'On') or (devicechanged[sensor2] == 'On') or (devicechanged[sensor3] == 'On')) then print('Presence from PIR') commandArray[sensor_out]='On' --commandArray['SecPanel']='Arm Home' --else --commandArray['Security Panel']='Disarm' end --if(devicechanged[sensor_out] == 'On') then --commandArray[sensor_out2]='Arm Home' --end --commandArray['SecPanel']='Arm Home' --commandArray['SecPanel']='Disarm' --commandArray['SecPanel']='Arm Away' return commandArray
Example of use (if relevant) i.e. output files / screen displays
N/A