Dahua day/night switch utility - DahuaSunriseSunset

PointLookout247

Getting the hang of it
Joined
Feb 12, 2018
Messages
43
Reaction score
29
Location
USA
where would you put the above linux code on the cam itself? you have to edit a file or setup a cron?
 

patrocle

Pulling my weight
Joined
Jun 5, 2015
Messages
512
Reaction score
114
Location
Roseville, California.

RicRat2009

Getting the hang of it
Joined
Jan 8, 2018
Messages
123
Reaction score
84
Location
Tejas
@bp2008
Tried setting this up. Says service started successfully, but when simulating sunrise I get the following error.
Any ideas?

4/26/2018 1:02:01 AM TriggerSunriseActions
4/26/2018 1:02:37 AM Exception thrown attempting web request (http://192.168.1.219:37777/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1): The operation has timed out
Repeat 5x
4/26/2018 1:07:01 AM Cancelled web request (http://192.168.1.219:37777/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=0) due to the next event time being reached.
4/26/2018 1:07:37 AM Exception thrown attempting web request (http://192.168.1.219:37777/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1): The operation has timed out
Repeat 6x
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,666
Reaction score
14,006
Location
USA
Will this utility work, or be made to work with other camera brands?
No, not unless they run Dahua firmware.

Am I right in ASSuming this only sends a focus command once? Im having issues with a 5231 Z12 loosing focus. Even during the day with no subjects

Sent from my VS990 using Tapatalk
It sends zoom and focus commands (which are in fact the same command) several times a few seconds apart, typically. I think autofocus commands only get sent once.

I’ve got a question for auto launching on windows startup. I’ve got the GUI set to run when windows logs in. How would I then configure it to start the service?
The GUI is not necessary for the service to run. When you push Install Service, the service gets configured to start automatically when Windows boots up. You don't even need to log in to Windows.

where would you put the above linux code on the cam itself? you have to edit a file or setup a cron?
To what are you referring? I don't do anything that gets put on the cam itself.

@bp2008 , Thank for this.
Was trying to use this for my Dahua IPC-HFW5231E-Z12E and for some reason i get
Lat 0 and Lon 0 , also.
And hours for Sunrise and Sunset are off too based on my Lat/Long .

I used this to get the long/lat
Latitude/Longitude Finder - MY NASA DATA

and also some nice info about your location , regarding to Sunrise and Sunset :
Here is mine
Sun & moon times today, Rocklin, California, USA

Thanks for any help!
P.
Try not having multiple panels from the GUI open at once. Configure, close the configuration panel, then view rise/set times. These panels aren't coded to monitor for changes and typically only load data when they open and save data when they close.

Is there a way to make this continue checking focus and adjusting?
Nope.

@bp2008
Tried setting this up. Says service started successfully, but when simulating sunrise I get the following error.
Any ideas?

4/26/2018 1:02:01 AM TriggerSunriseActions
4/26/2018 1:02:37 AM Exception thrown attempting web request (http://192.168.1.219:37777/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1): The operation has timed out
Repeat 5x
4/26/2018 1:07:01 AM Cancelled web request (http://192.168.1.219:37777/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=0) due to the next event time being reached.
4/26/2018 1:07:37 AM Exception thrown attempting web request (http://192.168.1.219:37777/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1): The operation has timed out
Repeat 6x
That looks like the error you would get if you typed in the wrong address, port number, or protocol (http vs https). Try the URLs from the error message in a web browser on the same computer running the service.
 

RicRat2009

Getting the hang of it
Joined
Jan 8, 2018
Messages
123
Reaction score
84
Location
Tejas
That looks like the error you would get if you typed in the wrong address, port number, or protocol (http vs https). Try the URLs from the error message in a web browser on the same computer running the service.
That was it, had the wrong port. TCP port instead of http.
Seems to be working correctly now.
When simulating sunset, how long does it take to switch back to day mode?

Edit: Worked great! Thanks a bunch BP!
 
Last edited:

Jaxon

Getting the hang of it
Joined
Aug 9, 2016
Messages
67
Reaction score
38
I wanted to use stronger noise reduction at night and weaker during the day, but Dahua seems to have made a mess of the profile management. There doesn't seem to be a way to have the camera switch automatically between Day and Night profiles when the camera changes between "Color" and "Black & White" mode.

The Profile Management tab has a "Normal" mode which is evidently supposed to do this (IPC/Camera Configuration - Dahua Wiki). But I just tried it. It doesn't do that at all. Choosing "Normal" just makes the camera use a third profile, which is neither "Day" or "Night" but a separate third profile called "Normal", which stores settings independently of the "Day" and "Night" profiles.

Dahua engineers must live in a world where it is perfectly acceptable to say:

or


Now I know why Nayr has his profile management scripted externally, but even that seems to be a mess: Switch Dahua Day/Night Profile via IPC HTTP API

Update

I've written Windows software to take care of this.

GitHub - bp2008/DahuaSunriseSunset: A Windows Service which changes the profile of dahua cameras between Night and Day at each sunset and sunrise.


Thanks for this service, works great! Forgive me if it's in the thread and I missed it, but can anyone point me to some decent day/night profile settings?
 

RicRat2009

Getting the hang of it
Joined
Jan 8, 2018
Messages
123
Reaction score
84
Location
Tejas
Thanks for this service, works great! Forgive me if it's in the thread and I missed it, but can anyone point me to some decent day/night profile settings?
The best thing to do is experiment with your settings. I think everyone's will be slightly different due to environment and lighting conditions.
I use Color mode both day and night, I have pretty good lighting and want to see what color vehicles are and what color clothing people have on.
During the day I use WDR and WB on Auto, at night I use Backlight Correction and WB on Steetlamp.
 

OnePunch

n3wb
Joined
Mar 31, 2018
Messages
20
Reaction score
5
Absolutely crazy this isnt a native feature of the Dahua experience. I mean REALLY? If this is their level of care for the end-user I gotta say this doesn't make me think they give a damn and I'll be skeptical of buying this from Dahua again.

Thanks for the script, however. I'll have to try it out.
 

fenderman

Staff member
Joined
Mar 9, 2014
Messages
36,897
Reaction score
21,250
Absolutely crazy this isnt a native feature of the Dahua experience. I mean REALLY? If this is their level of care for the end-user I gotta say this doesn't make me think they give a damn and I'll be skeptical of buying this from Dahua again.

Thanks for the script, however. I'll have to try it out.
they dont care about you, the dont sell direct and dont want to sell direct to end users like you.
this is not an issue for most cams and most scenarios...you dont really have a choice, what will you do, go with hikvision? they dont care about you either...or spend 5-10x on axis/avigilon/hanwah...they have you by the balls.
 

OnePunch

n3wb
Joined
Mar 31, 2018
Messages
20
Reaction score
5
I am having an issue with the backlight setting. This is not a problem with the app from @bp2008

When profile = day then backlight = off When profile = night then backlight = on.

However, when I switch profile from night to day, the camera does not de-activate the backlight. I have to switch profile to "normal" for that to happen. This effectively renders my backlight capability non-operative.

Anyone know why this might be?
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,666
Reaction score
14,006
Location
USA
When simulating sunset, how long does it take to switch back to day mode?
It won't switch back until the next real sunrise event (or until you simulate sunrise).

However, when I switch profile from night to day, the camera does not de-activate the backlight. I have to switch profile to "normal" for that to happen. This effectively renders my backlight capability non-operative.

Anyone know why this might be?
No idea about this. Sorry.
 

RicRat2009

Getting the hang of it
Joined
Jan 8, 2018
Messages
123
Reaction score
84
Location
Tejas
I am having an issue with the backlight setting. This is not a problem with the app from @bp2008

When profile = day then backlight = off When profile = night then backlight = on.

However, when I switch profile from night to day, the camera does not de-activate the backlight. I have to switch profile to "normal" for that to happen. This effectively renders my backlight capability non-operative.

Anyone know why this might be?
Mine does, maybe a issue with your camera or settings.
 

OnePunch

n3wb
Joined
Mar 31, 2018
Messages
20
Reaction score
5
@bp2008 would it be difficult to have the program instead switch to "normal" from "night" mode instead of "day" mode? For whatever reason that mode indeed deactivates the backlight while the day/night cycle has no effect on backlight (any kind of backlight).
 

OnePunch

n3wb
Joined
Mar 31, 2018
Messages
20
Reaction score
5
Best I can do i use your app to toggle the "picture" settings: brightness and gamma, etc. The backlight gets set and does not turn off unless I switch to normal mode. Very frustrating ;(
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,666
Reaction score
14,006
Location
USA
@bp2008 would it be difficult to have the program instead switch to "normal" from "night" mode instead of "day" mode? For whatever reason that mode indeed deactivates the backlight while the day/night cycle has no effect on backlight (any kind of backlight).
Here you go. Let me know if it works or not: bp2008/DahuaSunriseSunset
 

OnePunch

n3wb
Joined
Mar 31, 2018
Messages
20
Reaction score
5
Here you go. Let me know if it works or not: bp2008/DahuaSunriseSunset
Hey thanks so much for taking a sec to look. When I click "simulate sunrise/sunset", the app now hangs and I have to force-quit.

I have tried configuring my camera with port 554 and 80.


Code:
5/6/2018 9:08:19 PM    DahuaSunriseSunset 1.3.0.0 Service Manager Startup
5/6/2018 9:09:14 PM    TriggerSunsetActions
5/6/2018 9:10:15 PM    Exception thrown attempting web request (https://192.168.1.108:80/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1): The underlying connection was closed: An unexpected error occurred on a send.
 

OnePunch

n3wb
Joined
Mar 31, 2018
Messages
20
Reaction score
5
And I did stop/uninstall the 1.2 service before installing the new version, fwiw.
 

OnePunch

n3wb
Joined
Mar 31, 2018
Messages
20
Reaction score
5
Oops, sorry. I think I know what I did. I entered in x.x.x.x:554 in the "Edit" field where it says host name and port number. Really all it needs is host name.

Great success!!! Thanks!
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,666
Reaction score
14,006
Location
USA
Your error message indicates you had it connecting to port 80 (plain http) but using the https protocol. Https servers normally listen on port 443.

Of course I didn't notice the port problem until I had already googled the problem "The underlying connection was closed: An unexpected error occurred on a send." and published this minor update 1.3.1 in response: bp2008/DahuaSunriseSunset

The 1.3.1 update is almost certainly meaningless since I doubt any Dahua camera actually requires the SSLv3 protocol for https.
 
Top