1
0
mirror of https://github.com/fritz-smh/yi-hack.git synced 2026-08-11 08:23:02 +00:00

Merge pull request #81 from tuaminx/voice-notification

Voice notification, crond, led flash for error, log storage status
This commit is contained in:
Fritz SMH
2016-10-04 21:35:48 +02:00
committed by GitHub
17 changed files with 102 additions and 69 deletions
+59 -26
View File
@@ -26,7 +26,6 @@
# * strem audio from network to camera ==> svoxpico ?
# * create a watchdog script
led() {
# example usage :
# led -boff -yon
@@ -83,6 +82,7 @@ telnetd &
### configure timezone
echo "$(get_config TIMEZONE)" > /etc/TZ
### get time is done after wifi configuration!
@@ -113,6 +113,10 @@ cd /home/3518
# added :
himm 0x20050074 0x06802424
### Let ppl hear that we start
/home/rmm "/home/hd1/voice/welcome.g726" 1
/home/rmm "/home/hd1/voice/wait.g726" 1
### start blinking blue led for configuration in progress
#/home/led_ctl -boff -yon &
led -yoff -bfast
@@ -256,12 +260,16 @@ log "Debug mode = $(get_config DEBUG)"
# first, configure wifi
### Let ppl hear that we start connect wifi
/home/rmm "/home/hd1/voice/connectting.g726" 1
log "Check for wifi configuration file...*"
log $(find /home -name "wpa_supplicant.conf")
log "Start wifi configuration..."
log $(/home/wpa_supplicant -B -i ra0 -c /home/wpa_supplicant.conf )
res=$(/home/wpa_supplicant -B -i ra0 -c /home/wpa_supplicant.conf )
log "Status for wifi configuration=$? (0 is ok)"
log "Wifi configuration answer: $res"
log "Do network configuration 1/2 (ip and gateway)"
#ifconfig ra0 192.168.1.121 netmask 255.255.255.0
@@ -289,6 +297,12 @@ log "Done"
log "New datetime is $(date)"
### Check if reach gateway and notify
ping -c1 -W2 $(get_config GATEWAY) > /dev/null
if [ 0 -eq $? ]; then
/home/rmm "/home/hd1/voice/wifi_connected.g726" 1
fi
### set the root password
root_pwd=$(get_config ROOT_PASSWORD)
[ $? -eq 0 ] && echo "root:$root_pwd" | chpasswd
@@ -301,13 +315,6 @@ led -yoff -bon
### Rename the timeout sound file to avoid being spammed with chinese audio stuff...
[ -f /home/timeout.g726 ] && mv /home/timeout.g726 /home/timeout.g726.OFF
### Rmm stuff
# without this, most things does not work (http server, rtsp)
# It starts to use the cloud (which is no more launched) so you will find timeout in the logs
cd /home
./rmm &
sync
### Launch FTP server
@@ -355,22 +362,6 @@ cd /home
./record_event &
./mp4record 60 &
### Launch script to check for motion the last minute
/home/hd1/test/check_motion.sh &
### Rtsp server
cd /home/hd1/test/
log "Start rtsp server : rtspsvr${RTSP_VERSION}..."
if [[ $(get_config DEBUG) == "yes" ]] ; then
./rtspsvr${RTSP_VERSION} > /${LOG_DIR}/log_rtsp.txt 2>&1 &
else
./rtspsvr${RTSP_VERSION} &
fi
sleep 1
log "Check for rtsp process : "
ps | grep rtspsvr | grep -v grep >> ${LOG_FILE}
sleep 5
### Some configuration
@@ -395,14 +386,56 @@ himm 0x20030048 0x302
rm /home/hd1/FSCK*
# Check and create crontabs folder
crontab_folder="/var/spool/cron/crontabs"
if [ ! -r "$crontab_folder" ]; then
mkdir -p "$crontab_folder"
fi
# Start crond daemon
/usr/sbin/crond -b
### Final led color
led $(get_config LED_WHEN_READY)
### Check if reach gateway and notify
ping -c1 -W2 $(get_config GATEWAY) > /dev/null
if [ 0 -eq $? ]; then
led $(get_config LED_WHEN_READY)
/home/rmm "/home/hd1/voice/success.g726" 1
else
led -boff -yfast
fi
### Rmm stuff
# without this, most things does not work (http server, rtsp)
# It starts to use the cloud (which is no more launched) so you will find timeout in the logs
# This must be launched after all "/home/rmm" command calls
cd /home
./rmm &
### Rtsp server
cd /home/hd1/test/
log "Start rtsp server : rtspsvr${RTSP_VERSION}..."
if [[ $(get_config DEBUG) == "yes" ]] ; then
./rtspsvr${RTSP_VERSION} > /${LOG_DIR}/log_rtsp.txt 2>&1 &
else
./rtspsvr${RTSP_VERSION} &
fi
sleep 1
log "Check for rtsp process : "
ps | grep rtspsvr | grep -v grep >> ${LOG_FILE}
sleep 5
### List the processes after startup
log "Processes after startup :"
ps >> ${LOG_FILE}
### List storage status
log "Storage status :"
df -h >> ${LOG_FILE}
### to make sure log are written...
sync
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.