-
Notifications
You must be signed in to change notification settings - Fork 50
Description
This issue is related to both the web interface and the HA integration camera on/off switches for Privacy
The 0.1.7 camera are running a process called "ProcessGuard" which restarts failed processes. As I understand the flow if you use the web interface or the HA integration to switch the camera off that runs the script privacy.sh which stops the rtsp streams and the alarmserver process. The camera stops recording video and there is no stream to view. That works fine in 0.1.5. However in 0.1.7 privacy.sh is run the same way and the processes are stopped temporarily until the ProcessGuard restarts them in about 10 seconds.
So although you have set the camera to privacy mode ie off, the camera is still operating.
I have made some changes to privacy.sh for my cameras to overcome this issue. Not necessarily the most efficient but it works. I have tested this script on camera running 0.1.7 and the camera now turn to privacy mode when you switch them off using the web or HA.
I tried to make the changes to the script backwardly compatible and I have tested it on 0.1.5 cameras and the privacy switch still works as intended.
Hopefully something like this can be included in a future release. Or alternatively a test for the status of the switch in the ProcessGuard process.
My new privacy script is
#!/bin/sh
RES=""
start_rtsp()
{
/mnt/mtd/ipc/app/rtspd >/dev/null &
}
stop_rtsp()
{
killall rtspd
}
start_alarmserver()
{
ps | grep 'AlarmServer' | grep -v 'grep' | awk '{ printf $1 }' |xargs kill -CONT
}
stop_alarmserver()
{
ps | grep 'AlarmServer' | grep -v 'grep' | awk '{ printf $1 }' |xargs kill -SIGSTOP
}
start_ProcessGuard()
{
ps | grep 'ProcessGuard' | grep -v 'grep' | awk '{ printf $1 }' |xargs kill -CONT 2> /dev/null
}
stop_ProcessGuard()
{
ps | grep 'ProcessGuard' | grep -v 'grep' | awk '{ printf $1 }' |xargs kill -SIGSTOP 2> /dev/null
}
if [ $# -ne 1 ]; then
exit
fi
if [ "$1" == "on" ] || [ "$1" == "yes" ]; then
if [ ! -f /tmp/privacy ]; then
touch /tmp/privacy
touch /tmp/snapshot.disabled
stop_ProcessGuard
stop_rtsp
stop_alarmserver
fi
elif [ "$1" == "off" ] || [ "$1" == "no" ]; then
if [ -f /tmp/privacy ]; then
rm -f /tmp/snapshot.disabled
start_ProcessGuard
start_alarmserver
start_rtsp
rm -f /tmp/privacy
fi
elif [ "$1" == "status" ] ; then
if [ -f /tmp/privacy ]; then
RES="on"
else
RES="off"
fi
fi
if [ ! -z "$RES" ]; then
echo $RES
fi