hAlarm hAlarm
« Home Alarm System »

How to

How does it work

hAlarm is a software application based on PHP/JS, as such it runs of top of a webserver.

It reads your alarm central inputs and take actions. The communcation applications aren't part of the projet. But, in the guide, i explain how recover an old centrale using an arduino, you may also use different method.

hAlarm requiere soft keypad, like a tablet or a phone. Thoses ones should be placed and reachable on all entrances and serve as arming/disarming your system.

As it heavlly rely LAN network, you can strengh it by using an UPS to power your logger, your router, the power of your detectors and sirens.
The WAN side could also be secured by using a GSM shield or via Automate for Android (See bellow).

We need to speak a common language

The data understood should be in JSON. Where I correspond to inputs (eg detectors and sensors), O to outputs (eg relays for sirens, flash..)
eg: {"I0":"off", "I1":"on", "I2":"off", "I3":"off", "O1":"off", "O2":"off", "O3":"off"}
T values are for tampers, which i will explain the behaviour later on.

The only values accepted are 'on' (When detection or active output) and 'off', in lower case.

The communcation app

Once you can retrieve data from your centrale, you have to make sure the communcation app can be run and able to retrieve data as 'http' user. There is good hints on the help page. Typically http user can't access /dev/ttyUSB or ttyACM by default.

Configure hAlarm

Then configure hAlarm : all detailled infos are in config/config.php file and setup different scenario like a day and night mode with config/scenarioX.php.


The halarm directory should only be accessible by LAN.
In nginx you can do so :

The halarmWAN/ directory can be openned to allow remote access. This one must be secured by HTTP authentication, mind to use a really complicated password as it could be force attack.
Create .htpasswd credentials and set HTTP authentication to allow WAN access
In nginx :


The tampers are contacts that monitor intrusion on your installation. Like a burglar that would open the outdoor siren and cut the wires.
This monitoring should be done continuously and as hAlarm only run when the system is arm, it can't do that job.
So, your centrale should push tamper's detection to the logger.

It can easy be done with an arduino using an ethernet shield with this kind of code :

The configuration of tamper action is available in config/tamper.php.


Automate for Android, is a nifty tool that can turn any android into a powerfull automation device
I made a flow that will allow to reconnect the keypad if the connection is lost with hAlarm for whatever reason and also send SMS in case of alarm !
Obviously, you should have a SIM in your keypad device.
The script will awake your keypad(s) when needed and allowing them to put the screen in sleep mode.
Credit: Jean-Marc Louviaux