phone_notification is first method, was later replaces by doorbuzz_wrapper from the doorbuzz project
parent
f5666ab147
commit
4dc5da4a26
5 changed files with 68 additions and 1 deletions
@ -0,0 +1,25 @@ |
||||
#!/bin/bash |
||||
# put into /root/.ssh/authorized_keys this: |
||||
# command="/root/pidor/scripts/doorbuzz_wrapper.sh" ssh-rsa AAAAB3.......................7fEbKbG2UcaO4d0YZ67T pi@doorbuzz |
||||
|
||||
while read cmd |
||||
do |
||||
if [ "$cmd" = "spacestatus" ] |
||||
then |
||||
cat /var/run/spacestatus |
||||
fi |
||||
|
||||
if [ "$cmd" = "flashon" ] |
||||
then |
||||
logger -t $(basename $0) "phone status change detected" |
||||
logger -t $(basename $0) "phone ring light on" |
||||
/usr/local/bin/433send 2 15 1 1 >&2 |
||||
fi |
||||
|
||||
if [ "$cmd" = "flashoff" ] |
||||
then |
||||
logger -t $(basename $0) "phone status change detected" |
||||
logger -t $(basename $0) "phone ring light off" |
||||
/usr/local/bin/433send 2 15 1 0 >&2 |
||||
fi |
||||
done |
@ -0,0 +1,33 @@ |
||||
#!/bin/bash |
||||
|
||||
url=http://10.2.113.137 |
||||
run_file="/var/run/phone_ringing_status" |
||||
|
||||
while true |
||||
do |
||||
sleep 1 |
||||
if ! [ "$(cat /var/run/spacestatus)" = "open" ]; then |
||||
continue |
||||
else |
||||
if ! [ -e "$run_file" ]; then |
||||
touch $run_file |
||||
fi |
||||
|
||||
curl -q "$url" 2>/dev/null | grep Ringing |
||||
new_status=$? |
||||
old_status=$(cat ${run_file}) |
||||
|
||||
if [ "$new_status" -eq "$old_status" ]; then |
||||
continue |
||||
fi |
||||
logger -t $(basename $0) "phone status change detected" |
||||
if [ "$new_status" -eq 0 ]; then |
||||
logger -t $(basename $0) "phone ring light on" |
||||
/usr/local/bin/433send 2 15 1 1 |
||||
else |
||||
logger -t $(basename $0) "phone ring light off" |
||||
/usr/local/bin/433send 2 15 1 0 |
||||
fi |
||||
echo $new_status > ${run_file} |
||||
fi |
||||
done |
Loading…
Reference in new issue