In case you're reading the page in Italian, French or German, please check the ENGLISH page to see all figures and schemas.
Using the following scripts it's possible to get a complete burglar alarm system with Domoticz controller running in a RaspberryPI (single board computer with 2.3W power consumption) or another type of hardware.
Why Domoticz? Because Domoticz is free and very reliable, it can be automatically updated without any surprise; also it supports LUA scripting that permits to make easy-to-manage automations: in this case, a simple lua script that is called when devices change, a configuration file, and two simple bash scripts: one is called at the activation of the scenes AlarmAway, AlarmNight, AlarmDay, and onother one is called to record video from IPcams in case of outdoor sensors activation. Just change the config file to set which sensors and sirens to manage.
The alarm can be enabled/disabled through 3 scenes/group, as showing in the picture, or by pushbuttons, fingerprint readers, keyboards, RFID or NFC tags, ....
All notifications will be available in Telegram, as like as short videos that are recorded and sent to Telegram when an external sensor is activated:
- Three types of alarm: day (only emits a short pulse on internal siren, if someone open a door or window or shutter), night (activates only internal sirens and some lights), away (activates internal and external sirens).
- full notifications through Telegram app
- manages up to 64+64 magnetic contact sensors (but can be easily expandable to a higher number), 32 PIRs, 32 tampers, 32 sirens
- alarm can be activated/disactivated by pushbuttons, smartphone or other devices (fingerprint readers, keyboards, ...)
- the script is able to send a short IP-Cam video (15-20s) when external PIRs/Radar/sensors have been activated, showing the video in Telegram to let the owner know what happen externally. This is useful to monitor if someone (or maybe a cat!) is walking around the building while alarm is activated.
- Also, one or more displays connected to IP-Cam or NVR can be power-on when a external sensor has been activated, showing the external IP-CAMs
From linux shell, type the following commands (copy&paste):
sudo su - #get root access
apt update; apt install lua-dkjson git #install lua dkjson library and git
git clone https://github.com/CreasolTech/domoticz_lua_scripts #get all scripts from CreasolTech into domoticz_lua_scripts dir
#add some files, if they not exists
cp -n alarmSet.sh alarm_sendsnapshot.sh config_alarm.lua globalfunctions.lua globalvariables.lua script_device_alarm.lua ..
First, name all devices using the following prefixes:
- MCS_ for magnetic contact sensors, for example MCS_Door_Garage, MCS_Window_Kitchen, ...
- PIR_ for PIRs, for example PIR_Garage, PIR_Kitchen, ...
- TAMPER_ for tampers, for example TAMPER_Blinds_GroundFloor, ...
- SIREN_ for sirens, for example SIREN_External, SIREN_Internal
- ALARM_ for pushbuttons used to activate/disable alarm, for example ALARM_Pushbutton_Bedroom, ...
Configure the file scripts/lua/globalvariables.lua writing your telegram chatid, api key, ....
Configure the file scripts/lua/config_alarm.lua writing the list of sensors and your preferences
Configure the file scripts/lua/alarmSet.sh writing in the SIREN_IDX the list, separated by a space, of all idx of devices that are activated in case of alarm (external siren, internal siren, lights, buzzers, ...): in this case if a alarm occurr, it's possible to push the Off button on AlarmXXXX scene/group to activate the alarmSet.sh script that will disable all sirens/buzzer/lights that have been activated by the script_device_alarm.lua script.
Domoticz supports several protocols and hardware types.
As we produce home automation modules for home automation systems, we can say that our DomBus modules are very reliable, work also in case of power outage (just use a 12V lead-acid battery to supply the bus), very low latency and very very low power consumption.
DomBusTH for example is a cheap and compact module, no case, that can be placed on blank covers with a 3-4mm hole in the center, and it's ideal to be placed in any room to monitor temperature+humidity, has red/green/white leds that can be used as status and emergency light, 4 I/Os that can be connected to magnetic contact sensors, PIRs, pushbutton, buzzer, counters, ... and 2 open-drain outputs that can be connected to external relays.
DomBus12 is another cheap and compact module, with 7 inputs, that can be used to connect alarm sensors , and 2 open-drain outputs, that can be connected to external relays.
DomBus31 is a domotic module with 8 relays, optimized for very low power consumption: less than 10mW in stand-by (all relays OFF), and LESS THAN 500mW with all 8 relays ON: unbeatable!
As comparison, usually home automation modules consumes at least 400mW for a single relay!
DomBus23 is a sophisticated module with different types of inputs and outputs.
DomBus modules are not wireless devices: they communicates by the strong RS485 standardl at 115200bps, so they can be connected together using any kind of bus topology using a thin 4 wire shielded cable: 2 wires for 12V power supply and 2 wires to exchange data. No RF pollution, no batteries, no latency!
Using a 12V power supplier that manages a 12V lead-acid backup battery, it's possible to get a domotic network that works even in case of blackout.
When a DomBus module is connected to the network, Domoticz automatically recognized and show all ports (plug&play): each port can be configured through the Domoticz web interface. Also, to get the home automation system working even in case the controller (Domoticz) is down, it's possible to program each port to control ports on the same or other devices, like KNX network: for example, if a button is pushed for less than 0.5s, switch ON for 123 seconds the output2 of module X and output 1 of module Y, while if it's pushed for 1 second, toggle ON/OFF output 3 of module Z. Or, if temperature < 21 degrees, turn ON heater, while if temperature > 21.4 degrees turn it OFF. More info in the device page, DCMD section.