IPC-HFW5231E-Z12E High Zoom Auto Focus Work Around

MachAF

Young grasshopper
Dec 12, 2018
49
23
Washington
I've tested this work around and its been working well for a day. It might need some tweaking, but I wanted to get this info out there ASAP so others could tinker with it.

1. Log into your web interface camera settings---> profile management page and change profile management to Normal. You can still adjust all your day and night settings as required.

2. Run the following command in your browser, this will disable auto focus in normal profile mode. (Thanks @bickford )
3. Using the web interface manually zoom and manually adjust the focus to what you like. For night time adjustment I used reflector in the road to allow me to manually focus.

4. Once you have zoom and focus set in the web interface, go into Dahua Sunrise Sunset app (Thanks @bp2008) and get current zoom/focus numbers. Then enter those numbers into the App and run it as a service.

5. Camera should switch over an use the Dahua Sunrise Sunset app setting and not try and auto focus.

It appears there is an issue with the camera automatically switching to day from night and vis versa, so you need to make sure Dahua Sunrise Sunset app is configured to push its zoom and focus commands after the camera has automatically switched modes. There may be an API command to disable this and and just let Dahua Sunrise Sunset app control the switching.
 
Last edited:
Just stumbled upon this... how has this been working for you? I have an issue with the cameras being out of focus right after switch from Day to Night. And sometimes throughout the night it loses focus and I don't get plates for a few hours until it finds its focus again.
 
I set the camera to either night or day full time in the web interfaces. That stops the camera from switching on its own.
In day profile set for color. In your night profile set for BW.

After that is done you can do the above and the settings stick.
I fire the day night switch scripts for the change from day to night twice. Once before sunset and again well after dark.

There is also a small gotcha firing the same focus/zoom settings twice in a row. That can be worked around by having your script set the zoom & focus. Switch to autofocus and wait a few seconds. Set desired zoom and focus once again. Finally set camera to manual focus mode.
 
I set the camera to either night or day full time in the web interfaces. That stops the camera from switching on its own.
In day profile set for color. In your night profile set for BW.

After that is done you can do the above and the settings stick.
I fire the day night switch scripts for the change from day to night twice. Once before sunset and again well after dark.

There is also a small gotcha firing the same focus/zoom settings twice in a row. That can be worked around by having your script set the zoom & focus. Switch to autofocus and wait a few seconds. Set desired zoom and focus once again. Finally set camera to manual focus mode.
Thanks! Are you using the Sunrise Sunset app to do the switching? Or do you have your own script of some kind? I currently use the sunrise sunset app. Day is color, night is BW.
 
I run PHP scripts on my Indigo Domotics server. That's a home automation program on a Mac, but I'm sure there are equivalents on the Windows side.

I misremembered the sequencing for working around the camera's weird autofocusing that happens with repeated zoom & focus commands my earlier post, but here are snippets from my PHP scripts that work even if called repeatedly.


=========================================================================
#day mode for a Z12 camera

import requests
from requests.auth import HTTPDigestAuth
import time

#street west ========
#day profile
url = 'http://<ip>/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=0'
requests.get(url, auth=HTTPDigestAuth('<username>', '<password>'))
time.sleep(2)

#autofocus mode
url = 'http://<ip>/cgi-bin/configManager.cgi?action=setConfig&VideoInFocus[0][0].Mode=2'
requests.get(url, auth=HTTPDigestAuth('<username>', '<password>'))
time.sleep(2)

#set zoom and focus for day position
url = 'http://<ip>/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.642778&zoom=0.23294509'
requests.get(url, auth=HTTPDigestAuth('<username>', '<password>'))
time.sleep(8)

#force autofocus again because initial focusing post zoom may fail in autofocus mode.
url = 'http://<ip>/cgi-bin/devVideoInput.cgi?action=autoFocus'
requests.get(url, auth=HTTPDigestAuth('<username>', '<password>'))



=========================================================================
#night mode for a Z12 camera

import requests
from requests.auth import HTTPDigestAuth
import time

#street west =====
#night profile
url = 'http://<ip>/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1'
requests.get(url, auth=HTTPDigestAuth('<username>', '<password>'))
time.sleep(1)

#night manual focus mode
url = 'http://<ip>/cgi-bin/configManager.cgi?action=setConfig&VideoInFocus[0][1].Mode=4'
requests.get(url, auth=HTTPDigestAuth('<username>', '<password>'))
time.sleep(2)

#zoom and focus for night position
url = 'http://<ip>/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.8134&zoom=0.5150'
requests.get(url, auth=HTTPDigestAuth('<username>', '<password>'))
time.sleep(5)

#repeat zoom and focus for night position to increase reliability
url = 'http://<ip>/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.8134&zoom=0.5150'
requests.get(url, auth=HTTPDigestAuth('<username>', '<password>'))
time.sleep(1)
 
Exactly what I was looking for! Thanks! I’m running ALPR on a Linux box and know PHP so that’s perfect!


Sent from my iPhone using Tapatalk
 
I've tested this work around and its been working well for a day. It might need some tweaking, but I wanted to get this info out there ASAP so others could tinker with it.

1. Log into your web interface camera settings---> profile management page and change profile management to Normal. You can still adjust all your day and night settings as required.
....

on that profile management tab, I only see, "General", "Full Time", "Schedule", and "Day/Night"

this is on a IPC-T5442T-ZE, with System Version V2.820.15OG001.0.R, Build Date: 2021-05-25