Add Sunrise Sunset to Time Plan Settings

BLUF: Figured it out. Didn't have the cgi service running. Yep. That simple.

As a retired sysadmin / network admin I decided the best way to retain my sanity was to drag out an old POE dumb switch and setup a little test network where I could modify my spare empiretech cams at will using an old laptop.

I also grabbed the curl command lines and started running them in verbose mode and that's what final clued me in that something on the camera wasn't responding even though it should have been. After enabling the cgi service it was just a matter of setting the day / night options correctly in the cam via testing with curl. After I could reliably switch them from day to night and back to day the next test was getting it working via action sets in BlueIris. Only took a couple tweaks using the test button and had that fixed as well.

So I have one cam all setup to switch over tonight 30 minutes prior to sunset and 30 minutes after sunrise. Here's the commands I loaded into the BI action sets:
For Night:
user:[email protected]:4561/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[].NightOptions.SwitchMode=3&VideoInOptions[].NightOptions.DayNightColor=2

For Day:
user:[email protected]:4561/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[].NightOptions.SwitchMode=0&VideoInOptions[].NightOptions.DayNightColor=0

Again, thanks guys for all the recommendations.
 
  • Like
Reactions: CamCrazy and Tinman
Awww the good ole shutting stuff off and not realizing what it does LOL. Been there....got the tshirt LOL.

Glad you figured it out.
 
BLUF: Figured it out. Didn't have the cgi service running. Yep. That simple.

As a retired sysadmin / network admin I decided the best way to retain my sanity was to drag out an old POE dumb switch and setup a little test network where I could modify my spare empiretech cams at will using an old laptop.

I also grabbed the curl command lines and started running them in verbose mode and that's what final clued me in that something on the camera wasn't responding even though it should have been. After enabling the cgi service it was just a matter of setting the day / night options correctly in the cam via testing with curl. After I could reliably switch them from day to night and back to day the next test was getting it working via action sets in BlueIris. Only took a couple tweaks using the test button and had that fixed as well.

So I have one cam all setup to switch over tonight 30 minutes prior to sunset and 30 minutes after sunrise. Here's the commands I loaded into the BI action sets:
For Night:
user:[email protected]:4561/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[].NightOptions.SwitchMode=3&VideoInOptions[].NightOptions.DayNightColor=2

For Day:
user:[email protected]:4561/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[].NightOptions.SwitchMode=0&VideoInOptions[].NightOptions.DayNightColor=0

Again, thanks guys for all the recommendations.
Didn't see that coming, nice work though. Being retired admin I know that will have hurt more than most, we are often looking for the more complex answer though, it happens.
 
Yep - for years it was hammered into me that if a service isn't required it shouldn't be running so when I first set up my cams years ago and until now I had no need for the cgi service and most of the others that are available so I disabled them. I was also using port forwarding until about a year ago when I switched over to using wire guard for external access to my cams so again, less services for some bad actor to try and hack into.

All my cams switched over to night mode last night at 30 minutes prior to sunset and I'm waiting to see them switch back over to day mode this morning.
 
@bp20089 has instructions for something like this in his post where he said he has stopped using his sunrise/sunset app.
I asked ChatGPT to modify bp2008's DahuaSunriseSunset utility to support new GUI cameras as well as legacy-API cameras, and I have the fix documented in this other thread.
  • It now queries
  • curl -g --digest -u '<user>:<password>' "http://<Camera-IP-Address>/cgi-bin/configManager.cgi?action=getConfig&name=VideoInMode""
and:
  • If getConfig&name=VideoInMode contains ConfigEx, use:
    • VideoInMode[...].ConfigEx=Day
    • VideoInMode[...].ConfigEx=Night
  • if it contains Config[0], use:
    • VideoInMode[...].Config[0]=0
    • VideoInMode[...].Config[0]=1
New files available in that other thread.
 
Last edited:
I use the following from Blue Iris on a T54IR-ZE-S3 Turret and they work fine:

Sunrise
Code:
user:password@cameraIPaddress/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[].NightOptions.SwitchMode=0&VideoInOptions[].NightOptions.DayNightColor=0

Sunset
Code:
user:password@cameraIPaddress/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[].NightOptions.SwitchMode=3&VideoInOptions[].NightOptions.DayNightColor=2

But I also still use the Dahua Sunrise/Sunset app to switch my B54IR-Z4E-S3, although this is the older interface.

I do have ONVIF Login Verification turned off on the T54IR-ZE-S3, keep that in mind. See screen shot..

If you need more info let me know, took a bit for me to get this nailed down initially!
Thanks for this info. It works and I use it with "Customized Scene" profile on two T54's like yours and one 4K T180 cam. I use the string described by the OP for my other four older cameras.

May I ask where you found this API string and if there's a list of them?
 
Thanks for this info. It works and I use it with "Customized Scene" profile on two T54's like yours and one 4K T180 cam. I use the string described by the OP for my other four older cameras.

May I ask where you found this API string and if there's a list of them?
Believe this was trial and error on my part, unless I dug it out from another thread, combination I suspect. Sadly no list that I can remember though.
 
If you guys run linux, you can use Sunwait to issue a command via cron to your cameras directly. I talked about it several years ago here:
No need for any BI profile shenanigans if all you want to do is change your camera profiles from day to night and vice versa.
 
  • Like
Reactions: biggen