Page 1 of 1
Foscam FI9928P PTZ control
Posted: Friday 09 June 2017 16:03
by nigels0
Hi,
I'm looking at the new Foscam FI9928P camera, but before I buy it, does anyone know if Domoticz could support the following:
Camera is looking at the path, but when a motion sensor (or doorbell) is triggered, it moves to that location, zooms in for a bit - takes a snapshot, mails it to me, then returns to its original position.
Haven't seen anything in the forums that describe this (the snapshot and mailing seems possible though)
Re: Foscam FI9928P PTZ control
Posted: Friday 09 June 2017 16:19
by emme
you can use http cgi links to operate your camera:
when dorbell rings (of course DOmoticz CAN intercept such trigger), send the HTTP command to move to a specific point the camera
here is the link:
https://www.foscam.es/descarga/Foscam-I ... .11.06.pdf
I was in the mood to create a plugin for that... but I do not have the time for

Re: Foscam FI9928P PTZ control
Posted: Friday 09 June 2017 16:28
by nigels0
Thanks. I'll have a look.
Re: Foscam FI9928P PTZ control
Posted: Friday 09 June 2017 23:51
by Pjedr
I did it like this, with a foscam compatible camera:
Code: Select all
#!/bin/bash
#Doorbell ringing, send telegram notification:
if [ -e "/var/ramdrive/domoticz" ]; then RUNDIR="/var/ramdrive"; else RUNDIR="/opt/domoticz"; fi;
TEMPDIR="${RUNDIR}/temp"; SCRIPTSDIR="${RUNDIR}/scripts"
#wget -q --output-document ${TEMPDIR}/snapshot.jpg http://<user>:<password>@192.168.192.73:83/snapshot.cgi
#curl -s -m 5 http://<user>:<password>@192.168.192.73:83/snapshot.cgi > ${TEMPDIR}/snapshot.jpg
nohup ${SCRIPTSDIR}/TG_PjedrBot.sh msg <your_telegram_adress> "Kijk eens wie er voor mijn deur staat aan te bellen?" &>/dev/null
if ping -c 1 192.168.192.73 > /dev/null; then
if [ -e "${TEMPDIR}/snapshot.jpg" ]; then rm "${TEMPDIR}/snapshot.jpg"; fi
nohup wget -q --output-document ${TEMPDIR}/snapshot.jpg http://<user>:<password>@192.168.192.73:83/snapshot.cgi |>/dev/null
#ls -l /var/ramdrive/snapshot.jpg; echo "${SCRIPTSDIR}/TG_PjedrBot.sh send_photo <your_telegram_adress> ${TEMPDIR}/snapshot.jpg"
nohup ${SCRIPTSDIR}/TG_PjedrBot.sh send_photo <your_telegram_adress> ${TEMPDIR}/snapshot.jpg &>/dev/null
nohup curl -s -m 5 http://<user>:<password>@192.168.192.73:83/decoder_control.cgi?command=33 |>/dev/null; sleep 6s
if [ -e "${TEMPDIR}/snapshot.jpg" ]; then rm "${TEMPDIR}/snapshot.jpg"; fi
nohup wget -q --output-document ${TEMPDIR}/snapshot.jpg http://<user>:<password>@192.168.192.73:83/snapshot.cgi |>/dev/null
#ls -l /var/ramdrive/snapshot.jpg; echo "${SCRIPTSDIR}/TG_PjedrBot.sh send_photo <your_telegram_adress> ${TEMPDIR}/snapshot.jpg"
nohup ${SCRIPTSDIR}/TG_PjedrBot.sh send_photo <your_telegram_adress> ${TEMPDIR}/snapshot.jpg &>/dev/null
if [ -e "${TEMPDIR}/snapshot.jpg" ]; then rm "${TEMPDIR}/snapshot.jpg"; fi; sleep 6s
nohup wget -q --output-document ${TEMPDIR}/snapshot.jpg http://<user>:<password>@192.168.192.73:83/snapshot.cgi |>/dev/null
#ls -l /var/ramdrive/snapshot.jpg; echo "${SCRIPTSDIR}/TG_PjedrBot.sh send_photo <your_telegram_adress> ${TEMPDIR}/snapshot.jpg"
nohup ${SCRIPTSDIR}/TG_PjedrBot.sh send_photo <your_telegram_adress> ${TEMPDIR}/snapshot.jpg &>/dev/null
nohup curl -s -m 5 http://<user>:<password>@192.168.192.73:83/decoder_control.cgi?command=31 |>/dev/null
else
nohup ${SCRIPTSDIR}/TG_PjedrBot.sh msg <your_telegram_adress> "Webcam3 is niet online, zo raad maar wie." &>/dev/null
fi
nohup echo "Klaar" 2>&1 | >/dev/null
#EOF
I get several telegrams with pics from different angle, after taking pics camara moves back to start position.
Re: Foscam FI9928P PTZ control
Posted: Friday 09 June 2017 23:54
by Pjedr
TG_PjedrBot.sh
Code: Select all
#!/bin/bash
if [ -e "/var/ramdrive/domoticz" ]; then RUNDIR="/var/ramdrive"; else RUNDIR="/opt/domoticz-extra/"; fi
TEMPDIR="${RUNDIR}/temp"; LOGDIR="${RUNDIR}/log"; echo "`date` $*" >> ${LOGDIR}/${0##*/}.log;
TOKEN=<your_telegram_token>; CHATID=<your_chat_id>; echo "Sending Telegram: $*";
echo "param1=$1"
if [ $1 == 'send_photo' ]; then
echo curl -s -X POST "https://api.telegram.org/bot${TOKEN}/sendPhoto" -F chat_id=${CHATID} -F photo="@${3}"
curl -s -X POST "https://api.telegram.org/bot${TOKEN}/sendPhoto" -F chat_id=${CHATID} -F photo="@${3}"
echo 'Foto verzonden'
else
curl --data chat_id=${CHATID} --data-urlencode "text=$1" "https://api.telegram.org/bot${TOKEN}/sendMessage"
echo 'Tekst verzonden'
fi
Re: Foscam FI9928P PTZ control
Posted: Wednesday 21 June 2017 14:23
by nigels0
Thanks, but I'm using the newer cameras with HD and there doesn't seem an easy way to start a manual record for video or snap a picture in the CGI user guide (I'm using V1.06). Anyone have an idea?
Thanks