Camera Event Scheduler to Run Program or Execute Script

pepperfr

Getting the hang of it
Joined
Feb 8, 2015
Messages
96
Reaction score
36
Location
Ohio
Is anyone aware of any hidden Blue Iris capability that would allow running a program or executing a script relative to dawn and dusk?

Something I have wished for in Blue Iris is the ability to run a program or execute a script at dusk and dawn. The camera event scheduler comes pretty close to allowing me to accomplish what I am trying to do, but won't actually allow running programs or scripts. The event scheduler does allow making certain camera exposure adjustments, but the choices are limited. Being able to run a program would allow full flexibility.

I have already created batch programs to modify camera settings for daytime and nighttime. The problem is getting them to execute at dawn and dusk. I currently us Windows Task Scheduler to trigger the programs, but this requires manually adjusting the scheduled times as the days get shorter and longer with the seasons.
 

pepperfr

Getting the hang of it
Joined
Feb 8, 2015
Messages
96
Reaction score
36
Location
Ohio
MCX. This works perfectly! Its a little convoluted, but it is the best solution I have found for modifying my camera settings at dusk and dawn.
 

pepperfr

Getting the hang of it
Joined
Feb 8, 2015
Messages
96
Reaction score
36
Location
Ohio
I created a 5 step procedure for automating modification of Hikvision camera image settings for dawn and dusk using Blue Iris. I know this procedure is described elsewhere, but I wanted to provide a procedure with specific examples of the necessary configuration.

Note 1: This procedure requires the cURL command line tool and assumes you have a copy of curl.exe saved at C:\Windows\System32.
Note 2: This procedure assumes an up to date version of BI 4.

STEP 1 Hikvision Camera Image Settings XML Extract

•It will be necessary to extract the camera’s image settings in XML format. To get the XML image settings extract from your Hikvision camera, use Google Chrome and enter the following in the address bar:
Code:
http://UserName:Password@CamIPAddress:PortNumber/Image/channels/1
•When you press ENTER, a page similar to the one below will be generated. Select all of the text and copy it for use in the next step.

Picture1.png

STEP 2 Create .xml File Using Notepad

•Start Notepad and paste the contents from the previous step into the new Notepad document.
•Select SAVE AS and save to a folder you have created for your scripts (e.g. C:\CameraScripts)
•In the Save as type field, select All files (*.*)
•In the File name field, enter a file name with the .xml extension (e.g. ImageDayCam1.xml) and press OK.
•Your Notepad document will look similar to the one below.
•You will need to create separate XML files for each of your cameras. For each camera create an XML file for daytime and nighttime image settings.

Picture2.png

STEP 3 Create Batch Files Using Notepad

•Start Notepad and enter batch scripts similar to those shown below.
•Select SAVE AS and save to C:\CameraScripts
•In the Save as type field, select All files (*.*)
•In the File name field, enter a file name with the .bat extension (e.g. ImageDay.bat) and press OK.
•You will need to create a batch file for daytime and a batch file for nighttime.

Example Batch Script for Daytime Settings
Code:
curl -T ImageDayCam1.xml http://UserName:Password@Cam1IPAddress:PortNumber/Image/channels/1
curl -T ImageDayCam2.xml http://UserName:Password@Cam2IPAddress:PortNumber/Image/channels/1
curl -T ImageDayCam3.xml http://UserName:Password@Cam3IPAddress:PortNumber/Image/channels/1
exit
Example Batch Script for Nighttime Settings
Code:
curl -T ImageNightCam1.xml http://UserName:Password@Cam1IPAddress:PortNumber/Image/channels/1
curl -T ImageNightCam2.xml http://UserName:Password@Cam2IPAddress:PortNumber/Image/channels/1
curl -T ImageNightCam3.xml http://UserName:Password@Cam3IPAddress:PortNumber/Image/channels/1
exit
STEP 4 Configuring Blue Iris Camera PTZ/Control presets

