Dahua day/night switch utility - DahuaSunriseSunset

On the DahuaSunriseSunset utility, how are the offset hours configured?

If I want to start the day schedule an hour before sunrise and the night schedule an hour after sunset, would the fields look like this?

Sunrise Offset Hours: -1
Sunset Offset Hours: 1

Also, I am wondering how the camera should be configured in its own UI. The Profile Management is set for a "Schedule". Do I need to move it to "Full Time / Day"? "Day/Night"? or "General"?
 
On the DahuaSunriseSunset utility, how are the offset hours configured?

If I want to start the day schedule an hour before sunrise and the night schedule an hour after sunset, would the fields look like this?

Sunrise Offset Hours: -1
Sunset Offset Hours: 1

Also, I am wondering how the camera should be configured in its own UI. The Profile Management is set for a "Schedule". Do I need to move it to "Full Time / Day"? "Day/Night"? or "General"?


You have the offsets correct for what you want to do. On the cam setup the "schedule" for full time. The utility will switch it.
 
I have each camera configured with a Day and Night focus value. The Night value is getting applied but not the Day value. Anyone else experiencing this? Thanks
 
Just wanted to share my solution. I have linux machine that runs this script every day:

Bash:
#!/bin/bash

sun_times=($( wget -qO- https://weather.com/weather/today/l/MDXX0005:1:MD | sed 's/ /\n/g' | sed -n '/p0-details-sunrise\|dp0-details-sunset/s/[^>]*>/p' ))
# Extract sunrise and sunset times and convert to 24 hour format
sunrise=$(date --date="${sun_times[0]} AM -1 hour" +%R)
sunset=$(date --date="${sun_times[1]} PM +1 hour" +%R)

sr_hm=(${sunrise/:/ })
ss_hm=(${sunset/:/ })

now=$(date)
echo "$now Setting sunrise $sunrise, sunset $sunset" >> timechange.log

/usr/bin/curl -s -g --digest -u admin:password "http://10.0.0.45/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SunriseHour=${sr_hm[0]}" >> timechange.log
/usr/bin/curl -s -g --digest -u admin:password "http://10.0.0.45/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SunriseMinute=${sr_hm[1]}" >> timechange.log
/usr/bin/curl -s -g --digest -u admin:password "http://10.0.0.45/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SunsetHour=${ss_hm[0]}" >> timechange.log
/usr/bin/curl -s -g --digest -u admin:password "http://10.0.0.45/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SunsetMinute=${ss_hm[1]}" >> timechange.log

So, it gets sunset/sunrise time for location, minus one hour from sunrise, plus one hour to sunset and change settings on camera. Camera set to switch day/night mode by schedule. This is better than changing day/night mode directly.
You can run this script even once a week, because sunrise/sunset times change only by few minutes per day.
 
Run that through Raspberry Pi
Just wanted to share my solution. I have linux machine that runs this script every day:

Bash:
#!/bin/bash

sun_times=($( wget -qO- https://weather.com/weather/today/l/MDXX0005:1:MD | sed 's/ /\n/g' | sed -n '/p0-details-sunrise\|dp0-details-sunset/s/[^>]*>/p' ))
# Extract sunrise and sunset times and convert to 24 hour format
sunrise=$(date --date="${sun_times[0]} AM -1 hour" +%R)
sunset=$(date --date="${sun_times[1]} PM +1 hour" +%R)

sr_hm=(${sunrise/:/ })
ss_hm=(${sunset/:/ })

now=$(date)
echo "$now Setting sunrise $sunrise, sunset $sunset" >> timechange.log

/usr/bin/curl -s -g --digest -u admin:password "http://10.0.0.45/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SunriseHour=${sr_hm[0]}" >> timechange.log
/usr/bin/curl -s -g --digest -u admin:password "http://10.0.0.45/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SunriseMinute=${sr_hm[1]}" >> timechange.log
/usr/bin/curl -s -g --digest -u admin:password "http://10.0.0.45/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SunsetHour=${ss_hm[0]}" >> timechange.log
/usr/bin/curl -s -g --digest -u admin:password "http://10.0.0.45/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SunsetMinute=${ss_hm[1]}" >> timechange.log

So, it gets sunset/sunrise time for location, minus one hour from sunrise, plus one hour to sunset and change settings on camera. Camera set to switch day/night mode by schedule. This is better than changing day/night mode directly.
You can run this script even once a week, because sunrise/sunset times change only by few minutes per day.
 
I have each camera configured with a Day and Night focus value. The Night value is getting applied but not the Day value. Anyone else experiencing this? Thanks
I'm still having this issue. Are any of you seeing it as well? Thanks
 
I'm still having this issue. Are any of you seeing it as well? Thanks
Yes. I just started using this, so I'm still walking through my config to see if I missed anything. Simulating sunrise and sunset works, but the cameras did not shift to day mode yesterday.
 
Yes. I just started using this, so I'm still walking through my config to see if I missed anything. Simulating sunrise and sunset works, but the cameras did not shift to day mode yesterday.
My cameras change from Day/Night just fine but the focus setting for each state don't get applied.
 
After carefully checking all settings and restarting the service, mine is working fine. I was surprised to see that the focus numbers would be different day vs night even when focused on the same point. I think my first testing used the same numbers in both modes.
 
After carefully checking all settings and restarting the service, mine is working fine. I was surprised to see that the focus numbers would be different day vs night even when focused on the same point. I think my first testing used the same numbers in both modes.
Yeah, focus is supposed to be different between Day/Night even with the same zoom. I wish mine would change for each, not sure why it's not.
 
More testing showed that sometimes the camera auto focus takes so long that the focus commands arrive while the camera is still thinking. My scene has very few edges for the auto focus to work with in night mode. Adding more time between commands in the config should solve this issue.
 
More testing showed that sometimes the camera auto focus takes so long that the focus commands arrive while the camera is still thinking. My scene has very few edges for the auto focus to work with in night mode. Adding more time between commands in the config should solve this issue.
I'm trying a day and night focus setting again with a 30 second setting between lens commands instead of 10 seconds.
 
I'm trying a day and night focus setting again with a 30 second setting between lens commands instead of 10 seconds.
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.
 
It works OK for channel 1, but has no effect for channel 2.
Do you have any idea how can I trigger also the second channel?

I don't have any multi-sensor cams, but I looked at the API documentation and I think I know what I need to change to support them. I'll see if I can put out a new release with the ability to specify the channel number.
 
@costib Please try version 1.5 and let me know if it works.

 
Having both channels configured inside the tool, when running the first sunrise simulation only one channel keeps the setting, the other one applies it just for 1 second and reverts to initial state.
Running another consecutive sunrise simulation, forces the problematic channel to change the setting accordingly and keep it.
Same thing for running sunset simulation, it has to be executed 2 times...