video-noob 0 Posted November 14, 2014 The URL is the same as the others.... I pulled the XML out with WireShark and split it up into sections. If there is a better way to post the XML let me know.I don't know of a better way. This works just fine. Your posting made me realize there is an easier way to do it, so now only the XML is needed and the URL gets auto-detected. This makes adding new controls easier. I've attached version 2 with the following changes: Add more controls, thanks FastEddy Auto-detect Windows and call appropriate at command Try to auto-detect lat/long Do a better job with DEBUG: > 0 will not schedule future actions, >= 1 will print URLs, >= 2 will run actions EDIT: Stupid logic error in v2, fixed in v3. I tried the attached version on a Ubuntu install and its asking for the modules ( you may need to install the DateTime::Event::Sunrise module ) ... Do you have these modules I can also use? Thanks Share this post Link to post Share on other sites
Ziegeid 0 Posted November 14, 2014 I tried the attached version on a Ubuntu install and its asking for the modules ( you may need to install the DateTime::Event::Sunrise module ) ... Do you have these modules I can also use? You should be able to install it with:sudo apt-get install libdatetime-event-sunrise-perl If that does not work, then this should: sudo cpan DateTime::Event::Sunrise Share this post Link to post Share on other sites
video-noob 0 Posted November 14, 2014 I tried the attached version on a Ubuntu install and its asking for the modules ( you may need to install the DateTime::Event::Sunrise module ) ... Do you have these modules I can also use? You should be able to install it with:sudo apt-get install libdatetime-event-sunrise-perl If that does not work, then this should: sudo cpan DateTime::Event::Sunrise Got these functioning Thanks!! I believe there's a logic error for day night in this version? OUTPUT /mnt/dunn-nas-1/House_Docs/Video Surveillance/Hikvision-WDR$ perl ./rick-hikvision-raptor-schedule-adjustments-v3-DUNN.pl 2014-11-14 16:18: night Next sunset: 2014-11-15 06:49 Next sunrise: 2014-11-14 19:58 Is there a newer version with day night flipped?? NEVER MIND HAD MY Longitude on the wrong side of the Globe Fixed DOH!! Share this post Link to post Share on other sites
Ziegeid 0 Posted November 14, 2014 NEVER MIND HAD MY Longitude on the wrong side of the Globe Fixed DOH!!Excellent, that was going to be my first question. Share this post Link to post Share on other sites
video-noob 0 Posted November 16, 2014 The script assumes it's running on a UNIX like system and uses the at program to schedule itself for the next run. Question: Got the script to run Yeah and it schedules itself for another run however after that I can't find it resheduling itself after? Do I need to do a cron job to keep it going forever? Thanks as always... Share this post Link to post Share on other sites
Ziegeid 0 Posted November 17, 2014 Question: Got the script to run Yeah and it schedules itself for another run however after that I can't find it resheduling itself after? Do I need to do a cron job to keep it going forever? Thanks as always... If it manages to reschedule itself once, it should keep on rescheduling itself forever. At the end of every run the last thing it does is to call `at' with the next sun rise/set event time. The output of runq shows no job scheduled? DEBUG isn't set by any chance is it? That will prevent the scheduling. Of course, the computer needs to be on at the time of the event. Are you getting any email with the output? I get two a day, with a subject like: Output from your job 1016. Share this post Link to post Share on other sites
video-noob 0 Posted November 19, 2014 If it manages to reschedule itself once, it should keep on rescheduling itself forever. At the end of every run the last thing it does is to call `at' with the next sun rise/set event time. The output of runq shows no job scheduled? DEBUG isn't set by any chance is it? That will prevent the scheduling. Of course, the computer needs to be on at the time of the event. Are you getting any email with the output? I get two a day, with a subject like: Output from your job 1016. I ran it again the see it scheduled using the atq and I am also keeping the shell window opened. Will check again after the next run time to see how it does. Thanks. Edit:: Found the problem, I was running the script from a SMB share that root didn't have access to so the subsequent at run had nothing to do. Running now from my home dir and all should be good. Share this post Link to post Share on other sites
netcamming 0 Posted November 25, 2014 If you do some packet captures (I've used Chrome's built in tool or Wireshark) you can pull the URL and the XML out and then add them to the script. Just put a %s in where the variable needs to go. Hikvision has API documentation, there's no need to do packet captures to find the commands. I posted a link a few months back. http://www.cctvforum.com/viewtopic.php?f=19&t=36502 Oops, looks like they moved it, here's the current location: http://www.hikvisioneurope.com/portal/index.php?dir=Integration%20and%20Development%20Materials/00%20%20%20CGI/&file=HIKVISION%20CGI%20IPMD%20V1.5.9.pdf Just in case you didn't know there's a v2.0 of the API. http://oversea-download.hikvision.com/uploadfile/Leaflet/ISAPI/HIKVISION%20ISAPI_2.0-IPMD%20Service.pdf Share this post Link to post Share on other sites
netcamming 0 Posted November 25, 2014 I'm attempting to modify this to simply run as a standalone script that I'll call with an external program based on actual luminance (lights levels) vs prescribed sunrise/sunset. Also, I have a need for three different profiles since I need one for night, one for morning (sun shining directly at cam), and day. Also, I'll be trying to add BLC as I have one cam that this setting is very effective for vs WDR. Share this post Link to post Share on other sites
dan_man 0 Posted January 22, 2015 ... install DateTime-Event-Sunrise package,... Greetings, Can you elaborate on installing DateTime-Events-Sunrise package in windows environment? Where did you find it? Google searches on this package seem to be all Linux related. Thanks Share this post Link to post Share on other sites
ravedog 0 Posted August 14, 2015 Hopefully someone is still reading this thread. I tried to get this to work on one of my Hikvison cameras from the terminal and it "appeared" to work but nothing changed: I'm running Mac OS X 10.9.5 and a Hikvision DS-2CD2332-I running V5.2.0 build 140721. I installed the datetime-Event-sunrise (somehow), filled out info for my lat long and one cameras ip and login in the perl script. Ran the script. Got: 2015-08-14 13:27: night Next sunset: 2015-08-15 10:39 Next sunrise: 2015-08-14 18:40 192.168.1.171 => night: WDR => 0, NoiseReduceExt => 90, success echo /Users/ravedog/Downloads/hikvisionadjustments.pl | at -m 18:50 job 4 at Fri Aug 14 18:50:00 2015 Also doesn't appear to be getting the times right for sunrise/sunset even though I put in my lat long FYI: Fairly unknowledgeable about the terminal or perl. Enough to be dangerous. Does this work on this camera and does this work on this firmware. Any up to walking me through how to change this? Thanks for your time. Share this post Link to post Share on other sites