HTTP API Codes for SD49225XA-HNR 2MP/SD49425 PTZ

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
25,010
Reaction score
48,771
Location
USA
Has anyone had any luck using the API codes to go from day or night with the SD49225/SD49425 PTZ?

The day/night utility someone wrote here doesn't seem to work for this PTZ and I have tried various versions I have seen others use on other Dahua cams but no luck:

/cgi-bin/configManager.cgi?action=setConfig&VideoInDayNight[0][0].Mode=BlackWhite

/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=2

/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1

/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=3

/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SwitchMode=3

/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SwitchMode=2

/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SwitchMode=3


I am also wondering if the username: password@IPADDRESS configuration is also the culprit because when I try that, I get a Windows cannot find error. I even tried the anonymous login checkbox, but no dice.
 

ljw2k

Known around here
Joined
Jun 9, 2014
Messages
1,489
Reaction score
2,264
Location
United Kingdom
My SD49225-XA-HNR works ok on a Schedule under Profile Management it changes from Day to Night as below at these times.

2020-07-15 03_07_27-Setting - Internet Explorer.jpg
 

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
25,010
Reaction score
48,771
Location
USA
Yeah, I have mine there, but I like more customization LOL. I would like to force color until about 1:30am or so and then zoom in closer to a pinch point and go to B/W for a sharper image. The Profile management will not give you that option to force B/W or even night profile from 2am to 6am.
 

chaosengine

Getting the hang of it
Joined
Dec 11, 2017
Messages
131
Reaction score
71
Location
Germany
Use curl and start with "getConfig" on command line, change settings in webgui and see what have changed using "getConfig" again.

Code:
curl --digest "http://admin:yourpassword@x.x.x.x/cgi-bin/configManager.cgi?action=getConfig&name=VideoInMode"
Typically returns:

Full time Day:
table.VideoInMode[0].Config[0]=0
table.VideoInMode[0].Mode=0

Full Time Night:
table.VideoInMode[0].Config[0]=1
table.VideoInMode[0].Mode=0

General:
table.VideoInMode[0].Config[0]=2
table.VideoInMode[0].Mode=0

Schedule:
table.VideoInMode[0].Config[0]=0
table.VideoInMode[0].Config[1]=1
table.VideoInMode[0].Mode=1
table.VideoInMode[0].TimeSection[0][0]=1 04:40:00-18:12:00

Set Full Time Night:
Code:
curl --digest "http://admin:yourpassword@x.x.x.x/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1"
 

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
25,010
Reaction score
48,771
Location
USA
@chaosengine

I did the get config and got a lot similar to what you show.

I then try to run the set curl (curl --digest "") and get this error message:

(3) [globbing] bad range in column 100

When I count this out, I am assuming this is the setConfig line, yet everything looks right?


Here is what it returned when I ran the get curl:

curl --digest ""

table.VideoInMode[0].Config[0]=1

table.VideoInMode[0].Mode=0

table.VideoInMode[0].TimeSection[0][0]=1 06:00:00-21:00:00

table.VideoInMode[0].TimeSection[0][1]=0 00:00:00-23:59:59

table.VideoInMode[0].TimeSection[0][2]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[0][3]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[0][4]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[0][5]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[1][0]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[1][1]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[1][2]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[1][3]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[1][4]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[1][5]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[2][0]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[2][1]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[2][2]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[2][3]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[2][4]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[2][5]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[3][0]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[3][1]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[3][2]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[3][3]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[3][4]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[3][5]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[4][0]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[4][1]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[4][2]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[4][3]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[4][4]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[4][5]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[5][0]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[5][1]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[5][2]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[5][3]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[5][4]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[5][5]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[6][0]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[6][1]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[6][2]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[6][3]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[6][4]=0 00:00:00-24:00:00

table.VideoInMode[0].TimeSection[6][5]=0 00:00:00-24:00:00
 

chaosengine

Getting the hang of it
Joined
Dec 11, 2017
Messages
131
Reaction score
71
Location
Germany
ah, Windows curl does not like [] , try:

