A pi based program for monitoring contact inputs from a wired alarm system and sending those events to a home automation platform
- Watches for contact closure on a configured gpio pin
- Register a callback type on open/close
- Web ui to see status
- Web api request to see status (GET /status)
See config example. The config.json may be placed in /etc/alarmpi, .alarmpi in your $HOME directory, or in the current working directory
In extreme cases you may need to set the following, the default values are below
"AppName": "alarmpi",
"HttpActionTimeout": "15s",
"Chip": "gpiochip0"
Expects a config entry like below, with the maker api pasted in and %s replacing the device id and the command
"integrations": {
"hubitat": "http://192.168.1.5/apps/api/8/devices/%s/%s?access_token=25345qwe469a73"
}
}
Copy binary to a suitable location, service file included for linux/raspi
It's a good idea to add to your /boot/config.txt the following
gpio=0-53=ip,pd
This instructs the pi to set pins 0-53 as inputs and pull down. Alter as necessary for your install
Attach one leg of the sensor to 3.3v and the other to a GPIO PIN (Care should be taken here, if your pins are in some weird state and not reading input you can damage things)
Using pir motion sensors that have 3 leges, connect in the following manner:
- leg 1 v+ to 5v on the pi
- leg 2 high/low to GPIO pin of choice
- leg 3 gnd to gnd on pi
This is an example of a product that works
To run execute on the command line, the default port is 8000, but can be changed in the configuration
./alarmpi
Fill out a entry for each pin in the interface
The label to be presented i.e Hallway, Front Door, etc.
The type of event to trigger on, options are "http" for making a HTTP GET request or "exec" for executing a local program
Http will execute the url provided in the "Open" and "Close fields"
Will execute a appropriate command on the maker api for the provided id in "Open" and "Closed" fields
Exec will execute a script named in "Open" or Closed and pass in the following arguments
- Name: gpio16
- State: open|closed
- Label: Front Door
It will essentially execute as if you were running the following
./callback_script.sh gpio16 open "Front Door"