parent
539125f2e5
commit
2ff6641898
|
@ -118,11 +118,11 @@ function receivercd() {
|
|||
ssh pi@doorbuzz '/usr/bin/irsend SEND_ONCE pioneer "KEY_CD"'
|
||||
}
|
||||
function receivervolumeup() {
|
||||
echo "Turning reciever volume up"
|
||||
#echo "Turning reciever volume up"
|
||||
ssh pi@doorbuzz '/usr/bin/irsend SEND_ONCE pioneer "KEY_VOLUMEUP"'
|
||||
}
|
||||
function receivervolumedown() {
|
||||
echo "Turning reciever volume down"
|
||||
#echo "Turning reciever volume down"
|
||||
ssh pi@doorbuzz '/usr/bin/irsend SEND_ONCE pioneer "KEY_VOLUMEDOWN"'
|
||||
}
|
||||
function bluray() {
|
||||
|
@ -188,6 +188,29 @@ case $1 in
|
|||
;;
|
||||
off) receiveroff
|
||||
;;
|
||||
shutdown)
|
||||
echo "Receiver shutdown initiated..."
|
||||
for i in {1..90}
|
||||
do
|
||||
if [ "$(cat /run/spacestatus)" = "open" ]
|
||||
then
|
||||
echo "space open, stopping receiver shutdown"
|
||||
exit
|
||||
fi
|
||||
receivervolumedown
|
||||
done
|
||||
for i in {1..50}
|
||||
do
|
||||
if [ "$(cat /run/spacestatus)" = "open" ]
|
||||
then
|
||||
echo "space open, stopping receiver shutdown"
|
||||
exit
|
||||
fi
|
||||
receivervolumeup
|
||||
done
|
||||
receiveroff
|
||||
echo "Receiver shutdown finished."
|
||||
;;
|
||||
hdmi) receiverhdmi
|
||||
;;
|
||||
jack1) receiverjack1
|
||||
|
|
|
@ -18,6 +18,8 @@ do
|
|||
logger -t $(basename $0) "phone status change detected"
|
||||
logger -t $(basename $0) "phone ring light on"
|
||||
$(dirname "$0")/lightcommander alarm on >&2
|
||||
sleep 20 # make sure it switches off some time
|
||||
$(dirname "$0")/lightcommander alarm off >&2
|
||||
#/usr/local/bin/433send 2 15 1 1 >&2
|
||||
fi
|
||||
|
||||
|
|
|
@ -8,6 +8,34 @@ then
|
|||
# echo "usage: $0 {maindoor} {open}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
LockDir="/run/lock/$(basename "$0").run"
|
||||
P() {
|
||||
while ! mkdir "$LockDir" 2>/dev/null
|
||||
do
|
||||
LockDirStamp=$(stat -c %Y "$LockDir" 2>/dev/null)
|
||||
if [ "$LockDirStamp" != "" ] && [ "$LockDirStamp" -lt $(date --date "300 seconds ago" +%s) ]
|
||||
then
|
||||
rmdir "$LockDir"
|
||||
logger -t $(basename $0) "$$ deleting stale semaphore dir $LockDir"
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
V() {
|
||||
rmdir "$LockDir" 2>/dev/null
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
logger -t $(basename $0) "$$ semaphore dir $LockDir disappeared while running"
|
||||
fi
|
||||
}
|
||||
|
||||
function IRcmd() {
|
||||
P
|
||||
sudo /root/pidor/rcswitch-pi/send "$1" "$2" "$3" "$4"
|
||||
V
|
||||
}
|
||||
# v---- group A=1, B=2, G=7
|
||||
# v---- number
|
||||
# /root/pidor/rcswitch-pi/send 2 7 3 1 <-- 0=off 1=on
|
||||
|
@ -25,23 +53,23 @@ function dolight() {
|
|||
dolight "3dprinter" $2
|
||||
dolight "alarm" $2
|
||||
;;
|
||||
main) sudo /root/pidor/rcswitch-pi/send 2 1A 1 "$setvalue"
|
||||
main) IRcmd 2 1A 1 "$setvalue"
|
||||
if [ "$setvalue" = "0" ] # switch off alarm light when switching off all lights
|
||||
then
|
||||
sudo /root/pidor/rcswitch-pi/send 2 15A 1 "$setvalue"
|
||||
IRcmd2 15A 1 "$setvalue"
|
||||
fi
|
||||
;;
|
||||
chill) sudo /root/pidor/rcswitch-pi/send 2 1A 2 "$setvalue"
|
||||
chill) IRcmd 2 1A 2 "$setvalue"
|
||||
;;
|
||||
status) sudo /root/pidor/rcswitch-pi/send 2 2A 1 "$setvalue"
|
||||
status) IRcmd 2 2A 1 "$setvalue"
|
||||
;;
|
||||
labsocket) sudo /root/pidor/rcswitch-pi/send 2 15A 6 "$setvalue"
|
||||
labsocket) IRcmd 2 15A 6 "$setvalue"
|
||||
;;
|
||||
alarm) ( sudo /root/pidor/rcswitch-pi/send 2 15A 1 "$setvalue"
|
||||
alarm) ( IRcmd 2 15A 1 "$setvalue"
|
||||
sleep 1
|
||||
sudo /root/pidor/rcswitch-pi/send 2 15A 1 "$setvalue" ) &
|
||||
IRcmd 2 15A 1 "$setvalue" ) &
|
||||
;;
|
||||
3dprinter) sudo /root/pidor/rcswitch-pi/send 2 7 3 "$setvalue"
|
||||
3dprinter) IRcmd 2 7 3 "$setvalue"
|
||||
;;
|
||||
screen) sudo /root/pidor/scripts/beamercontrol.sh screen "$2"
|
||||
;;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# changes level2 state by the state of the main door
|
||||
# i.e. people have to leave it open to keep status open
|
||||
logger -t $(basename $0) "$1 starting"
|
||||
sleep 1 # silly way to debounce
|
||||
if [ ! -f /run/spacestatus ] # needed to init after boot
|
||||
then
|
||||
|
@ -9,6 +10,7 @@ fi
|
|||
if [ "$1" = "pushed" ] &&
|
||||
[ "$(cat /run/spacestatus)" = "open" ]
|
||||
then
|
||||
logger -t $(basename $0) "$1 set state to closed"
|
||||
FORM_action="close" /root/pidor/webserver/cgi-bin/pidor.sh
|
||||
/root/pidor/scripts/upd_status.sh
|
||||
fi
|
||||
|
@ -16,8 +18,18 @@ if [ "$1" = "released" ] && # if switch was released (the door opened, or
|
|||
[ "$(cat /run/spacestatus)" = "closed" ] # the status was closed
|
||||
# [ $(stat -c "%Y" /run/spacestatus) -lt $(date --date "1 hour ago" +%s) ] # since at least one hour
|
||||
then
|
||||
logger -t $(basename $0) "$1 waiting 60s"
|
||||
sleep 60 # wait a bit, to avoid false triggers (wind blowing, people playing with door
|
||||
nowstate="$(gpio -g read 11)"
|
||||
if [ "$nowstate" -eq 1 ]
|
||||
then
|
||||
logger -t $(basename $0) "$1 Door was closed again ($nowstate) before 60s elapsed, not setting space to open"
|
||||
exit
|
||||
fi
|
||||
logger -t $(basename $0) "$1 set state to open"
|
||||
FORM_action="open" /root/pidor/webserver/cgi-bin/pidor.sh
|
||||
/root/pidor/scripts/upd_status.sh
|
||||
# echo "intrusion detected: space was closed since some time and locked, but now is still closed but unlocked" | wall
|
||||
# logger -t $(basename $0) "INTRUSION ALARM. door was opened while status is closed"
|
||||
fi
|
||||
logger -t $(basename $0) "$1 done"
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash
|
||||
if [ "$1" = "pushed" ]
|
||||
then
|
||||
$(dirname $0)/../lightcommander receiver off
|
||||
fi
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
if [ "$1" = "pushed" ]
|
||||
then
|
||||
$(dirname $0)/../lightcommander receiver shutdown &
|
||||
fi
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/bash
|
||||
set -x
|
||||
sleep 5
|
||||
IGNORE_DOORLOCKBUTTON="no"
|
||||
LockDir="/run/$(basename "$0").run"
|
||||
|
@ -55,8 +56,11 @@ do
|
|||
if [ -x "$0".d/"$plugin" ]
|
||||
then
|
||||
"$0".d/"$plugin" "$status" "$oldstatus"
|
||||
if [ "$status" != "$oldstatus" ]
|
||||
then
|
||||
logger -t $(basename $0) "$$ called $plugin '$status' '$oldstatus'. ret=$?"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$status" = "closed" ] && (
|
||||
|
@ -109,6 +113,6 @@ then
|
|||
fi
|
||||
fi
|
||||
else
|
||||
rm -f /run/var/netdown.txt # reset
|
||||
rm -f /run/netdown.txt # reset
|
||||
fi
|
||||
V
|
||||
|
|
|
@ -24,7 +24,7 @@ then # switch status lights on, in any case
|
|||
$(dirname "$0")/../lightcommander status on
|
||||
# /usr/local/bin/433send 2 2A 1 1 #on
|
||||
fi
|
||||
if [ "$1" = "released" ] && # the door has been opened
|
||||
if [ "$1" = "released" ] # the door has been opened
|
||||
# [ "$(cat /run/spacestatus)" = "open" ] && # status is open
|
||||
# [ "$(stat -c %Y /run/spacestatus)" -gt "$(date --date "50 minutes ago" +%s)" ] && # since less than 5 minutes
|
||||
# ( [ "$(date +%s)" -gt $(/root/pidor/scripts/sunset) ] || [ "$(date +%s)" -lt $(/root/pidor/scripts/sunrise) ] )
|
||||
|
@ -35,6 +35,10 @@ then
|
|||
# /usr/local/bin/433send 2 1A 1 1 #on
|
||||
fi
|
||||
|
||||
if [ "$1" = "open" ] && [ "$2" = "open" ]
|
||||
then
|
||||
$(dirname "$0")/../lightcommander status on
|
||||
fi
|
||||
# type (2=10bit)
|
||||
# | house 1-16 (the dial thingie)
|
||||
# | |group A-P (the dial thingie)
|
||||
|
|
Loading…
Reference in New Issue