bp2008 / DahuaSunriseSunset

A Windows Service which changes the profile of dahua cameras between Night and Day at each sunset and sunrise.
GNU General Public License v2.0
19 stars 8 forks source link

Not working with turret cams #3

Closed notsolowki closed 4 years ago

notsolowki commented 6 years ago

the program works with my dahua zoom camera but not the turret cams their model numbers are IPC-HDW4631C. when i try on those cameras the program just freezes indefinitely

bp2008 commented 6 years ago

Hmm. I assume you mean it freezes when you press Simulate Sunrise or Simulate Sunset? I should probably make that test happen in a background thread with a status panel showing what is happening...

Is there an error in the error log file?

What happens if you send either of these commands to the camera via a web browser? (change the IP address 127.0.0.1 to your camera's address).

This is the "day" command: http://127.0.0.1/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=0

This is the "night" command: http://127.0.0.1/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1

notsolowki commented 6 years ago

when i run the command on my IPC-HFW4631H-ZSA zoom camera it works. on my turret cams it says invalid authority even though i'm logging into the camera. also sorry the program dont freeze indefinitely it freezes for 30 seconds. just found the log the error is 9/25/2018 10:16:16 PM TriggerSunriseActions 9/25/2018 10:16:16 PM Exception thrown attempting web request (http://10.0.0.65:80/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=0): The remote server returned an error: (401) Unauthorized.

notsolowki commented 6 years ago

Sorry i was actually entering the password wrong. now that ive entered it right i just get an error that says bad request but i dont get in error in the log file from your program just the http link

notsolowki commented 6 years ago

also i want to throw something out there although you posted the source code, maybe you can implement a feature with your program to accept input from an arduino. if a wifi or ethernet arduino with a photo sensor attached could send a command to you program when night and day changes then your program could send the commands to all the cameras and activate the schedules. maybe even implement a way to send a custom request to other cameras too. i just think this program has a lot of potential if there were a few more features like that it would be a full blown command center

bp2008 commented 6 years ago

All I can think of to suggest is that maybe this camera doesn't have its profile set to "full time". I think the camera's profile scheduling needs to be set to "Full Time" (the mode where you choose day or night from a dropdown list in the camera UI).

It is definitely possible to make this program accept input via an embedded web server, however if you have an arduino with network connectivity you are probably better off just having it send commands directly to the cameras.

notsolowki commented 6 years ago

im pretty sure the problem is with the api commands. even on blueiris i have to select dahua new on the turret cameras and dahua ipc hdw5231r-z for the zoom camera so i know they have different api commands. and none of them operate the day night mode on the dahua zoom camera i would actually have to go into the cameras web gui to change it for some reason. however it works with your program just not the turret cameras

notsolowki commented 6 years ago

Here's the api command that works with the IPC-HDW4631C turret cams http://x.x.x.x/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].DayNightColor=0

0 = multicolor 1 = auto 2 = monochrome

and as far as sending the commands with the arduino, the cameras are using digest authentication im not sure how easy that would be