bmork / defogger

D-Link DCS-8000LH usage info and defogging tools
268 stars 37 forks source link

Setting the date and time #5

Open mikegleasonjr opened 5 years ago

mikegleasonjr commented 5 years ago

Hi,

Do you know how can I properly make the date and time persist across reboots?

Thank you!

bmork commented 5 years ago

I am not sure this is possible. There probably isn't a real-time clock chip on this board. The original firmware uses ntp to set the correct time, and I suspect it is required. You can change the ntp server to a local one instead of the default, if this is an alternative for you?

For example, setting mine to 192.168.2.1:

$ curl -u admin:123456 'http://192.168.2.37/config/datetime.cgi?timeserver=192.168.2.1'
method=1
timeserver=192.168.2.1
timezone=1
utcdate=2019-06-01
utctime=17:43:51
date=2019-06-01
time=17:43:51
dstenable=yes
dstauto=yes
offset=01:00
starttime=3.2.0/02:00:00
stoptime=11.1.0/02:00:00
mikegleasonjr commented 5 years ago

That's perfect.

I wonder I all those endpoints are documented somewhere?

Specifically I want to hook on the motion detection feature. I wonder how that works.

mikegleasonjr commented 5 years ago

I found this document which pretty much covers this camera: http://gurau-audibert.hd.free.fr/josdblog/wp-content/uploads/2013/09/CGI_2121.pdf

Thanks again

mikegleasonjr commented 4 years ago

Hi, sorry to re-open this. But the settings aren't surviving reboots. Also ntp is not working, I recalled setting the date manually like:

curl -u admin:123456 'http://1.2.3.4/config/datetime.cgi?method=2&date=2020-06-14&time=13:22:00'

Any idea why?

I have to call the endpoint every time I lose power in my home.

Thanks

EDIT: logging in with telnet tells me ntpd is not running:

Trying to start it says:

# /etc/rc.d/init.d/ntpd.sh start
Startting ntpd... disabled.

Because $enable is 0 in the script:

setupConf() {                                                                   
        mydlink_registered=$(tdb get DLink15 Register_byte)                     
        if [ $mydlink_registered -eq 1 ]; then                                  
                enable=0                                                        
        else                                                                    
                eval $(echo "Enable_byte DHCPNTPEnable_byte Server_ms Retry_byte
                enable=$Enable_byte                                             
                echo > $shadow                                                  
                echo "servers $Server_ms" >> $shadow                            
        fi                                                                      
}

Also, /etc/ntpd.conf seems to point to /tmp/ntpd.conf but it does not exists

Here are some infos about the camera:

mike@local:~$ curl -u admin:123456 'http://1.2.3.4/common/info.cgi'
model=DCS-8000LH
product=Wireless Internet Camera
brand=D-Link
version=2.02
build=02
hw_version=A
nipca=1.9.7
name=<redacted>
location=<redacted>
macaddr=<redacted>
ipaddr=<redacted>
netmask=255.255.255.0
gateway=<redacted>
wireless=yes
inputs=0
outputs=0
speaker=no
videoout=no
pir=no
icr=yes
ir=yes
mic=yes
led=no
td=no
playing_music=no
whitelightled=no

@bmork :point_up_2: