Dahua Starlight Varifocal Bullet Z12 5.3-64mm (IPC-HFW5231E-Z12)

crc2004

Pulling my weight
Joined
Apr 18, 2016
Messages
213
Reaction score
144
I guess this is the IPC-HFW5231E-Z12 thread. Anyways I mounted mine today. I left the settings alone except no IR at night. I have enough light at night from a couple of street lamps in the area. The purpose of this camera is to watch the comings and goings on the street across from my house. It dead ends at a cul-de-sac. I have it set up for license plate numbers during the day and a very few at night if the light is correct. Here are two day time pictures and one night time picture. I am very pleased with the performance of this camera. By the way I have it hooked up to my Hikvision NVR. This is my 5th startlight or low light camera. I have 15 cameras all toll. I am slowly upgrading my cameras.
What was the distance, of these shots?
 

crc2004

Pulling my weight
Joined
Apr 18, 2016
Messages
213
Reaction score
144

Go3Team

Pulling my weight
Joined
Mar 13, 2017
Messages
147
Reaction score
110
Location
RVA
I there a document or post that describes/explains the "status" fields? I've been looking for the definitions but haven't found them yet. thanks
IIRC the focus is controlled by a step motor. That step motor has 644 steps from 0 to 1. The focus is currently @ 0.5 which would be step 322. Same for the zoom numbers.
 

Dseg42

Getting the hang of it
Joined
Apr 17, 2016
Messages
169
Reaction score
14
Location
Palm City, FL
I use a computer running this script:

