Dahua day/night switch utility - DahuaSunriseSunset

Thanks. I thought that since it was always running that it would be in the system tray or somewhere.
 
Today, I started looking into the alternative method bp2008 posted on using PTZ preset to switch between day/night profile. Then I found out it doesn't work if your password has '@' symbol in it. Someone already mentioned this previously so I can also confirm this issue. If you paste the command within the browser, it works just fine, but does not work in Blue Iris. The log says it's throwing 401 error even when the password is correct. Someone mentioned to use '%40' as equivalent to substitute for symbol for the URL and I can confirm that does not work. Only after changing the password on the camera to something else without the '@' symbol, then I'm able to use the PTZ preset to switch day/night as described in the beginning of this thread.
 
  • Like
Reactions: CanCuba
Hi. Any ideas to get this utility working? I try to control a 5442 with latest firmware. Attached screenshot shows my lat/long settings. Obviously the "pass" is replaced with my real password. Do I have to put in the port # at the end of the IP? I tried port 80, 81, 8000 and even with https but I just get the "input string was not in a correct format.
 

Attachments

  • sunrisesunset.png
    sunrisesunset.png
    69.7 KB · Views: 92
No, you do not put in a port #. When are you getting the error? Is it when you try and add the cam? Or when you try and simulate sunrise/sunset?

My use is below:

1675789193607.png 1675789200380.png

I noticed that your simulation has 0 and 0 for lat long. Maybe try using my lat long just to see if you can get it to work, then change to your lat long.

It is possible that your password is not correct. These cams have a few passwords. If you changed it since the original initialization, you maybe did not change the one used by this utility.
 
Ok, I tried using your exact coordinates now. @samplenhold
At the same time I changed my computer's time setting to UTC-6 to avoid any mismatch there.
Still getting the "Input string was not in a correct format"
I get the error when I close the configuration tab.

I have also changed my ONVIF password in the cameras setup

Any more suggestions? :) :)
 
Ok, I tried using your exact coordinates now. @samplenhold
At the same time I changed my computer's time setting to UTC-6 to avoid any mismatch there.
Still getting the "Input string was not in a correct format"
I get the error when I close the configuration tab.

I have also changed my ONVIF password in the cameras setup

Any more suggestions? :) :)

I can't tell from your photo, is there a colon between admin and pass? and is pass your actual password?
 
@gwminor48 Yes there is a colon. The utility actually makes it this format automatically when you fill in the values in your boxes. No "pass" is not my real password, I just filled it in there for the purpose of taking a screenshot before posting it here
 
  • Like
Reactions: gwminor48
@gwminor48 Yes there is a colon. The utility actually makes it this format automatically when you fill in the values in your boxes. No "pass" is not my real password, I just filled it in there for the purpose of taking a screenshot before posting it here

OK, that's good. I looked at mine and I do have a port number in mine, I presume you have already tried that since you already asked that question earlier.
 
  • Like
Reactions: f1restarter
OK, I finally got it working! I opened the .cfg file and manually inserted the lat/long coordinates because no matter what i did the configuration menu refused to accept it, It now works great, shows the correct sunrise/sunset times for my area, and when I simulate sunrise/sunset the camera changes! FIY, I did not have to put any port numbers behind the lan IP of the camera.
 
Glad you got it working!
 
Hey guys! I have the “0” and “1” at the end of the ptz presets to designate night or day and when I press the call or select 1 or 2 in the ptz preset it goes between day and night. However, in the events schedule both are reading “sunrise”. Any idea what may cause this or is normal?

Edit: I should’ve followed instructions more closely. I neglected to enter the time.
 

Attachments

  • IMG_2321.jpeg
    IMG_2321.jpeg
    2.6 MB · Views: 71
Last edited:
Hey! (again lol). I’ve got things working perfectly for two z12e cams and a turret cam. However, when I use this program in my ptz, I get the response of an “invalid” preset. Is there something different I should be doing with a PTZ?
 
So tbc even with the latest EmpireTech IPC-B54IR-Z4E-S3 (Dahua IPC-B5442E-Z4E-S3) and IPC-T54IR-AS-S3 (Dahua IPC-HDW5442TM-ASE-S3) one must still use this utility to get a working Day/Night profile switch? If so, I dont understand how this issue keeps going unresolved for years. Seems like a simple bug fix.

