AlarmPI is a home security system based on Raspberry PI. It supports wired sensors (PIR, Magnetic etc.) and wireless through MQTT or Hikvision. It is controlled with a Web UI, a Android Application, or through HTTP & MQTT messages. When the alarm detects movement, it supports the following events:
- Enables the Serene
- Send Mail
- VoIP Calls
- Send MQTT message
It is written in python and supports both python 2.7 & python 3.6. There is also the option of having more than one user by editing the server.json file accordingly.
The Web Interface of the alarm has all the features that are needed to configure and use the home security. It supports real time events of the sensors, the logs and their status. It also works as an smartphone application from the browser: Add to Home screen
The android application is very light and fast and it is recomended for the phone, but it has no real time updates. You can download it from here: Play Store
The source code for the application is here: https://github.com/bkbilly/AlarmPI-Android
These are the possible mqtt messages. First you will have to setup the MQTT state_topc & command_topic. The ones I will be using for this example are: state_topic: home/alarm command_topic: home/alarm/set
Messages with topics sent by AlarmPI:
- home/alarm disarmed
- home/alarm triggered
- home/alarm armed_away
- home/alarm/sensor/Bedroom on
- home/alarm/sensor/Bedroom off
Messages that is subscribed to:
- home/alarm/set ARM_AWAY
- home/alarm/set ARM_HOME
- home/alarm/set/sensor/Bedroom on
- home/alarm/set/sensor/Bedroom off
It can also be used with IFTTT using the Webhooks module like this:
https://admin:[email protected]:5000/activateAlarmOnline
https://admin:[email protected]:5000/deactivateAlarmOnline
My personal favourite is to control it with Google Assistant.
It is also controlled with MQTT commands with the Home-Assistant component: 'MQTT Alarm Control Panel'. On Home-Assistant the configuration is like so:
alarm_control_panel:
- platform: mqtt
name: "AlarmPI"
state_topic: "home/alarm" # The State Topic from AlarmPI
command_topic: "home/alarm/set" # The Command Topic from AlarmPI
payload_arm_home: "ARM_HOME" # This is not used
payload_arm_away: "ARM_AWAY"
With this command on your terminal you can install and update the application with my latest commit.
bash <(curl -s "https://raw.githubusercontent.com/bkbilly/AlarmPI/master/install.sh")
I have built the sipcall for the Raspberry Pi, so hopefully you will not have to build it yourself. To test it, execute this replacing the (myserver, myusername, mypassword, mynumbertocall):
./sipcall -sd myserver -su myusername -sp mypassword -pn mynumbertocall -s 1 -mr 2 -ttsf ../play.wav
ui.https
(bool) Use HTTPsui.port
(bool) The portusers[user]
(str) The username for loginusers[user].pw
(str) the password for loginusers[user].logfile
(str) The name of the log fileusers[user].settings
(str) The name of the settings file
serene.enable
(bool) Enable serene activationserene.pin
(int) Output pin of the serenemail.enable
(bool) Enable mail alertsmail.smtpServer
(str) SMTP of your mailmail.smtpPort
(int) SMTP Port of your mailmail.username
(str) Username of your mailmail.password
(str) Password of your mailmail.recipients
(list str) List of recipents. eg. ["[email protected]", "[email protected]"]mail.messageSubject
(str) Subject of the sent mailmail.messageBody
(str) Body message of the sent mailvoip.enable
(bool) Enable VoIP alertsvoip.domain
(str) VoIP servervoip.username
(str) VoIP usernamevoip.password
(str) VoIP passwordvoip.numbersToCall
(list str) List of numbers to call. eg. ["3849392849", "3582735872"]voip.timesOfRepeat
(str) How many times the recorded message is playedsensors[uuid]
(str) The specific ID of the sensor (auto created)sensors[uuid].name
(str) Name of the sensorsensors[uuid].type
(str) The type of the sensor (GPIO, MQTT, Hikvision)sensors[uuid].enabled
(bool) Set the sensor as Active/Inactivesensors[uuid].online
(bool) The online status of the sensorsensors[uuid].alert
(bool) Automatically created. Status of the sensorsensors[uuid].pin
(str) [GPIO] Input pin of the sensorsensors[uuid].ip
(str) [Hikvision] IP of the Hikvision camerasensors[uuid].user
(str) [Hikvision] Username of the Hikvision camerasensors[uuid].pass
(str) [Hikvision] Password of the Hikvision camerasensors[uuid].state_topic
(str) [MQTT] The unique topic for the sensorsensors[uuid].message_alert
(str) [MQTT] The message for alertsensors[uuid].message_noalert
(str) [MQTT] The message for stop alertmqtt.enable
(bool) Enable the mqtt servermqtt.authentication
(bool) Use authentication for the mqtt servermqtt.state_topic
(str) The MQTT topic for the state (disarmed, triggered, armed_away)mqtt.command_topic
(str) The MQTT topic for the commands (DISARM, ARM_AWAY)mqtt.host
(str) IP Address of the mqtt servermqtt.port
(int) Port of the mqtt servermqtt.username
(str) Username of the mqtt server if authentication is truemqtt.password
(str) Passwrd of the mqtt server if authentication is truesettings.alarmArmed
(bool) If true, activate the alarmsettings.alarmTriggered
(bool) If true, there is an intrudersettings.timezone
(str) The timezone for the log file based on pytz
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D