Initial commit

This commit is contained in:
polyfloyd 2025-04-06 12:47:07 +02:00
commit 0a36fb9729
15 changed files with 88 additions and 0 deletions

10
armed.d/10_log Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
PROM="$1"
CODE="$2"
DESCR="$3"
SIA_CODE_STR="$4"
SIA_CODE_DESCR="$5"
DATE=`date`
echo "$DATE: Alarm event: $PROM $CODE: $DESCR -- $SIA_CODE_STR: $SIA_CODE_DESCR" >> "/var/log/alarm.log"

3
armed.d/10_mqtt Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
/usr/local/bin/mqtt-simple -r -h mqtt.bitlair.nl -p 'bitlair/alarm' -m "armed $2"

4
armed.d/20_entrance_logos_off Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
mqtt-simple -h mqtt.bitlair.nl -p bitlair/power/shelly/02/command/switch:0 -m off
mqtt-simple -h mqtt.bitlair.nl -p bitlair/power/shelly/04/command/switch:0 -m off

3
armed.d/20_statefile Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
echo -n 0 > /tmp/alarmdisarmed

View file

@ -0,0 +1,3 @@
#!/bin/bash
mqtt-simple -h mqtt.bitlair.nl -p "bitlair/power/trapleds/cmnd/Power1" -m "OFF"

6
armed.d/24_bar_off Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
# will not work yet due to SSH key not being on there
#ssh -o ConnectTimeout=1 root@bank-pi.bitlair.nl shutdown -h now
#sleep 10
mqtt-simple -h mqtt.bitlair.nl -p bitlair/power/shelly/01/command/switch:0 -m off

3
armed.d/25_switch_off Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
# 48p switch with all outlets on it
apc-switch 24 off

10
disarmed.d/10_log Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
PROM="$1"
CODE="$2"
DESCR="$3"
SIA_CODE_STR="$4"
SIA_CODE_DESCR="$5"
DATE=`date`
echo "$DATE: Alarm event: $PROM $CODE: $DESCR -- $SIA_CODE_STR: $SIA_CODE_DESCR" >> "/var/log/alarm.log"

View file

@ -0,0 +1,4 @@
#!/bin/bash
mqtt-simple -h mqtt.bitlair.nl -p bitlair/power/shelly/02/command/switch:0 -m on
mqtt-simple -h mqtt.bitlair.nl -p bitlair/power/shelly/04/command/switch:0 -m on

3
disarmed.d/20_statefile Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
echo -n 1 > /tmp/alarmdisarmed

3
disarmed.d/20_switch_on Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
# 48p switch with all outlets on it
apc-switch 24 on

View file

@ -0,0 +1,3 @@
#!/bin/bash
mqtt-simple -h mqtt.bitlair.nl -p "bitlair/power/trapleds/cmnd/Power1" -m "ON"

3
disarmed.d/24_bar_on Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
mqtt-simple -h mqtt.bitlair.nl -p bitlair/power/shelly/01/command/switch:0 -m on

3
disarmed.d/50_mqtt Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
/usr/local/bin/mqtt-simple -r -h mqtt.bitlair.nl -p 'bitlair/alarm' -m "disarmed $2"

27
siahsd_handler.sh Executable file
View file

@ -0,0 +1,27 @@
#!/bin/bash
set -eu
HOOKS_DIR=`dirname "$0"`
PROM="$1"
CODE="$2"
DESCR="$3"
SIA_CODE_STR="$4"
SIA_CODE_DESCR="$5"
# Ignore communication tests.
if [[ ! "$CODE" =~ "RP" ]]; then
irc-say "Alarm event: $CODE -- $SIA_CODE_STR: $SIA_CODE_DESCR"
fi
case "$CODE" in
C[LAFJKQS]*):
run-parts "$HOOKS_DIR/armed.d" --verbose "--arg=$1" "--arg=$2" "--arg=$3" "--arg=$4" "--arg=$5"
;;
O[AJKPQS]*):
run-parts "$HOOKS_DIR/disarmed.d" --verbose "--arg=$1" "--arg=$2" "--arg=$3" "--arg=$4" "--arg=$5"
;;
esac