Dahua day/night switch utility - DahuaSunriseSunset

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,666
Reaction score
14,005
Location
USA
I looked into that before but I think what I found was the ability to toggle the IR filter, not the camera's profile.
 

gwminor48

Known around here
Joined
Jul 16, 2015
Messages
3,621
Reaction score
6,897
Location
Texas
Does it matter whether the profile in the camera is set to normal, full time, or schedule? I have a ptz, SD29204S-GN that I have configured but it isn't toggling anything that I can tell when I simulate sunrise or sunset. I have tried all 3 settings in the camera, it's got to be something simple I am missing.
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,666
Reaction score
14,005
Location
USA
Set the profile schedule to full time. This program will then change the camera between Day and Night profiles.
 

gwminor48

Known around here
Joined
Jul 16, 2015
Messages
3,621
Reaction score
6,897
Location
Texas
Looks like that was probably my problem, thanks. I'll try it out tonight and tomorrow.
 

gwminor48

Known around here
Joined
Jul 16, 2015
Messages
3,621
Reaction score
6,897
Location
Texas
I noticed this morning that something switched at sunrise but it was still black and white. I logged into the camera and saw it had switched to "normal" so I had to switch it to full time - day. I've noticed that it seems to keep getting switched to "normal" so I'll keep looking at it to see what I have that's wrong.
 

giomania

IPCT Contributor
Joined
Jun 1, 2017
Messages
780
Reaction score
538
I just set this up today for an outdoor camera to give it a little bit of WDR during the day in domoticz, simple script:


HTML:
commandArray = {}

-- Switch cameras to day profile
if (timeofday['Daytime']) then
        commandArray['OpenURL']='http://user:pwd@10.0.0.125/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=0'

-- Switch cameras to night profile
elseif (timeofday['Nighttime']) then
        commandArray['OpenURL']='http://user:pwd@10.0.0.125/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1'
end

return commandArray

All I have to do now is add URL's for any other cameras I want to change profiles with, and this will change based on sunrise and sunset. :)
Do these commands turn WDR On and Off? And if that is correct, does WDR maintain the previous range setting?

Thanks.

Mark
 

RJF

Getting the hang of it
Joined
Jun 11, 2017
Messages
108
Reaction score
52

RJF

Getting the hang of it
Joined
Jun 11, 2017
Messages
108
Reaction score
52
While I was on my vacation recently I built a tiny windows service, complete with a configuration GUI, that can change between Day and Night profiles on multiple Dahua cameras.

Anyone may install and use this (on a Windows system, anyway) without having to mess around with configuration files.

GitHub - bp2008/DahuaSunriseSunset: A Windows Service which changes the profile of dahua cameras between Night and Day at each sunset and sunrise.
Thanks again! FYI, this also works for a Lorex 8MP camera I have.
 

Skipper-93

n3wb
Joined
Apr 7, 2017
Messages
15
Reaction score
11
Nice stuff BP2008!
The only problem that I'm experiencing is that the sunrise/sunset times are the wrong way around. (The Netherlands) For now I've setup my "Day settings" in the "Night profile" and vice versa.
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,666
Reaction score
14,005
Location
USA
Nice stuff BP2008!
The only problem that I'm experiencing is that the sunrise/sunset times are the wrong way around. (The Netherlands) For now I've setup my "Day settings" in the "Night profile" and vice versa.
That is odd! Probably something to do with the sunrise and sunset calculations. You wouldn't believe how hard it is to find code that calculates it correctly in all cases.
 

TVT73

Pulling my weight
Joined
Aug 29, 2016
Messages
406
Reaction score
108
Location
Germany
The profile switching only works to the cams himselves, if they were behind a poe nvr it´s not possible anymore. In generally it should be possible to control the nve by http api too, but I noticced on all firmwares of nvr 4xxx-p-4ks2 and 5xxx-p-4ks2 a broken (missing) profile scheduler. Within these firmwares we have 3 config settings (beeing thought comparable as day/night/normal), but trying to control them by http api will result in broken nvr configs and undefined settings until restoring picture defaults.
 

crc2004

Pulling my weight
Joined
Apr 18, 2016
Messages
213
Reaction score
144
While I was on my vacation recently I built a tiny windows service, complete with a configuration GUI, that can change between Day and Night profiles on multiple Dahua cameras.
Anyone may install and use this (on a Windows system, anyway) without having to mess around with configuration files.
GitHub - bp2008/DahuaSunriseSunset: A Windows Service which changes the profile of dahua cameras between Night and Day at each sunset and sunrise.
@bp2008 Thanks for creating this utility. I set it up and it ran as expected on my IPC-HFW5231E-Z12 but the focus didn't change. When I set focus manually using "cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.766667&zoom=0.865225" I have to run it twice about 90 seconds apart to get the focus to adjust. Any recommendations on how to solve this problem?
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,666
Reaction score
14,005
Location
USA
@bp2008 Thanks for creating this utility. I set it up and it ran as expected on my IPC-HFW5231E-Z12 but the focus didn't change. When I set focus manually using "cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.766667&zoom=0.865225" I have to run it twice about 90 seconds apart to get the focus to adjust. Any recommendations on how to solve this problem?
I noticed the command is rather unreliable, and that is why the app sends the command 3 or 4 times, several seconds apart. I don't know what more I could do (within reason) to make it work.
 

crc2004

Pulling my weight
Joined
Apr 18, 2016
Messages
213
Reaction score
144
I noticed the command is rather unreliable, and that is why the app sends the command 3 or 4 times, several seconds apart. I don't know what more I could do (within reason) to make it work.
Could you add a "seconds between focus commands" field? That way I could set it to 60-90 in my configuration and anyone else could set it to what works for them. It's a very useful utility and other than the strange behavior of my camera it works great. Thanks
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,666
Reaction score
14,005
Location
USA
Could you add a "seconds between focus commands" field? That way I could set it to 60-90 in my configuration and anyone else could set it to what works for them. It's a very useful utility and other than the strange behavior of my camera it works great. Thanks
Done. Try version 1.2 and see if it works better.
 

RJF

Getting the hang of it
Joined
Jun 11, 2017
Messages
108
Reaction score
52
Thanks again @bp2008 for this amazing tool. Question: will the sunset/sunrise offset field take a decimal number? I.e., can I specify 30 minutes with .5 hours?
 

crc2004

Pulling my weight
Joined
Apr 18, 2016
Messages
213
Reaction score
144
You should rename this thread something like "Dahua day night switch utility - DahuaSunriseSunset" so more people can find it.
 
Top