Dahua day/night switch utility - DahuaSunriseSunset

Discussion in 'Dahua' started by bp2008, Mar 29, 2017.

Share This Page

  1. bp2008

    bp2008 Staff Member

    Joined:
    Mar 10, 2014
    Messages:
    7,852
    Likes Received:
    4,568
    Well in my experience the autoFocus command worked reliably with only one request.

    The adjustFocus command is the unreliable one. This command requires both zoom and focus values. I settled on repeating it 5 times, waiting one second between each request. The 5th repeat may optionally be replaced by an autoFocus command.

    So, these are the 4 possible courses of action which the DahuaSunriseSunset app may take for handling zoom and focus:

    A) 1x autoFocus command
    B) 5x adjustFocus commands, 1 second sleep between
    C) 4x adjustFocus commands followed by 1x autoFocus command, 1 second sleep between
    D) Do nothing.

    Different numbers of repeats may work too. Those are just what I determined to be reliable for the camera models I tested against.
     
  2. jaydeel

    jaydeel Getting the hang of it

    Joined:
    Nov 9, 2016
    Messages:
    85
    Likes Received:
    56
    Location:
    SF Bay Area
    Perfect. I'll give these starting points a try with my Dahua api cameras:
    (2) IPC-HDW5231R-ZE
    (2) IPC-HDW2231R-ZS
     
    Last edited: Feb 6, 2019
  3. hamsoplo

    hamsoplo Getting the hang of it

    Joined:
    Jun 8, 2014
    Messages:
    136
    Likes Received:
    37
    Is it possible to make this program continuously send zoom/focus commands every minute or so for cameras that lose focus by themselves?
     
  4. jaydeel

    jaydeel Getting the hang of it

    Joined:
    Nov 9, 2016
    Messages:
    85
    Likes Received:
    56
    Location:
    SF Bay Area
    I've completed my testing and have settled on course 'B'. I had to experiment with the sleep duration and settled on 4 seconds. Anything less resulted in at least one of four out-of-focus cameras.

    In case this helps anyone else, here's a few details about my approach...

    1. To reduce the script run time, I settled on using master sleep duration. In a loop, I execute 1 adjustFocus command for each camera, then the sleep command, then repeat 4 more times. (I used the same Day Zoom, Day Focus, Night Zoom, Night Focus values that I configured into the DahauSunriseSunset tool.)

    2. I added a commandline argument to optionally send the following 'zero-zero' command BEFORE executing method B. It proved handy in development when I was experimenting with shorter sleep durations (<3 seconds). These frequently left one or more of my cameras 'locked in' with a blurry image. When things were totally messed-up, starting at 'zero-zero' then executing method 'B' so far has worked every time.

    Thanks again bp2008!
     
    Last edited: Feb 7, 2019
    aristobrat likes this.
  5. BHj

    BHj n3wb

    Joined:
    Jan 27, 2019
    Messages:
    2
    Likes Received:
    1
    Location:
    Finland
    Hi guys.

    I have a Dahua DH-SD49225T-HN. I wanted to get better control over the IR leds, and did not really like having to mess around with the day and night mode. I am not sure if this will help you, but I experimented a bit and found the following things to work for my purpose. These are not documented in any doc I have seen, so thought I'd post here;

    Set the IR leds to OFF
    /cgi-bin/configManager.cgi?action=setConfig&Lighting[0][0].Mode=Off

    For the IR leds to be on, the camera has to be in B/W mode. This can be forced with
    /cgi-bin/configManager.cgi?action=setConfig&VideoInDayNight[0][0].Mode=BlackWhite

    ..then the leds can be manually controlled with
    /cgi-bin/configManager.cgi?action=setConfig&Lighting[0][0].Mode=Manual&Lighting[0][0].FarLight[0].Light=50&Lighting[0][0].NearLight[0].Light=50

    The SD49555 tas 6 IR leds, where nearlight (2leds) and farlight (4 leds) can be controlled separately. It seems that it might not be a good idea to use more than 100 in total.

    IR has 2 auto modes
    /cgi-bin/configManager.cgi?action=setConfig&Lighting[0][0].Mode=Auto
    and
    /cgi-bin/configManager.cgi?action=setConfig&Lighting[0][0].Mode=ZoomPrio

    Color mode back to Auto goes by
    /cgi-bin/configManager.cgi?action=setConfig&VideoInDayNight[0][0].Mode=Brightness

    May sometimes make sense to force to color via
    /cgi-bin/configManager.cgi?action=setConfig&VideoInDayNight[0][0].Mode=Color
     
    Last edited: Feb 10, 2019 at 2:10 PM
    aristobrat likes this.