Dahua day/night switch utility - DahuaSunriseSunset

DLONG2

Known around here
Joined
May 17, 2017
Messages
763
Reaction score
454
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"?
 

jrf

Getting the hang of it
Joined
Sep 12, 2017
Messages
169
Reaction score
93
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.
 

105437

BIT Beta Team
Joined
Jun 8, 2015
Messages
1,998
Reaction score
884
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
 

105437

BIT Beta Team
Joined
Jun 8, 2015
Messages
1,998
Reaction score
884
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
Anyone else having this issue? Thanks
 

sba230

n3wb
Joined
Oct 17, 2019
Messages
1
Reaction score
4
Location
Moscow, Russia
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.
 

Arjun

Known around here
Joined
Feb 26, 2017
Messages
9,015
Reaction score
11,032
Location
USA
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.
 

105437

BIT Beta Team
Joined
Jun 8, 2015
Messages
1,998
Reaction score
884
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
 

bike_rider

Young grasshopper
Joined
Mar 14, 2015
Messages
53
Reaction score
11
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.
 

105437

BIT Beta Team
Joined
Jun 8, 2015
Messages
1,998
Reaction score
884
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.
 

bike_rider

Young grasshopper
Joined
Mar 14, 2015
Messages
53
Reaction score
11
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.
 

105437

BIT Beta Team
Joined
Jun 8, 2015
Messages
1,998
Reaction score
884
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.
 

bike_rider

Young grasshopper
Joined
Mar 14, 2015
Messages
53
Reaction score
11
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.
 

105437

BIT Beta Team
Joined
Jun 8, 2015
Messages
1,998
Reaction score
884
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.
 

105437

BIT Beta Team
Joined
Jun 8, 2015
Messages
1,998
Reaction score
884
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.
 

costib

Young grasshopper
Joined
Aug 22, 2018
Messages
46
Reaction score
8
Location
Transilvania
Hi @bp2008, I'm trying to use this tool with IPC-HDBW4231F-E2-M(this is dual lens camera, bought from Andy).
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?

Thanks,
Costi B.
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,666
Reaction score
14,007
Location
USA
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

Young grasshopper
Joined
Aug 22, 2018
Messages
46
Reaction score
8
Location
Transilvania
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...
 
Top