Dahua day/night switch utility - DahuaSunriseSunset

Never did get this fixed.

I have three of these cameras; add me to the list of those whose channel 2 does not respond to the utility.
 
  • Like
Reactions: EMPIRETECANDY
The channel 2 there always at black/white at daytime? Can manually switch this or not?
 
By "manually switching" are you talking about using the dropdown to select profile Night vs Day? If so then I can manually switch the profile between night and day.

1605669560450.png

1605669607504.png
 

Attachments

  • 1605669487965.png
    1605669487965.png
    210.6 KB · Views: 8
Does anybody know if there is a Linux script knocking around rather than a windows .exe? I have a Dell Poweredge server running Ubuntu among various other things 24/7 and i'd like to be able to run a script similar to the windows tool (grabs sunrise/sunset times for my area and applies settings to cameras). I'm more of a hardware guy so this is beyond my ability!
 
Does anybody know if there is a Linux script knocking around rather than a windows .exe? I have a Dell Poweredge server running Ubuntu among various other things 24/7 and i'd like to be able to run a script similar to the windows tool (grabs sunrise/sunset times for my area and applies settings to cameras). I'm more of a hardware guy so this is beyond my ability!

You will need to download and compile Sunwait and then create a simple cron job that executes it. It’s real simple and foolproof.
 

You will need to download and compile Sunwait and then create a simple cron job that executes it. It’s real simple and foolproof.

Many thanks, I should be able to work that out.
 
Many thanks, I should be able to work that out.

To give you a bit of a hint, here is what the cron job looks for switching my Dahua LPR camera to night time settings via sunwait. Cron kicks this off at 4pm and then passes it to sunwait. Sunwait has the 30 minute offset here in the command so it waits till 30 minutes before sunset based off my lat/long. When we finally get 30 minutes out to sunset, sunwait executes the rest of the command that turns the camera to night settings.

Bash:
# LPR Cam Night Switch - 30 Minutes before Sunset
0 16 * * * /home/joe/sunwait/sunwait wait set offset +00:30 30.19N 85.79W ; wget -O - --user username --password password "10.200.200.12:65002/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1" >/dev/null 2>&1
 
  • Like
Reactions: genelit
Does anybody know if there is a Linux script knocking around rather than a windows .exe?

I use the following BASH script to do that on my Synology NAS. It runs every day and calculates sunrise-20min and sunset+20min. It then configures start/stop of night mode. You'll have to provide your own password and ip addresses. If all you want to do is adjust the sunset/sunrise this is all you need. Probably running it once a week is close enough.