Code:
curl --digest --globoff "http://admin:yourpassword@x.x.x.x/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1"
 

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
25,010
Reaction score
48,771
Location
USA
Strange, so it seems to accept it, but it doesn't say it did anything and it immediately goes to the c: prompt to accept another demand, and the camera didn't change?
 

chaosengine

Getting the hang of it
Joined
Dec 11, 2017
Messages
131
Reaction score
71
Location
Germany
Normally you'll get back an "OK" after setconfig and camera changes immediately to night profile.
 

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
25,010
Reaction score
48,771
Location
USA
Ok figured it out - for some reason one of the - disappeared. Surprised it didn't give me an error. Added the - and now it works!

Thanks!!!
 
Last edited:

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
25,010
Reaction score
48,771
Location
USA
Hey you got me further along than I made it, so that helps a lot!
 

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
25,010
Reaction score
48,771
Location
USA
@chaosengine

Any idea what the API is for lens initialization?

I ran the get command (/cgi-bin/devVideoInput.cgi?action=getCaps&channel=1) and got the following but nothing stands out to me as to which one it is? Or maybe a different get command?

caps.AutoSyncPhase=false
caps.AutofocusPeak=false
caps.Backlight=2
caps.BrightnessCompensation=true
caps.ChipID=0
caps.CoverCount=3
caps.CoverType=1
caps.CustomManualExposure=true
caps.DayNightColor=true
caps.DayNightColorIO=false
caps.Defog=true
caps.DoubleExposure=0
caps.DownScaling=false
caps.EEModeRange=100
caps.ElectricFocus=false
caps.Exposure=14
caps.ExposureMode=31
caps.ExternalSyncInput=0
caps.FishEye=false
caps.FlashAdjust=false
caps.Flip=true
caps.FormatCount=5
caps.Gain=true
caps.GainAuto=true
caps.Gamma=true
caps.GammaModeRange=100
caps.GlareInhibition=1
caps.HorizontalBinning=0
caps.IRCUT=true
caps.ImageStabilization=true
caps.InfraRed=true
caps.Iris=true
caps.IrisAuto=true
caps.LadenBitrate=1728000
caps.LimitedAutoExposure=true
caps.MaxExposureTime=300
caps.MaxExposureTime1=0
caps.MaxHeight=1440
caps.MaxMultiProfile=3
caps.MaxWidth=2560
caps.MeteringRegionCount=0
caps.MinExposureTime=1
caps.MinExposureTime1=0
caps.Mirror=true
caps.MultiOptions=false
caps.NightOptions=true
caps.OrgResHeight=1440
caps.OrgResWidth=2560
caps.ReferenceLevel=false
caps.Rotate90=false
caps.SetColor=true
caps.SignalFormats=Inside
caps.SmartIRExposure=false
caps.SnapshotExposure=false
caps.SubChannel=0
caps.SupportProfile=true
caps.SupportWhiteLevel=false
caps.SyncChipChannels=false
caps.SyncFocus=false
caps.TitleCount=2
caps.TotalSensorNum=0
caps.TridimDenoise=1
caps.TridimDenoiseDetails=1
caps.UTC=0
caps.UpScaling=false
caps.Version=0
caps.VerticalBinning=0
caps.WhiteBalance=3
caps.WideDynamicRange=2
 

chaosengine

Getting the hang of it
Joined
Dec 11, 2017
Messages
131
Reaction score
71
Location
Germany
What is meant by "lens initialization"? All zoom or focus options seem to be linked to ptz control: /cgi-bin/ptz.cgi?action=getCurrentProtocolCaps&channel=0
 

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
25,010
Reaction score
48,771
Location
USA
@chaosengine - Lens Initialization readjusts the lens to help with focus issues. It seems like this PTZ gets "caught" and this features exercises the lens from near focus to far focus and then settles on the proper focus. So I would like to run an API to do this when it changes from day to night.

1595642930994.png
 
Top