Dahua day/night switch utility - DahuaSunriseSunset

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,674
Reaction score
14,020
Location
USA
Revisiting this. Any chance an update can get the focus/zoom of the particular PTZ I'm using? (SD49225T-HN)
But it should be pretty straightforward for you to find the API docs and send off the request yourself in a web browser to get the zoom/focus numbers.
 

drdre84

n3wb
Joined
Jun 30, 2019
Messages
14
Reaction score
2
Location
australia
Didn't work for me. It set it to night focus value the first night and doesn't change it to the day focus value.
you can login to the actual camera settings (not the nvr) and set day / night times. and at the specific hour (i.e. 7am) it will change to day and visa versa.
 

JayS_IPCams

Young grasshopper
Joined
Oct 30, 2018
Messages
72
Reaction score
16
Location
Washington
Checking back in. Because I like to tinker and because I wanted some additional options, I wrote my own controller in .py. It's worked flawlessly for a few months now. Also the camera has actually nailed a criminal who was dumb enough to use the non-fraudulent plates.

Thanks @bp2008 for posting up the API.
Can you share your py project please? Thanks!
 

CastleSurveillance

Getting the hang of it
Joined
Aug 11, 2019
Messages
313
Reaction score
83
Location
Detroit, MI
@bp2008

so I've installed this - I need to control 5 cam's with this - Good news: when testing my sunrise and sunset, 4 cameras work perfectly. The 5th camera (which is not a dahua camera, but is a dahua OEM camera from LTS that I am testing) seemingly has no response - does not respond to sunrise or sunset (I've tried to put the camera in "full time" and it still doesnt respond) ... any ideas?
 

biggen

Known around here
Joined
May 6, 2018
Messages
2,563
Reaction score
2,837
Whats funny is I was looking through the Dahua API and getting ready to write a bash script to do this exact same thing (profile switcher) tied to another script knows that knows when sunrise/sunset is in my location. I'll look through this thread to see if there are any "snafus" waiting for me.
 
Last edited:

DLONG2

Known around here
Joined
May 17, 2017
Messages
763
Reaction score
455
I'm getting frustrated with the day/night focus issue with my Z12 Dahua. The SunriseSunset utility has been working well in the past, but lately the utility sometimes fails to command the camera to switch modes. Might have to consider a different camera model.
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,674
Reaction score
14,020
Location
USA
@bp2008

so I've installed this - I need to control 5 cam's with this - Good news: when testing my sunrise and sunset, 4 cameras work perfectly. The 5th camera (which is not a dahua camera, but is a dahua OEM camera from LTS that I am testing) seemingly has no response - does not respond to sunrise or sunset (I've tried to put the camera in "full time" and it still doesnt respond) ... any ideas?
The log file from the app may have something. But otherwise, no ideas.

Whats funny is I was looking through the Dahua API and getting ready to write a bash script to do this exact same thing (profile switcher) tied to another script knows that knows when sunrise/sunset is in my location. I'll look through this thread to see if there are any "snafus" waiting for me.
No, the API requests are really straightforward. The biggest obstacle you are likely to encounter is the camera being unreachable or otherwise just not doing what it is supposed to, like @DLONG2 is apparently struggling with.

I'm getting frustrated with the day/night focus issue with my Z12 Dahua. The SunriseSunset utility has been working well in the past, but lately the utility sometimes fails to command the camera to switch modes. Might have to consider a different camera model.
The log file may indicate what went wrong, if you're lucky.
 

Sammy0815

Young grasshopper
Joined
Nov 6, 2019
Messages
46
Reaction score
3
Location
austin
Just getting into this... since the Program runs as a server on Windows, am I assuming right that my PC needs to be running to make it work all the time?
Or is there a smarter way to make sure my Dahua cams are switching between day and night profile?
 

biggen

Known around here
Joined
May 6, 2018
Messages
2,563
Reaction score
2,837
Just getting into this... since the Program runs as a server on Windows, am I assuming right that my PC needs to be running to make it work all the time?
Or is there a smarter way to make sure my Dahua cams are switching between day and night profile?
Yes the day/night switcher PC has to be running. If running BI it can be that PC as well.

I use a Raspberry Pi and set up a cron job script to perform the same function.
 

MickPB

Getting the hang of it
Joined
Oct 16, 2019
Messages
113
Reaction score
18
Location
Topeka, KS
Has anyone enhanced the script to set the camera clock? Having the cameras on a subnet that is not connected to the internet seemed like a good idea but the NTP sync in my cameras has some serious time drift that negatively impacts the ability to watch across a couple cameras. Not huge but if the clock was reset to the PC clock each time the script ran......
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,674
Reaction score
14,020
Location
USA
So your NTP sync feature in the cameras doesn't work? Are you running a local NTP server that they can reach without internet access?
 

MickPB

Getting the hang of it
Joined
Oct 16, 2019
Messages
113
Reaction score
18
Location
Topeka, KS
So your NTP sync feature in the cameras doesn't Work?.....

I thought NTP was a Government web server. I can definitely investigate this. Thanks!

So your NTP sync feature in the cameras doesn't Work?.....
 

biggen

Known around here
Joined
May 6, 2018
Messages
2,563
Reaction score
2,837
No you can setup a local NTP server. I run one at the house in a VM that my cameras can connect to in order to get their times synced up.
 

MickPB

Getting the hang of it
Joined
Oct 16, 2019
Messages
113
Reaction score
18
Location
Topeka, KS

I have the Windows time server running

And changed the cameras to point to the address of the ethernet card in BI machine.
1592335879487.png

I don't see the time change reflected on the cameras. There are no errors in the Dahua log but.. there were no errors there when the cam was pointed at the time service I know it could not access either.

Did I miss something? (the xx.x is set correctly)
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,674
Reaction score
14,020
Location
USA
And make sure the time server is actually running, which means checking the box Allow other computers to sync to this computer and Start NetTime service at bootup

1592338780771.png

And back on the main screen of NetTime it should say this:

1592338843963.png
 

MickPB

Getting the hang of it
Joined
Oct 16, 2019
Messages
113
Reaction score
18
Location
Topeka, KS
@MickPB there is no reason to censor private IP addresses like that.

Also, please make a Windows firewall exception for UDP port 123.
Thanks - there are some though, like my modem IP, that I have shared so I am trying to make it a habit to remove them.

I'll check those settings als.

Thanks again
 

MickPB

Getting the hang of it
Joined
Oct 16, 2019
Messages
113
Reaction score
18
Location
Topeka, KS
I found the issue. I had created another problem by creating a VM on the Windows machine to do some things and keep them separate from BI (and everything else). In doing that I broke the network connection setting up the virtual switch. Thanks for the help. I was at a standstill and appreciate the help
 

mat-with-one-t

Getting the hang of it
Joined
Mar 7, 2020
Messages
85
Reaction score
27
Location
Melboure
Hi guys. I installed the day/night link here which seemed to go ok. Today I noticed one cam, when reviewing overnight footage, the time bar (on the Dahua NVR) is a solid block of red ("alarm"). I had also added some tripwire rules. Could the day/night addon have anything to do with it? Annoying, as I can't now review rule-based issues on the most important overnight camera (such as movement/tripwire/etc). Mat
 
Top