SD4A425DB-HNY Day/Night Switch

MikeLud1

IPCT Contributor
Joined
Apr 5, 2017
Messages
2,218
Reaction score
4,257
Location
Brooklyn, NY
Where in BI do you enter the web calls? I tried this before, but I need it explained like I am 5 year old.
See the below link

 

Alaska Country

Getting comfortable
Joined
Jun 10, 2021
Messages
449
Reaction score
657
Location
Alaska
Where in BI do you enter the web calls? I tried this before, but I need it explained like I am 5 year old.
This API call has only been tested on the Web 5 Dahua camera GUI for the SD5A425XA PTZ and HFW5442E-Z4E-S3.

One way to test the code is to run on a browser that is on the same network or subnet that the cameras are on. Usually your BI computer.

One quick test is to enter the following into your browser to check the camera time. Note: change the user name and password and the camera IP address for your specific needs.
Code:
http://admin:yourpassword@192.168.57.14/cgi-bin/global.cgi?action=getCurrentTime
This should return the following:

result=2023-12-27-15:27:08

If the test works, then modify the provided URL (sunrise-day mode) and enter into your browser. Then go to that camera's GUI in BI under camera and "Time Plan Settings". Take a look at the time line for December and it should have changed to all orange.

Time Plan Settings Day December.PNG

Also, it is best to set all of the remaining months to solid purple from 00:00:00 to 24:00:00. Complete one month and use the built in copy function.

Then use the sunset-night mode URL and the December time plan setting line will change from orange to purple.

Time Plan Settings Night December.PNG

There is also a PTZ hack that can be used to run the API code in Blue Iris. The following explains the process.


With this PTZ hack, one can set the camera mode switch time to your local sunrise/set plus a time offset. The point of concern, is that the provided "Time Plan Settings" API is month sensitive. When December changes to January the month number will have to be changed from 11 to 0 in the API code that was entered into BI.

For my use, a Hubitat home automation system is used to trigger the API to change day/night camera modes. Plus another Hubitat script is used to change to the correct month number.

Changing by sunrise/sunset with an offset does work and is reliable. The present system has been altered to use LUX in place of a time offset to actually switch day/night modes based on light intensity rather than time based.
 

Webfont

Pulling my weight
Joined
Sep 6, 2018
Messages
138
Reaction score
179
Location
Canada
What I did for scripting my settings changes was to F12 in the browser and snooped what call the webgui was doing to itself when I clicked to save the setting,
Then just replicated that with a php curl call and have it cronned on a daily basis. (for hikvision gotta also pass some xml to the post)
This generic snoop and replicate method should work for pretty much any IP camera with a webgui.

Bonus: In my script I'm also fetching data from so I have fresh sunrise/sunset values daily :)
 
Top