Code:
<?php
$login = 'user';
$password = 'pass';
$url = 'http://10.0.0.XX/cgi-bin/configManager.cgi?action=getConfig&name=VideoInMode';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, "$login:$password");
$result = curl_exec($ch);
curl_close($ch);
$line = strtok($result, "\n");
$dingo = rtrim($line);
$checkdigit = substr($dingo, -1);
if($checkdigit == 1) {
        $url1 = 'http://10.0.0.XX/cgi-bin/devVideoInput.cgi?action=getFocusStatus';
        $ch1 = curl_init();
        curl_setopt($ch1, CURLOPT_URL,$url1);
        curl_setopt($ch1, CURLOPT_RETURNTRANSFER,1);
        curl_setopt($ch1, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
        curl_setopt($ch1, CURLOPT_USERPWD, "$login:$password");
        $result1 = curl_exec($ch1);
        curl_close($ch1);
        $line1 = strtok($result1, "\n");
        $dingo1 = rtrim($line1);
        $pieces = explode("=",$dingo1);
        //echo "$pieces[1]\n";
        if($pieces[1] != "0.165000") {
                //echo "Adjusting focus!\n";
                exec("curl -s -u user:pass --digest -g \"http://10.0.0.XX/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.165&zoom=1\" > /dev/null");
        } else {
                //echo "Focus ok!\n";
        }
}
?>
Is there an easier way to do this?
I made a batch file with this:

@ECHO OFF
SET BROWSER=chrome.exe
START %BROWSER% -new-tab "http://Login:PW@192.168.x.xxx/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.388889&zoom=0.898502"
taskkill /f /im chrome.exe /t

It would be great if I could get this run in the background in case I'm in chrome...
Not too big on coding though so I would need someone to sesame street it
 

BPet

Young grasshopper
Joined
Oct 8, 2017
Messages
39
Reaction score
7
You can use a program called AutoHotKey and it will run it in the background without popping up a chrome window etc. You would create a file, like a batch file, but it would end in .ahk instead of .bat. The following code will adjust the Focus/Zoom, but you will still have to do something to get it to run at your desired interval.

poststrings =
(Ltrim
http://USER:YOURPASSWORD@IP/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.773333&zoom=0.865225
)
loop, parse, poststrings, `n,`r
{
poststring := A_LoopField
URLDownloadToFile,%poststring%, response.html
}

It also puts any output into an html file, called response.html.
 

BPet

Young grasshopper
Joined
Oct 8, 2017
Messages
39
Reaction score
7
I'm thinking that I'm going to have to reset focus to proper number periodically too. Does anyone know if there is a reason that I should "get" current focus first, compare it to my desired number and then reset the focus as opposed to simply sending the reset focus command without checking? And is it harmful to the Camera to refocus every 5 minutes - 288 time/day - 8,640/month - over 100K/year?
 
Last edited:

Go3Team

Pulling my weight
Joined
Mar 13, 2017
Messages
147
Reaction score
110
Location
RVA
I'm thinking that I'm going to have to reset focus to proper number periodically too. Does anyone know if there is a reason that I should "get" current focus first, compare it to my desired number and then reset the focus as opposed to simply sending the reset focus command without checking? And is it harmful to the Camera to refocus every 5 minutes - 288 time/day - 8,640/month - over 100K/year?
The code I posted checks to verify that the focus is correct. If it's not, it adjusts the focus.
 
Last edited:

BPet

Young grasshopper
Joined
Oct 8, 2017
Messages
39
Reaction score
7
Go3Team, I understand that...but I run windows and so I will have to use different code...and so I'm wondering if it is necessary on my system to do the "check" portion of the process. And is it harmful to the Camera to "set" the focus this many times...or is it any less harmful to use the "Get" command this same number of times first and then only "set" it as needed? Or is it harmful at all? :)
 
Joined
Jun 1, 2015
Messages
7
Reaction score
5
Just use the Adjust Focus command if you already know what your Focus and Zoom setting needs to be.
The Get Focus command is used only if you actually want to physically check to see what the current Focus and Zoom values are.

As far as wearing out the camera over time, I doubt this will be a big issue long term unless you're constantly making drastic zoom and focus parameter changes. If the camera is already in the proper position when the Adjust Focus command is set, there's no movement. If there is Focus change, it'll be very minor anyway.
 

BPet

Young grasshopper
Joined
Oct 8, 2017
Messages
39
Reaction score
7
Thanks! Zoom will definitely be in the correct position, so its just the focus that seems to change...is there something that physically moves in the camera when it 'focuses"?
 
Joined
Jun 1, 2015
Messages
7
Reaction score
5
Thanks! Zoom will definitely be in the correct position, so its just the focus that seems to change...is there something that physically moves in the camera when it 'focuses"?
I would imagine there is a motor inside that macro moves the lens back and forth to get the Focus in check.
For those Windows users that have 24/7 PC or Servers running, you can try setting up a Dummy Switch in Domoticz to have the Camera Focus/Zoom adjusted automatically throughout the day. I created a separate Dummy Switch for Day and one for Night profile. Within each profile, I pasted their corresponding Adjust Focus codes. Then I went into the Timer tab of each profile to check off the schedule I wanted based on Sunset and Sunrise Since Domoticz is set to my Location, I'm taking advantage of the accurate Sunrise/Sunset adjustments for when to switch between profiles. I mentioned it briefly on my post on Page 2. If you need some help with this, I can take snapshots or explain further later.
 
Last edited:

BPet

Young grasshopper
Joined
Oct 8, 2017
Messages
39
Reaction score
7
Figured I would post this in case it is helpful for anyone determining how often they need to refocus.(It turns out that my camera really does not loose focus very often.) You have to have AutoHotKey installed. Place the code in a text file with an .ahk extension. The code will check the current focus, compare it to your desired focus, and write to a log file whether the program needed to change the focus on the camera or if you were already in focus. I plan to run this every hour for a week and then I'll know when I typically loose focus and just run it during those times. You will need to modify the code to include your specific focus and zoom levels, mine are 0.778333 and 0.865225 respectively. You'll also need to enter your own IP and USERNAME and PASSWORD. (I'm not a programmer and so it's probably not the most elegant way to do it, but it works :) The Log file it creates will look like:
Nov-15 11:00PM Focus Unchnaged
Nov-15 11:00PM Focus Unchnaged
Nov-15 11:00PM Focus Reset
Nov-15 11:01PM Focus Unchnaged
Nov-16 05:41AM Focus Unchanged

The AutoHotKey Code:

poststrings =
(Ltrim
http://USERNAME:YOURPASSWORD@YOURIP/cgi-bin/devVideoInput.cgi?action=getFocusStatus
)
loop, parse, poststrings, `n,`r
{
poststring := A_LoopField
URLDownloadToFile,%poststring%, LPR_Focus_Status.txt

}

Sleep, 2000

FormatTime, time, A_now, MMM-d hh:mmtt

FileReadLine, FocusRawData, LPR_Focus_Status.txt, 1
StringTrimLeft, CurrentFocus, FocusRawData, 13

ifEqual, CurrentFocus, 0.778333
{
FileAppend, %Time% Focus Unchanged `n, LPR_Focus_Log.txt
Exitapp
}
else {
poststrings =
(Ltrim
http://USERNAME:YOURPASSWORD@YOURIP/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.778333&zoom=0.865225
)
loop, parse, poststrings, `n,`r
{
poststring := A_LoopField
URLDownloadToFile,%poststring%, LPR_Test_and_Set_Response.txt
FileAppend, %Time% Focus Reset `n, LPR_Focus_Log.txt

}
}
 
Last edited:

Bernie199

