Thanks @sp00025, I didn't realize it was that easy. I copy all the files in SDcard to my SD card root like your github README.md instructs. Then I added executable permissions to the scripts and binaries.
Then I added this script I namedset_time
to/mnt/disc1
Code:#!/bin/sh # Sync with local ntp server while true; do ntpd -q -p 192.168.10.1 /mnt/disc1/busybox sleep 15 ntpd -q -p 192.168.10.1 T=$(date +"%Y-%m-%d %H:%M:%S") TZ='EST-5EDT-4,M3.2.0/02:00:00,M11.1.0/02:00:00' export TZ date -s "$T" /mnt/disc1/busybox sleep 21600 done
Then I edited thedhcp.script
in/npc
like this.
Code:#!/bin/sh # udhcpc script edited by Tim Riker <Tim@Rikers.org> [ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 RESOLV_CONF="/mnt/ramdisk/resolv.conf" [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" [ -n "$subnet" ] && NETMASK="netmask $subnet" case "$1" in deconfig) /sbin/ifconfig $interface 0.0.0.0 killall telnetd ;; renew|bound) /sbin/ifconfig $interface $ip $BROADCAST $NETMASK if [ -n "$router" ] ; then echo "deleting routers" while route del default gw 0.0.0.0 dev $interface ; do : done metric=0 for i in $router ; do route add default gw $i dev $interface metric $((metric++)) done fi echo -n > $RESOLV_CONF [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF for i in $dns ; do echo adding dns $i echo nameserver $i >> $RESOLV_CONF done echo "** Start telnetd" /usr/sbin/telnetd echo "** Disable WLAN" /sbin/ifconfig wlan0 down # echo "** Start ftpd" # /mnt/disc1/busybox tcpsvd -vE 0.0.0.0 21 ftpd -w / # echo "** Start monitoring" # /mnt/disc1/MONITORING/parse_push & echo "** Start Cron" /mnt/disc1/busybox crond -L /mnt/disc1/CRON/cron.log -l 0 -c /mnt/disc1/CRON/ echo "** Start ntpd" /mnt/disc1/set_time ;; esac exit 0
The line
kicks off my script and syncs time every 6hrs to my local ntp server.Code:echo "** Start ntpd" /mnt/disc1/set_time
I was wrong about being able to use trial and error to setsleep(1)
just right so UTC0 time would never be displayed and time sync would be seamless. Unfortunately ntp isn't able to sync in the same amount of time every time so I actually had to add extra time to sleep just to make surentpd
had enough time to set UTC0 before running the rest of the script. This is why I chose to run the script every 6 hrs instead of every 15 mins, I don't think there is anyway to make the time sync seamless where UTC0 time is never displayed. UTC time is only displayed for a second or two every 6 hrs, no way around it I guess.¯\_(ツ)_/¯
Maybe if I have more time I'll figure outCron
and use that instead of awhile
loop. Usingwhile
is a very inefficient why of creating a loop.
I might be wrong about this, but it appears to me you can install the patched FW without the app by powering on the device with the SD card inserted with the npcupg.bin file on it and holding down the reset button on the back of the device for about 30 seconds then letting it run for a few mins.
If your not comfortable with Linux in command line this will be a steep learning curve. I broke down exactly what I did in the post above, so if it doesn't make sense to you and you can't follow your probably going to have a really hard time.just wondering if all your time fixes would be added to the bin file that could easily be updated
vi
isn't the easiest editor to figure out either.Thanks @sp00025, I didn't realize it was that easy. I copy all the files in SDcard to my SD card root like your github README.md instructs. Then I added executable permissions to the scripts and binaries.
Then I added this script I namedset_time
to/mnt/disc1
Code:#!/bin/sh # Sync with local ntp server while true; do ntpd -q -p 192.168.10.1 /mnt/disc1/busybox sleep 20 ntpd -q -p 192.168.10.1 T=$(date +"%Y-%m-%d %H:%M:%S") TZ='EST-5EDT-4,M3.2.0/02:00:00,M11.1.0/02:00:00' export TZ date -s "$T" /mnt/disc1/busybox sleep 21600 done
Then I edited thedhcp.script
in/npc
like this.
Code:#!/bin/sh # udhcpc script edited by Tim Riker <Tim@Rikers.org> [ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 RESOLV_CONF="/mnt/ramdisk/resolv.conf" [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" [ -n "$subnet" ] && NETMASK="netmask $subnet" case "$1" in deconfig) /sbin/ifconfig $interface 0.0.0.0 killall telnetd ;; renew|bound) /sbin/ifconfig $interface $ip $BROADCAST $NETMASK if [ -n "$router" ] ; then echo "deleting routers" while route del default gw 0.0.0.0 dev $interface ; do : done metric=0 for i in $router ; do route add default gw $i dev $interface metric $((metric++)) done fi echo -n > $RESOLV_CONF [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF for i in $dns ; do echo adding dns $i echo nameserver $i >> $RESOLV_CONF done # echo "** Start telnetd" # /usr/sbin/telnetd echo "** Disable WLAN" /sbin/ifconfig wlan0 down # echo "** Start ftpd" # /mnt/disc1/busybox tcpsvd -vE 0.0.0.0 21 ftpd -w / # echo "** Start monitoring" # /mnt/disc1/MONITORING/parse_push & # echo "** Start Cron" # /mnt/disc1/busybox crond -L /mnt/disc1/CRON/cron.log -l 0 -c /mnt/disc1/CRON/ echo "** Start ntpd" /mnt/disc1/set_time ;; esac exit 0
The line
kicks off my script and syncs time every 6hrs to my local ntp server.Code:echo "** Start ntpd" /mnt/disc1/set_time
I was wrong about being able to use trial and error to setsleep(1)
just right so UTC0 time would never be displayed and time sync would be seamless. Unfortunately ntp isn't able to sync in the same amount of time every time so I actually had to add extra time to sleep just to make surentpd
had enough time to set UTC0 before running the rest of the script. This is why I chose to run the script every 6 hrs instead of every 15 mins, I don't think there is anyway to make the time sync seamless where UTC0 time is never displayed. UTC time is only displayed for a second or two every 6 hrs, no way around it I guess.¯\_(ツ)_/¯
Maybe if I have more time I'll figure outCron
and use that instead of awhile
loop. Usingwhile
is a very inefficient why of creating a loop.
You could be right, I'll have to research it some more. Calling a script from within a script is not something I usually do, but from what I can tell through testing it doesn't seem to matter whether IThere is a bug in your script.
source /mnt/disc1/set_time
or not from inside dhcp.script
, it uses the variables consistently either way. ¯\_(ツ)_/¯
But from my understanding of what I've read so far regarding source
it doesn't seem to apply to this situation, sourcing is used in the few cases where you want a script to affect the shell you are running it from, but I'm not trying to pass variables from set_time.sh
to dhcp.script
and I'm using the absolute path rather than a $PATH variable to execute the script. I also want it running as a separate process.sleep 5
to the beginning of the script because sometimes the script runs before the network is up after a reboot. I also realized I needed to add unset TZ
to the end of the the loop. Other wise it would subtract my TZ offset from the previously set TZ offset essentially doubling the offset once the script looped. I edited my set_time
script in the post you quoted just incase someone tries to use it via copy paste before they get around to seeing this one.#!/bin/sh
# Sync with local ntp server
/mnt/disc1/busybox sleep 5
while true;
do
ntpd -q -p 192.168.10.1
/mnt/disc1/busybox sleep 8
ntpd -q -p 192.168.10.1
T=$(date +"%Y-%m-%d %H:%M:%S")
TZ='EST-5EDT-4,M3.2.0/02:00:00,M11.1.0/02:00:00'
export TZ
date -s "$T"
/mnt/disc1/busybox sleep 10800
unset TZ
done
I know ONVIF isn't implemented properly. Somewhere before I posted a patch for ffmpeg. In essence it adds a flag that forces TCP connections. Perhaps this is one of the problems (first trying UDP then TCP). Btw, this is just a wild guess without looking into the issueThank you to @mrxyz for the detailed post on how to connect to the serial console and to fix the frame rate drop. I managed to muddle my way through with firmware version 13.1.1.36 and various free/trial software (IDA free did not want to do it). I was really hoping that this would have fixed the below problem which is what started me down this rabbit run but it didn't.
Would someone mind seeing if their YooSee doorbell camera has the below problem using ffprobe or ffplay and if you do not please could you tell me what firmware you are using? I get the below message repeated for a good few seconds before the ffplay manages to a valid frame then it seems to be stable. It is, however, causing a bigger problem for mpromonet/webrtc-streamer which simply can't get a valid stream at all.
FFPLAY:
[h264 @ 0x7fdbac0576c0] concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
[h264 @ 0x7fdbac4d5e40] mb_type 32 in P slice too large at 1 0
[h264 @ 0x7fdbac4d5e40] error while decoding MB 1 0
[h264 @ 0x7fdbac060b80] illegal modification_of_pic_nums_idc 8
[h264 @ 0x7fdbac060b80] decode_slice_header error
[h264 @ 0x7fdbac060b80] no frame!
[h264 @ 0x7fdbac4d5e40] concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
[h264 @ 0x7fdbac4ca6c0] reference overflow 17 > 15 or 0 > 15
[h264 @ 0x7fdbac4ca6c0] decode_slice_header error
[h264 @ 0x7fdbac4ca6c0] no frame!
[h264 @ 0x7fdbac4d1340] P sub_mb_type 13 out of range at 4 0
[h264 @ 0x7fdbac4d1340] error while decoding MB 4 0
[h264 @ 0x7fdbac4d5e40] illegal modification_of_pic_nums_idc 8
[h264 @ 0x7fdbac4d5e40] decode_slice_header error
[h264 @ 0x7fdbac4d5e40] no frame!
[h264 @ 0x7fdbac060b80] reference overflow 17 > 15 or 0 > 15
[h264 @ 0x7fdbac060b80] decode_slice_header error
[h264 @ 0x7fdbac060b80] no frame!
[h264 @ 0x7fdbac4d1340] concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
[h264 @ 0x7fdbac0576c0] mb_type 27 in P slice too large at 2 0
[h264 @ 0x7fdbac0576c0] error while decoding MB 2 0
[h264 @ 0x7fdbac0576c0] concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
[h264 @ 0x7fdbac4ca6c0] P sub_mb_type 32 out of range at 18 0
[h264 @ 0x7fdbac4ca6c0] error while decoding MB 18 0
[h264 @ 0x7fdbac0576c0] illegal modification_of_pic_nums_idc 8
[h264 @ 0x7fdbac0576c0] decode_slice_header error
[h264 @ 0x7fdbac0576c0] no frame!
[h264 @ 0x7fdbac4ca6c0] concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
[h264 @ 0x7fdbac4d5e40] reference overflow 17 > 15 or 0 > 15
[h264 @ 0x7fdbac4d5e40] decode_slice_header error
[h264 @ 0x7fdbac4d5e40] no frame!
[h264 @ 0x7fdbac4d1340] top block unavailable for requested intra mode
[h264 @ 0x7fdbac4d1340] error while decoding MB 7 0
[h264 @ 0x7fdbac4d1340] concealing 3600 DC, 3600 AC, 3600 MV errors in P frame
mpromonet/webrtc-streamer gives the below repeatedly and never starts playing (I believe this is using live555):
[041:501][2620] (h264_decoder_impl.cc:294): avcodec_send_packet error: -1094995529
[041:501][2620] (VideoDecoder.h:70): VideoDecoder:ecoderThread failure:-1
[h264 @ 0x7fa4b4013180] non-existing PPS 0 referenced
[h264 @ 0x7fa4b4013180] decode_slice_header error
[h264 @ 0x7fa4b4013180] no frame!
Does any one have an idea how to fix this?
Thank you
Mark
UPDATE
I found out that this was due to another RTSP stream already running on the camera (i.e. the NVR). When I stopped that ffprobe and ffplay no longer get the errors. As for webrtc-streamer, well that still fails with "no frame". live555ProxyServer complains of frame size exceeding the client's buffer size so perhaps that's webrtc-streamer's problem too... Doesn't make much sense and my other camera is much higher resolution and it plays nicely.
You could be right, I'll have to research it some more. Calling a script from within a script is not something I usually do, but from what I can tell through testing it doesn't seem to matter whether Isource /mnt/disc1/set_time
or not from insidedhcp.script
. It uses the variables consistently without error just by using the full path.¯\_(ツ)_/¯
But from my understanding of what I've read so far regardingsource
it doesn't seem to apply to this situation, sourcing is used in the few cases where you want a script to affect the shell you are running it from, but I'm not trying to pass variables from theset_time.sh
todhcp.script
and I'm the using absolute path rather than a $PATH variable to executeset_time.sh
and running it as a separate process.
I did find two other issues with my script though... I needed to add asleep 5
to the beginning of the script because sometimes the script runs before the network is up after a reboot. I also realized I needed to addunset TZ
to the end of the the loop. Other wise it would subtract my TZ offset from the previously set TZ offset essentially doubling the offset once the script looped. I edited myset_time
script in the post you quoted just incase someone tries to use it via copy paste before they get around to seeing this one.
dhcp.script
for time sync rather then the /npc/npc
replacement script. Now I was able to reproduce correct time readings. I used slightly different way, but including the timeout before and after ntpd
indeed resolved the issue albeit using such a hack.#!/bin/sh
# Sync time with local ntp server
/mnt/disc1/busybox sleep 5
ntpd -q -p 192.168.x.x
/mnt/disc1/busybox sleep 10
T=$(($(date +%s) + 3600)) # Adjust this for your timezone
date -s "@$T"
Using the IPC tool I was able to reupload the patched firmware (probably ran out of space/inodes because the system wouldn't let me save scripts anymore). Again using wget I was able to get mosquitto_pub and the doorbell.sh onto the device.
My question: using Telnet to start the doorbell.sh and testing a button press: everything works. Then exiting out of Telnet (doorbell.sh still running) and pressing the doorbell: no MQTT message anymore... How to overcome this situation?
I am using roughly the same script petervk made:
Code:#!/bin/sh while read line; do if (echo $line == *"sHiRegCmd.dwBaseAddr"*); then ./mosquitto_pub -h 192.168.x.x -p 1883 -u USER -P Password -t "Home/Groundfloor/Outside/Doorbell" -m "DINGDONG" fi done < /proc/kmsg
dmesg
with different values caused by other then ringing event:<4>sHiRegCmd.dwBaseAddr = 0x20120000 0xc4
<4>sHiRegCmd.dwBaseAddr = 0x20120000 0xc4
<4>sHiRegCmd.dwBaseAddr = 0x20120000 0xc8
<4>sHiRegCmd.dwBaseAddr = 0x20120000 0xc8
# Alternative monitoring
while read line; do
if (echo $line == "sHiRegCmd.dwBaseAddr = 0x20650000 0x2004"); then
....
fi
done < /proc/kmsg
Where can I find the latest bin file that is working together with all the scrips for the SDcard?
Do I have to update the bin through the app (ipad) or is there another way?
Has somebody already an manual for dummies like me
npcupg.bin
into your SD-card root. There are two easy ways to flash it then, depending on the access to the doorbell box. You either press the reset button on the back of the box while powering it up, and keep pressing for about 15 sec. Or you use your favourite app which will indicate an available update, once the FW file is on your SD. After flashing telnet
should be possible to use to access doorbell with its IP using root
as username without password. From the login shell you can modify your scripts, run ftpd
to upload all necessary files to your SD. If desperate put files onto SD using your desktop. That's basically all, but you need to have some basic linux skills to deal with an embedded linux system such as the one used in this little box.I couldn't get it to update using the Yoosee app, I ended up using the IPC Test Tool, and 'forced' upgrade.I currently have Firmware 13.1.1.36 installed, using the Yoosee iphone app, I am trying to install this patched firmware version, but it's saying I am already on the latest, how can I get round this please?
I couldn't get it to update using the Yoosee app, I ended up using the IPC Test Tool, and 'forced' upgrade.
@sp00025 thanks for the feedback after approval from my wife (just kidding) I will try this out.You can get all you need if you follow the discussion starting from this post by @Florissilfhout. For flashing, place the FW binarynpcupg.bin
into your SD-card root. There are two easy ways to flash it then, depending on the access to the doorbell box. You either press the reset button on the back of the box while powering it up, and keep pressing for about 15 sec. Or you use your favourite app which will indicate an available update, once the FW file is on your SD. After flashingtelnet
should be possible to use to access doorbell with its IP usingroot
as username without password. From the login shell you can modify your scripts, runftpd
to upload all necessary files to your SD. If desperate put files onto SD using your desktop. That's basically all, but you need to have some basic linux skills to deal with an embedded linux system such as the one used in this little box.
¯\_(ツ)_/¯
EST5EDT,M3.2.0/2:00:00,M11.1.0/2:00:00
needs to be like EST-5EDT-4,M3.2.0/02:00:00,M11.1.0/02:00:00
ect.#!/bin/sh
#==================================================#
## __ __ .__ ##
## ______ _____/ |_ _/ |_|__| _____ ____ ##
## / ___/ __ \ __\ \ __\ |/ \_/ __ \ ##
## \___ \\ ___/| | | | | | Y Y \ ___/ ##
## /____ >\___ >__|____|__| |__|__|_| /\___ > ##
## \/ \/ /_____/ \/ \/ ##
#==================================================#
## Script Name: set_time.sh
## Decription: Sets system time using user defined
## NTP server & timezone string.
####################################################
## NTP Server IP # Edit your server IP here
#===================================================
TIME_SERVER="192.168.10.1"
#===================================================
####################################################
## TimeZone Offset # Uncomment your timezone
#===================================================
TIMEZONE="EST-5EDT-4,M3.2.0/02:00:00,M11.1.0/02:00:00" #Eastern
#TIMEZONE="CST-6CDT-5,M3.2.0/02:00:00,M11.1.0/02:00:00" #Central
#TIMEZONE="MST-7MDT-6,M3.2.0/02:00:00,M11.1.0/02:00:00" #Mountian
#TIMEZONE="PST-8PDT-7,M3.2.0/02:00:00,M11.1.0/02:00:00" #Pacific
#TIMEZONE="ASKT-9AKDT-8,M3.2.0/02:00:00,M11.1.0/02:00:00" #Alaska
#TIMEZONE="HST-11HDT-10,M3.2.0/02:00:00,M11.1.0/02:00:00" #Hawaii
#===================================================
# Sync with local ntp server
/mnt/disc1/busybox sleep 5
while true;
do
ntpd -q -p $TIME_SERVER
/mnt/disc1/busybox sleep 8
ntpd -q -p $TIME_SERVER
T=$(date +"%Y-%m-%d %H:%M:%S")
TZ=$TIMEZONE
export TZ
date -s "$T"
/mnt/disc1/busybox sleep 10800
unset TZ
done
#!/bin/sh
#================================================================#
## __________ .__ ________ ##
## \______ \__ __ _____| |__ \_____ \___ __ ___________ ##
## | ___/ | \/ ___/ | \ / | \ \/ / __ \_ __ \ ##
## | | | | /\___ \| Y \/ | \ /\ ___/| | \/ ##
## |____| |____/____ >___| /\_______ /\_/ \___ >__| ##
## \/ \/ \/ \/ ##
#================================================================#
## Script Name: pushover.sh
## Decription: Sends a PushOver notifaction with an image
## attachment. Alarm with taking snapshot
## should be enabled in the doorbell.
##################################################################
## User Key # Edit your User Key here.
#================================================================#
USER_KEY="ueveujttxfakeuserkeyieg7777"
#==================================================
##################################################################
## APP Token # Edit your App Token here.
#================================================================#
APP_TOKEN="ak9gb9hdqfakeapptokena3oy7777"
#================================================================#
#Send PushOver notifaction
# Today's date - such dir should be created for alarm pics
DIR=`date +%Y-%m-%d`
# Alarm picture storage
PTH="/mnt/disc1/npc/push/alarm"
# Wait until snapshot is taken
/mnt/disc1/busybox sleep 5
# Find latest image in the current date folder
LATEST=`ls -t ${PTH}/${DIR} | /mnt/disc1/busybox head -1`
# Full filename with path
FILE=${PTH}/${DIR}/${LATEST}
# Timestamp of the file creation date
TS=`/mnt/disc1/busybox stat -c %Y ${FILE}`
# File creation date in readable format
FDATE=`date -d @${TS} +'%Y-%m-%d %H:%M:%S'`
# Send latest image
/mnt/disc1/MONITORING/curl -sk \
--form-string "token=${APP_TOKEN}" \
--form-string "user=${USER_KEY}" \
--form-string "message=Doorbell Push Detected ${FDATE}" \
-F "attachment=@${FILE}" \
https://api.pushover.net/1/messages.json >/dev/null 2>&1
exit 0
You might want to remove the values of USER_KEY and APP_TOKEN...I got PushOver working. I kept getting a SSL certificate error with curl while trying to use the cacert.pem so I could only get it to work with http://
Are the 5 or 6 of you others doing this programming communicating with each other somewhere else other than this thread? I swore I read this whole thread and never once read anything about how "alarm" got enabled to take a picture on button press. The only way I figured it out was by reverse engineering the "send_pic_telegram" script.
Bash:#!/bin/sh #================================================================# ## __________ .__ ________ ## ## \______ \__ __ _____| |__ \_____ \___ __ ___________ ## ## | ___/ | \/ ___/ | \ / | \ \/ / __ \_ __ \ ## ## | | | | /\___ \| Y \/ | \ /\ ___/| | \/ ## ## |____| |____/____ >___| /\_______ /\_/ \___ >__| ## ## \/ \/ \/ \/ ## #================================================================# ## Script Name: pushover.sh ## Decription: Sends a PushOver notifaction with an image ## attachment. Alarm with taking snapshot ## should be enabled in the doorbell. ################################################################## ## User Key # Edit your User Key here. #================================================================# USER_KEY="ueveujttxfakeuserkeyieg7777" #================================================== ################################################################## ## APP Token # Edit your App Token here. #================================================================# APP_TOKEN="ak9gb9hdqfakeapptokena3oy7777" #================================================================# #Send PushOver notifaction # Today's date - such dir should be created for alarm pics DIR=`date +%Y-%m-%d` # Alarm picture storage PTH="/mnt/disc1/npc/push/alarm" # Wait until snapshot is taken /mnt/disc1/busybox sleep 5 # Find latest image in the current date folder LATEST=`ls -t ${PTH}/${DIR} | /mnt/disc1/busybox head -1` # Full filename with path FILE=${PTH}/${DIR}/${LATEST} # Timestamp of the file creation date TS=`/mnt/disc1/busybox stat -c %Y ${FILE}` # File creation date in readable format FDATE=`date -d @${TS} +'%Y-%m-%d %H:%M:%S'` # Send latest image /mnt/disc1/MONITORING/curl -s \ --form-string "token=${APP_TOKEN}" \ --form-string "user=$ {USER_KEY}" \ --form-string "message=Doorbell ring !!! ${LATEST} - Created at ${FDATE}" \ -F "attachment=@${FILE}" \ http://api.pushover.net/1/messages.json >/dev/null 2>&1 exit 0