•In Blue Iris, go to camera properties on the camera of your choice (it doesn't matter which camera). Select the PTZ/Control tab and click on the Edit presets…button.

Picture3.png

•Configure the first preset to run the daytime batch file as shown in the image below.


Picture4.png

•Configure the second preset to run the nighttime batch file as shown in the image below.


Picture5.png

STEP 5 Configuring Blue Iris Camera Event Schedule

•In Blue Iris, go to camera properties (on the same camera you chose in the previous step). Select the Schedule tab and click on the Event schedule…button.


Picture6.png

•In the Event schedule window, you need to create two PTZ Preset events – one for sunrise and one for sunset. The image below shows the Event schedule as it looks after the two events have been configured. The images on the right show how each PTZ Preset event is configured.

Picture7.png
 
Last edited by a moderator:

aster1x

Getting the hang of it
Joined
Jul 8, 2014
Messages
400
Reaction score
87
Do you know where in the file system of HIK cameras the operating mode (day or night) may be signified? If we can identify this then we may be able to write a script to execute the different xmls defining the image parameters per mode (day or night).
 

pepperfr

Getting the hang of it
Joined
Feb 8, 2015
Messages
96
Reaction score
36
Location
Ohio
aster1x, the operating mode (day or night) is part of the image settings. See the IrcutFilter section of the xml extract below. The operating day/night mode is referred to as "IrcutFilterType." The choices are Day, Night, Auto, and Scheduled-Switch.

<IrcutFilter xmlns="http://www.hikvision.com/ver10/XMLSchema" version="1.0">
<IrcutFilterType>day</IrcutFilterType>
<IrcutFilterLevel>normal</IrcutFilterLevel>
<IrcutFilterTime>30</IrcutFilterTime>
</IrcutFilter>
 

aster1x

Getting the hang of it
Joined
Jul 8, 2014
Messages
400
Reaction score
87
I understand and agree with you. You misunderstood me. The execution of the two different .bat files (containing the xml settings) is triggered from the BI according to a specific time plan. It is not triggered according to the setting of the ambient light sensor in the camera. I am asking where the setting of the ambient light sensor in the camera is stored. If we know it, then we can trigger the different bat (of the image settings) trough a script running in the camera and not externally at the BI.

Please correct me if my idea above is wrong.
 

pepperfr

Getting the hang of it
Joined
Feb 8, 2015
Messages
96
Reaction score
36
Location
Ohio
I understand and agree with you. You misunderstood me. The execution of the two different .bat files (containing the xml settings) is triggered from the BI according to a specific time plan. It is not triggered according to the setting of the ambient light sensor in the camera. I am asking where the setting of the ambient light sensor in the camera is stored. If we know it, then we can trigger the different bat (of the image settings) trough a script running in the camera and not externally at the BI.

Please correct me if my idea above is wrong.
Now I get it. Your idea would result in a more robust solution because it would trigger camera settings by actual light level instead of time. (Light levels at dusk and dawn vary considerably depending on atmospheric conditions.) The problem is that I don't know where the ambient light sensor setting is or how it could be accessed.

Actually, I think that what we are forced to do externally with batch scripts, should be standard functionality within the camera settings.
 

truglo

Pulling my weight
Joined
Jun 28, 2017
Messages
275
Reaction score
103
Yeah I haven't found any 'get brightness output' in the Dahua API either. Although, it would be possible to do lum based exposure mode switching using DIO (ex: 'duino w/ lum sensor). I actually happen to have an esp device with a nice lum sensor I could use if I end up experiencing problems with clouds.

Although, that certainly wouldn't be as nice as doing it on the camera. It wouldn't be so bad though, if BI had more than 4 DIO's, or if it supported a decent protocol like uart or i2c. If it handled uart for example, you could put a lum sensor near every camera, and not worry about using io for alarm stuff.
 
Joined
Aug 5, 2016
Messages
6
Reaction score
0
Location
Central Maine
Has anyone ran into a "405 Access Error" see below? I have been able to set up everything according to the instructions but can't seem to get the .xml data from the cams. I have two Nelly's bullets (one 4mp and one 4k) running the current firmware updates. I am hoping it is just some silly mistake I am making or a camera security setting I have incorrect. Any help would be appreciated!

Access Error: 405 -- Method Not Allowed
Requested method GET not supported for URL: /Image/channels/1
 

pepperfr

Getting the hang of it
Joined
Feb 8, 2015
Messages
96
Reaction score
36
Location
Ohio
Has anyone ran into a "405 Access Error" see below? I have been able to set up everything according to the instructions but can't seem to get the .xml data from the cams. I have two Nelly's bullets (one 4mp and one 4k) running the current firmware updates. I am hoping it is just some silly mistake I am making or a camera security setting I have incorrect. Any help would be appreciated!

Access Error: 405 -- Method Not Allowed
Requested method GET not supported for URL: /Image/channels/1
I'm not sure why you're getting this error. Make sure you are using Internet Explorer as your browser (not Microsoft Edge or Chrome, etc.). Make sure you are including the proper UserName, Password, CamIPAddress, and PortNumber in your url. (http://UserName:Password@CamIPAddress:PortNumber/Image/channels/1). I suppose it is possible the firmware on your cameras is not compatible with this method.
 
Top