Although this page is available in multiple languages, please check the English version to get the most up-to-date version.


Smartphone panel for the alarm system using Domoticz free softwareThe goal is to build yourself a complete alarm system that is reliable, scalable, cheap and feature-rich.

Using the following scripts it's possible to integrate all alarm system functions in a Domoticz controller running in a RaspberryPI (single board computer with 2.3W power consumption) , RockPIS (tiny single board computer with only 400mW power consumption) or another type of hardware.

It manages 3 different types of alarm:

  1. Away, when nobody is home
  2. Night, when everybody is home sleeping
  3. Day, when somebody is home and want to detect any intrusion attempt

Also, in case of a sensor activation, the system can record small videos, recode with 2x speed, and send it to a Telegram group/channel, so it's possible to check what happen on the smartphone. This is useful expecially with outdoor sensors.

Why Domoticz? Because Domoticz is free, fast and very very reliable: it's written in C++ (not python, java or other interpretated languages) and can be updated with no pain. Also it supports LUA scripting that permits to write easy-to-manage automations in a clear/easy language that can be understood by anyone. Domoticz user interface looks old, not nice, but it's really strong and this is the most important thing to save marriage when home is highly-domotized ;-)
The alarm system is made by a configuration file and some LUA and 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.

Using DomBus modules to interface alarm sensors it's possible to get reliable home automation wired network, with bus cable that interconnect all sensors carrying both data and 12V power supply: using a 12V lead acid backup battery, the system will work even in case of power outage.  In any case, the alarm scripts described below works with any kind of sensors. Last, but not least, DomBus modules permits to achieve a very very low power consumption: each DomBus module typically consume about 10mW to manage many inputs and outputs, much lower than WiFi modules that consumes 400mW or more. Below a screenshot that shows some of our products with prices.

Of course, it's possible to use for the alarm system all supported devices, like Shelly, Sonoff, Denkovi, KMTronic, RaspberryPI GPIOs, ...

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, ... For example is very useful to have pushbuttons beside the bed to activate/disactivate NIGHT alarm (check the picture below, using DomBusTH to do that).

Check the section below to know how to add icons on your smartphone to activate/disactivate alarm! Tap on a icon to activate the AWAY alarm, tap on another icon to disable alarm.

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: to make it easier to check what happen when a sensor activates, 24 seconds of video is recorded with speed 2x, so it's possible to check it in only 12 seconds.

Telegram channel with alarm notifications


telegram app showing alarm status and videos


  1. 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).
  2. full notifications through Telegram app
  3. manages up to 128 magnetic contact sensors (but can be easily expandable to a higher number), 32 motion sensors (PIR), 32 tampers, 32 sirens
  4. alarm can be activated/disactivated by pushbuttons, smartphone or other devices (fingerprint readers, keyboards, ...)
  5. the script is able to send a short IP-Cam video (24s) 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. To get a fast video checking, video are recorded with speed 2x!
  6. 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


To get a reliable alarm system, I believe we can't use Microsoft Windows. The installation instructions covers only Linux operating system (Raspbian, Debian, Ubuntu or similar). It's possible to get a microSD already programmed with Linux+Domoticz+Firewall+backup system+automation scripts from , where are also available some domotic kits that include the controller, power supply, ...

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
cd ~pi/domoticz/scripts/lua
git clone #get all scripts from CreasolTech into domoticz_lua_scripts dir
cd domoticz_lua_scripts
#add some files, if they not exists
cp -n config_alarm.lua globalfunctions.lua globalvariables.lua alarm.lua script_device_master.lua ..
cd ..


First, all devices should be named 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/ 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 script that will disable all sirens/buzzer/lights that have been activated by the script_device_alarm.lua script.

Screenshot of the configuration file for the free burglar alarm system using Domoticz


Domoticz supports several protocols and hardware types.
As we produce home automation modules for home automation systems, we suggest to use our DomBus modules that are very reliable, work 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: for example, in a house the power consumption is only 1.02W for 23 DomBus modules managing 113 inputs, 67 outputs, 19 sensors and 1 EV charging.

DomBus37 is a module designed specifically for alarm system, with 11x inputs (doors/windows/blinds magnetic contact sensors, PIRs, tamper, ...), ability to supply and monitor power usage of an external siren, 3x relay outputs and 3x AC inputs (to monitor power outages on heat pump, fridges, whole house, ...).

DomBus37 alarm module for home automation systems, with 11 inputs, siren power supply and monitor, 3 outputs, 3 AC inputs

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, ... 2 open-drain outputs that can be connected to external relays, and a touch sensor to use that device as a multi-function pushbutton switch.

Creasol DomBusTH domotic module to realize a powerful and cheap burglar alarm system


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.

Creasol DomBus12 application note: PIR, magnetic contact sensors, to realize a burglar alarm system using Domoticz home automation


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.

Although they are made in Italy, DomBus modules are also cheap! They are available in two types: using DomBus protocol (working with Domoticz) and Modbus standard protocol (working with Home Assistant, Node-RED, OpenHAB, ...). Below an old screenshot from our store:

A screenshot of our products with prices, from our


DomBus network and connection - Home automation system

Add icons to smartphone to enable and disable alarm system

It's very useful to have in the smartphone an icon to enable away alarm when leaving the house, and one to deactivate the alarm system before entering the house.

Adding icons on the smartphone to have HTTP URL shortcuts to some functions, such as alarm on and offDomoticz supports many HTTP commands to activate scenes, groups, switches, ... and smartphones have many applications that can be used to call such URLs.

  • Install on your smartphone the HTTP Shortcuts app
  • Create a new regular shortcut, specifying a name (in the example Alarm Away)
  • Specify the URL to call the Alarm Away group/scene (you have to edit that group/scene to get its idx, 13 in the example) writing the right parameters (IP, PORT, idx)
  • Enable base autentication, specifying the domoticz username and password
  • Choose an icon
  • Save, and add the icon to your smartphone home screen.
  •  Duplicate this icon, edit the new one, change name to Alarm Off, change icon, change URL replacing On with Off , save and add icon to the home screen.

Now you have two icons on the smartphone, one to activate alarm system and one to disable it.