It also sleeps until sunset+19Min. On one of my cameras I manually set "Normal" mode at sunset+20 and then at midnight another script switches it to night mode - this to deal with landscape lighting that runs until midnight. With minor modification it should work on any flavor of Linux (including MacOS)
!/bin/bash
location="AUS"
# we get all the web page
allfile=$( wget -qO- '
# we get the original sunrise/sunset time values
sunrise_str=$(echo $allfile | sed -ne '/Sunrise/{s/.<Sunrise>\(.\)<\/Sunrise>.*/\1/p;q;}')
sunset_str=$(echo $allfile | sed -ne '/Sunset/{s/.<Sunset>\(.\)<\/Sunset>.*/\1/p;q;}')
# we convert time values to Time in 24-hour format
sunset=$(date --date="$sunset_str +20 minutes" +%T)
sunrise=$(date --date="$sunrise_str -20 minutes" +%T)
sunsetsec=$(date --date="$sunset_str +19 minutes" +%s)
/usr/bin/curl -s -g --digest -u admin:password "{sunrise}-${sunset}" >> timechange.log
now=$(date)
nowsec=$(date +%s)
sleeptime=$(( sunsetsec - nowsec ))
echo "$now Setting sunrise $sunrise, sunset $sunset in $sleeptime seconds" >> timechange.log
sleep $sleeptime
# insert code here to run at sunset +19 minutes
 
Last edited:
I just had the craziest thing happen and what are the odds.

I check in daily on my system to check for any activity at night and my LPR camera went to full wide field of view when it switched to daytime. So I have missed quite a few plates in that time.

I just pulled up the camera log file and it rebooted at the exact same time as the utility was starting and the camera went thru a serious of startup and reboots and for whatever reason when it came back online, it defaulted to wide zoom instead of its most recent set zoom.

Best I can tell, the SD Card was full and I have seen before these cams can get buggy when that happens.

What are the odds those two events would happen at the same time!
 
  • Wow
Reactions: sebastiantombs
Trying to setup back the Utility and i setup all the settings and this morning i see that it did change over from night to day but the focus is left at 0 in camera settings, in the utility when clicked to get current zoom focus i get 1.000000 on both and looks like the utility or the cam settings did not go where it suppose to.
Day : Zoom @ 900 and Focus @ 1616
Night : Zoom @ 920 and Focus @ 1577 (still working and getting this to work to read the plates at night,as just installed the cam back z12e.)
All my setup info :
2021-01-18_8-03-33.jpg


I m setting something wrong or...

Regards,
 
Last edited:
Change the "seconds between lens commands" to a much larger number. This cam can take several seconds making the switch over and with only 2 seconds, it probably ended the command before the routine was finished. Do that and then hit the simulate sunrise and see if it took and simulate sunset and see if it took.

And putting your cam IP addresses does not tell anyone anything - they are the same as everyone else. The IP address of your service provider for your WAN is what you don't provide...Everything on the inside past the modem is fine to put out. Everything on the inside, the local will fall under these ranges and you are not telling anyone anything about how to hack your system providing these ranges (basically any IP that starts out 10. or 172. or 192. are reserved for the "home side" of the service so every home internally will be within this same range):

10.0.0.0 – 10.255.255.255
172.16.0.0 – 172.31.255.255
192.168.0.0 – 192.168.255.255

What is the utility logfile saying - does it say it ran correctly or showing an error. There could also be an error.
 
Last edited:
Yes, 192.168... just me editing stuff :smash: , also i have changed switched the sunrise and sunset , my bad there.

Now i put 10 sec for the switch commands, is that enough?

I have tested to see if zoom/focus moves from day to night and back and looks that it does work fine, but in the cam settings under zoom and focus, the cursors are not moving, they still at 0 and speed at 1 witch normally i have speed at 20 and the day and night zoom / focus settings.

2021-01-18_13-47-31.jpg

As the log file see attached.

Regards!
 

Attachments

Log file looks good.

10 seconds should be enough. A few here have had problems and had to go longer or write a script to periodically adjust it.

As long as the camera is responding correctly to the commands and the image is zooming and focusing, I wouldn't worry about what the settings show - they should adjust, but maybe you got a wonky firmware bug that is causing that. I have the 5231 like you and did not update it as people were reporting issues.

You could also try a reboot or factory reset and see if that corrects it, but again as long as the image is what you want, that is the important part. What does the zoom/focus settings show if you look at it from the live image view instead of in the settings view - maybe it is only whacked out in the settings screen?
 
  • Like
Reactions: patrocle
Ya, looks that something maybe from the firmware. I just installed the latest from here
and that maybe why the zoom / focus numbers don't show up.
I have rebooted and still no show.

But it does show on live if hoover on it.

View attachment 2021-01-18_14-26-35.mp4
















Now regarding the change over hours, what maybe better ? to start early like before the sunset starts,like 30 min, or 1 hour before or it all depends on settings of the cam ?

Here is my city location:

Latitude 38.748058
Longitude -121.285202
Sunset starts at 5:12:04 PM
Sunrise Starts at 7:21:19 AM
I have it setup :
Sunrise Offset Hours: -1
Sunset Offset Hours: 1

So -1 = 1 hour before sunrise? so let say 6:21:19 am ?
1= 1 hour before sunset?

Will monitor this tonight to see what happens.

Regards,
 
Yeah, probably a firmware issue. I always make my zoom/focus from the live screen anyway.

As far as the offset, that will be based on your situation and how much sun you get or don't get at the location the camera is pointing.

I have mine stay in night mode at sunrise for a half hour longer, so 0.5 because sunrise still has too many trees to get over so it stays darker longer and then throw the fast shutter on top of that.

I have mine go into night mode at sunset 15 minutes before, so -0.25 to account for the trees blocking light.

I suspect you will probably want to do something similar - have it go into night mode prior to sunset and have it stay in night mode a little longer after sunrise.
 
  • Like
Reactions: patrocle
Hey everyone, i have a short question. I read through thus topic, but i don't understand Everthing Most of you want to Change the night and day Profil by the Sunset. So when you have multiple cameras they Change there Profil at the Same Time, right?

So now i to my question. I have a IMOU Nee Bullet IP Camera. As i know IMOU is the consumer Brand of Dahua, the Webinterface Looks the Same. I want that the Camera Change the Profil from day to night, when the Camera detecs darknes and Switch to Black and white Mode.

Unter Profile Management i have General, Full Time and schedule. How i have to config it, that the Camera Change auto. the Profil?

I Hope someone can Help me.

Thanks a Lot!
 
Last edited:
Try the "Full Time". I run my Dahuas in "Full Time" with no problems. How that might work for an Imou is a good question. Let us know how it works out.
 
  • Like
Reactions: handinpalm
Thanks for the answer. But when i choose Full Time i can only select one of the three profils. My problem is that at night a need to adjust the brightness and Other thinks because the Camera is near to a wall, so the IR light Lights Up the Wall too much.
The best think is when the Profils Change when the Camera goes to nightvision