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

Discussion in 'Dahua' started by beingaware, Jun 13, 2017.

Share This Page

  1. crc2004

    crc2004 Pulling my weight

    Joined:
    Apr 18, 2016
    Messages:
    194
    Likes Received:
    104
    What was the distance, of these shots?
     
  2. crc2004

    crc2004 Pulling my weight

    Joined:
    Apr 18, 2016
    Messages:
    194
    Likes Received:
    104
    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
     
  3. Go3Team

    Go3Team Pulling my weight

    Joined:
    Mar 13, 2017
    Messages:
    147
    Likes Received:
    109
    Location:
    RVA
    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.
     
    crc2004 likes this.
  4. Dseg42

    Dseg42 Getting the hang of it

    Joined:
    Apr 17, 2016
    Messages:
    153
    Likes Received:
    9
    Location:
    Palm City, FL
    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-b...tion=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
     
  5. BPet

    BPet Young grasshopper

    Joined:
    Oct 8, 2017
    Messages:
    39
    Likes Received:
    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.
     
  6. BPet

    BPet Young grasshopper

    Joined:
    Oct 8, 2017
    Messages:
    39
    Likes Received:
    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: Nov 15, 2017
  7. Go3Team

    Go3Team Pulling my weight

    Joined:
    Mar 13, 2017
    Messages:
    147
    Likes Received:
    109
    Location:
    RVA
    The code I posted checks to verify that the focus is correct. If it's not, it adjusts the focus.
     
    Last edited: Nov 15, 2017
  8. BPet

    BPet Young grasshopper

    Joined:
    Oct 8, 2017
    Messages:
    39
    Likes Received:
    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? :)
     
  9. binhsterbinh

    binhsterbinh n3wb

    Joined:
    Jun 1, 2015
    Messages:
    7
    Likes Received:
    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.
     
  10. BPet

    BPet Young grasshopper

    Joined:
    Oct 8, 2017
    Messages:
    39
    Likes Received:
    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"?
     
  11. binhsterbinh

    binhsterbinh n3wb

    Joined:
    Jun 1, 2015
    Messages:
    7
    Likes Received:
    5
    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: Nov 15, 2017
  12. BPet

    BPet Young grasshopper

    Joined:
    Oct 8, 2017
    Messages:
    39
    Likes Received:
    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...tion=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: Nov 16, 2017
  13. Bernie199

    Bernie199 n3wb

    Joined:
    Sep 19, 2017
    Messages:
    20
    Likes Received:
    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.
     
  14. Dseg42

    Dseg42 Getting the hang of it

    Joined:
    Apr 17, 2016
    Messages:
    153
    Likes Received:
    9
    Location:
    Palm City, FL
    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.
     
  15. BPet

    BPet Young grasshopper

    Joined:
    Oct 8, 2017
    Messages:
    39
    Likes Received:
    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:3...tion=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.
     
  16. achalmersman

    achalmersman Getting the hang of it

    Joined:
    Jan 26, 2017
    Messages:
    163
    Likes Received:
    52
    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.
     
  17. Dseg42

    Dseg42 Getting the hang of it

    Joined:
    Apr 17, 2016
    Messages:
    153
    Likes Received:
    9
    Location:
    Palm City, FL
    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.
     
  18. Go3Team

    Go3Team Pulling my weight

    Joined:
    Mar 13, 2017
    Messages:
    147
    Likes Received:
    109
    Location:
    RVA
    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.
     
  19. achalmersman

    achalmersman Getting the hang of it

    Joined:
    Jan 26, 2017
    Messages:
    163
    Likes Received:
    52
    So you can't disable auto focus on these cameras?

    Sent from my VS990 using Tapatalk
     
  20. Dseg42

    Dseg42 Getting the hang of it

    Joined:
    Apr 17, 2016
    Messages:
    153
    Likes Received:
    9
    Location:
    Palm City, FL
    No.