For the record the only thing i see within the camera's web interface is under Camera > Image > Day/Night Switch. Sure i can set different values for Day or Night but the camera simply displays the selected Profile indefinitely. I guess the word "switch" means it allows me to manually switch between profiles when I feel it is time to do so. What bizarre logic when the camera itself knows whether it is day or night and can switch itself. I suppose the firmware source code isnt available.

I don't see this equivalent Profile Management within the new S3 web interface. Looks sensible ...
 

Attachments

  • Clipboard01.jpg
    Clipboard01.jpg
    41.1 KB · Views: 18
Last edited:
  • Like
Reactions: c hris527
The camera can switch in its own using its light sensor.

We don’t recommend it though. Cameras are dumb. Much better to switch manually.
 
Whats the current position with the 4kT? Is the utility fixed yet to work with it? I have mine switching by schedule but it would be far better to have sunset data controlling the switch.
 
Whats the current position with the 4kT? Is the utility fixed yet to work with it? I have mine switching by schedule but it would be far better to have sunset data controlling the switch.

@bp2008 hasn't maintained the utility in a long time and last mention was he wasn't going to update it since we now have the PTZ preset "hack" that can be used to call API, I suspect that is what he would do.
 
I tried the PTZ hack but it didn't work. Maybe I need to revisit it. It's a pity we either don't have an app or Dahua don't integrate something into the camera to switch it over. One thing I have found with set time switchovers is if you get a stormy dark day, it switches too late. Set it for that time and get a bright sunny day, and it can be too early, by as a much as an hour or more in either situation. Some kind of light level detection in camera definately sounds the way to go if it can be made to work well. Maybe as well as a time schedule, Dahua should offer a lumen setting so when the lumen hits a certain level, that's the trigger for the camera exposure profile switch rather than the fixed time. Feedback from Andy to Dahua?
 
I tried the PTZ hack but it didn't work. Maybe I need to revisit it. It's a pity we either don't have an app or Dahua don't integrate something into the camera to switch it over. One thing I have found with set time switchovers is if you get a stormy dark day, it switches too late. Set it for that time and get a bright sunny day, and it can be too early, by as a much as an hour or more in either situation. Some kind of light level detection in camera definately sounds the way to go if it can be made to work well. Maybe as well as a time schedule, Dahua should offer a lumen setting so when the lumen hits a certain level, that's the trigger for the camera exposure profile switch rather than the fixed time. Feedback from Andy to Dahua?

You probably have an extra space or something because the API works. The first thing to do is to try the command in the CMD and confirm you have it correct. Once it switches there then put it into the PTZ hack.

In the past, most of the cameras all that the built-in function does is switch it from color to B/W and infrared, but it uses the same settings for both (using the normal setting 24/7 but only switching to color or B/W based on light). That works well for Dahua's intended customer that are businesses that usually have enough light.

For us homeowners, using the same shutter and brightness, gamma, gain, etc. doesn't work for sunny days and dark nights and we need two distinct settings, and that is where this utility comes in.

We have tried for years passing feedback to Andy/Dahua, but we are not their intended market.

Now with that said, it does appear that the cameras with the newer GUI do switch they way they are supposed to (or the way we want them to), so give that a try and see if it works for your use case.
 
Whats the current position with the 4kT? Is the utility fixed yet to work with it? I have mine switching by schedule but it would be far better to have sunset data controlling the switch.
Like I said over in the 4KT thread, it never stopped working for me. Unless this app should be doing something more then just going between day and night mode (and their associated settings for the two profiles), it's working perfectly for me.
 
One thing I have found with set time switchovers is if you get a stormy dark day, it switches too late. Set it for that time and get a bright sunny day, and it can be too early, by as a much as an hour or more in either situation.
Then you will have the same issue with the Day/Night Utility or any other scenario that uses dusk and dawn times to make that switch. There is at least one person here that uses a light sensor and some kind of home automation set up to make the cams switch. Can't remember who. But a search of threads might find this.
 
  • Like
Reactions: Skinny1