n3wb
Joined
Sep 19, 2017
Messages
20
Reaction score
1
My alpr camera is plugged into a poe port in my nvr and only seems to respond to external commands for a while after I have logged into it via the nvr through a browser but I did what Nayr said in another post and schedule to switch to night mode during daylight and find the focus stays fine all night.
 

Dseg42

Getting the hang of it
Joined
Apr 17, 2016
Messages
169
Reaction score
14
Location
Palm City, FL
Figured I would post this in case it is helpful for anyone determining how often they need to refocus.(It turns out that my camera really does not loose focus very often.) You have to have AutoHotKey installed. Place the code in a text file with an .ahk extension. The code will check the current focus, compare it to your desired focus, and write to a log file whether the program needed to change the focus on the camera or if you were already in focus. I plan to run this every hour for a week and then I'll know when I typically loose focus and just run it during those times. You will need to modify the code to include your specific focus and zoom levels, mine are 0.778333 and 0.865225 respectively. You'll also need to enter your own IP and USERNAME and PASSWORD. (I'm not a programmer and so it's probably not the most elegant way to do it, but it works :) The Log file it creates will look like:
Nov-15 11:00PM Focus Unchnaged
Nov-15 11:00PM Focus Unchnaged
Nov-15 11:00PM Focus Reset
Nov-15 11:01PM Focus Unchnaged
Nov-16 05:41AM Focus Unchanged

The AutoHotKey Code:

poststrings =
(Ltrim
http://USERNAME:YOURPASSWORD@YOURIP/cgi-bin/devVideoInput.cgi?action=getFocusStatus
)
loop, parse, poststrings, `n,`r
{
poststring := A_LoopField
URLDownloadToFile,%poststring%, LPR_Focus_Status.txt

}

Sleep, 2000

FormatTime, time, A_now, MMM-d hh:mmtt

FileReadLine, FocusRawData, LPR_Focus_Status.txt, 1
StringTrimLeft, CurrentFocus, FocusRawData, 13

ifEqual, CurrentFocus, 0.778333
{
FileAppend, %Time% Focus Unchanged `n, LPR_Focus_Log.txt
Exitapp
}
else {
poststrings =
(Ltrim
http://USERNAME:YOURPASSWORD@YOURIP/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.778333&zoom=0.865225
)
loop, parse, poststrings, `n,`r
{
poststring := A_LoopField
URLDownloadToFile,%poststring%, LPR_Test_and_Set_Response.txt
FileAppend, %Time% Focus Reset `n, LPR_Focus_Log.txt

}
}
Did everything and adjusted the URL and focus numbers in your code.
But it is not executing the URL when the CurrentFocus does not equal .778333

I do get the three output files LPR_Focus_Log, LPR_Focus_Status, and LPR_Focus_Status.
When the focus is not set, I get the "Focus Reset" and when the focus matches, I do get "Focus Unchanged" - so that works.
LPR_Focus_Status is accurate and working.
LPR_Test_and_Set_Response is blank every time.

I also tested my URL and it does work, it is just not being executed, even though I get the "Focus Reset" in the Focus_Log.
 

BPet

Young grasshopper
Joined
Oct 8, 2017
Messages
39
Reaction score
7
on the IP, do you have your port #? Not sure if that makes a difference if you still have the default port, but I had changed my port and so my line looks like:
http://USER:THEPASS@192.168.1.191:3669/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.778333&zoom=0.865225

If you copy and paste your exact line into your browser it works? Also, the program is very picky about where you put the { brackets...so be sure the line spacing did not change at all in your edit..if its on the wrong line etc., it will not work.
 

achalmersman

Pulling my weight
Joined
Jan 26, 2017
Messages
267
Reaction score
116
Location
Delaware USA
So is this focus issue a known problem or has it just happened to a few cameras? I am interested in purchasing one of these for LPR duty but I have no interest in purchasing a camera that requires scripts to run to keep focus.
 

Dseg42

Getting the hang of it
Joined
Apr 17, 2016
Messages
169
Reaction score
14
Location
Palm City, FL
So is this focus issue a known problem or has it just happened to a few cameras? I am interested in purchasing one of these for LPR duty but I have no interest in purchasing a camera that requires scripts to run to keep focus.
Pretty sure it is all cameras that have auto-focus. Unless you can turn off auto-focus, cameras auto-focus can lose focus in the dark when there is nothing for the camera to actually focus on.
 

Go3Team

Pulling my weight
Joined
Mar 13, 2017
Messages
147
Reaction score
110
Location
RVA
So is this focus issue a known problem or has it just happened to a few cameras? I am interested in purchasing one of these for LPR duty but I have no interest in purchasing a camera that requires scripts to run to keep focus.
It's a problem with ANY camera that has auto focus. With the settings needed at night for LPR, it's just too dark for auto focus to function.
 
Top