HTTP API code for Day/Night Shedule

Raczey

n3wb
Joined
Apr 6, 2020
Messages
9
Reaction score
1
Location
Poland
Hey,

does anybody know why I cannot switch camera to day/night shedule mode?

I get this response when set manually:

curl --digest -g ""
table.VideoInMode[0].Config[0]=2
table.VideoInMode[0].Config[1]=2
table.VideoInMode[0].Mode=1
table.VideoInMode[0].TimeSection[0][0]=1 07:30:00-15:50:00
table.VideoInMode[0].TimeSection[0][1]=0 00:00:00-24:00:00
...

But if I pull these commands, I get Error response:

curl --digest -g ""
Error
Bad Request!

curl --digest -g ""
Error
Bad Request!

Camera = IPC HFW2431T-AS-S2

Kind regads,
Tom
 

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
25,528
Reaction score
49,793
Location
USA
It unfortunately is trial and error. You may need a user/password at the front before it will run a command to change the setting.

Just use this utility created and save yourself the frustration:

 

Raczey

n3wb
Joined
Apr 6, 2020
Messages
9
Reaction score
1
Location
Poland
Hey,

I'm using user/pass :) Just didn't want to paste it here. Problem is with API I think. Because when it's set to shedule mode manually, I also can not change it back to Normal or Night or Day via HTTP (I get OK response, but it doesn't really change camera mode).

Any ideas?
 

jack7

Getting comfortable
Joined
Mar 21, 2019
Messages
323
Reaction score
250
Location
USA
See if this post helps in any way.
To switch to Dahua Day or Night Profile settings automatically when the camera auto-detects the change between day and night light conditions, try this.

In newer firmware that does not require a plug-in, use Web UI to set Profile Management to Day/Night.
For older firmware requiring a plug-in, the following command should do the same thing.
If you ever change any profile settings with the Web UI, that will disable it and you have to use the URL again.
 

Alaska Country

Getting comfortable
Joined
Jun 10, 2021
Messages
463
Reaction score
681
Location
Alaska
See if the following will work for your day/night switch application. See last post #14.

 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,703
Reaction score
14,089
Location
USA
This is how I do it...

Code:
Day Mode:
http://user:pass@address/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=0

Night Mode:
http://user:pass@address/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1
Try using the URLs in a browser before copying to your CURL command, just to be sure you got them right.
 

Raczey

n3wb
Joined
Apr 6, 2020
Messages
9
Reaction score
1
Location
Poland
Oh Dear! Thanks a lot. I will try your suggestions on the weekend and I will give you my feedback.

Cheers!
Tom
 

Raczey

n3wb
Joined
Apr 6, 2020
Messages
9
Reaction score
1
Location
Poland
See if this post helps in any way.
Thank you, this is exactly what I wanted to do.

Finally these commands works:

For change to shedule mode:
192.168.1.108/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SwitchMode=2

For set the shedule:
192.168.1.108/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SunriseHour=7&VideoInOptions[0].NightOptions.SunriseMinute=0&VideoInOptions[0].NightOptions.SunriseSecond=0&VideoInOptions[0].NightOptions.SunsetHour=16&VideoInOptions[0].NightOptions.SunsetMinute=0&VideoInOptions[0].NightOptions.SunsetSecond=0

Thanks a lot!
Tom
 

Alaska Country

Getting comfortable
Joined
Jun 10, 2021
Messages
463
Reaction score
681
Location
Alaska
Tom:

Thanks so much for sharing. Tried something similar and the times went into the camera (i.e. checked with a GET statement) but would not trigger the event. Will give your solution a try and see.

The 5849 Dahua bullet does not have a day/night switch. Only a schedule that is done by the month. Have since used the following:

Color to B/W - Driveway
Code:
http://192.168.1.108/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[2].NightOptions.SwitchMode=3&
VideoInOptions[2].NightOptions.DayNightColor=2
B/W to Color - Driveway
Code:
http://192.168.1.108/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[2].NightOptions.SwitchMode=0&
VideoInOptions[2].NightOptions.DayNightColor=0
This sets the camera to either 'Full Time Day' or 'Full Time Night'.

This week changed the night settings to color but still with the 'Full Time Night' picture and exposure settings as the day settings are not close enough for a proper image.

The cameras are updated by using a Hubitat home automation system that allows for HTTP GET calls. So far it has not missed any day to night or night to day switches.
 
Last edited:

Raczey

n3wb
Joined
Apr 6, 2020
Messages
9
Reaction score
1
Location
Poland
The 5849 Dahua bullet does not have a day/night switch. Only a schedule that is done by the month. Have since used the following:
I suppose that this camera has a steady IR-cut filter and you can't turn it off. If there is no option in camera software (via www) to switch it into the night mode (with b&w video), you will not be able to do it via HTTP commands also.
Easiest way to check if you switched into night mode is to check if camera can see IR leds from any remote control (ie. from your TV) :)

Cheers!
Tom
 

Raczey

n3wb
Joined
Apr 6, 2020
Messages
9
Reaction score
1
Location
Poland
The 5849 Dahua bullet does not have a day/night switch. Only a schedule that is done by the month. Have since used the following:
I checked in datasheet, possibly it has a day/night option.

Try this commands:

.../cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=0 # switch to DAY mode
.../cgi-bin/configManager.cgi?action=setConfig&VideoInDayNight[0][0].Mode=Color


and then:

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

If you will see B&W picture, it should be a Night mode with IR-cut filter off.

Tom.
 

Alaska Country

Getting comfortable
Joined
Jun 10, 2021
Messages
463
Reaction score
681
Location
Alaska
Tom:

Appreciate the update.

Have been using

...VideoInOptions[2].NightOptions.SwitchMode=3&VideoInOptions[2].NightOptions.DayNightColor=2

and

...VideoInOptions[2].NightOptions.SwitchMode=0&VideoInOptions[2].NightOptions.DayNightColor=0

for 'full time day' and 'full time night' operations for the past 4 months and it is working 100% with the Dahua 5849 bullet camera.


profile.PNG


Also like your approach in setting times by using the schedule which is a nice alternative method to also achieve day/night switching. Are you manually changing the schedule times or using a program to generate local sunset/sunrise times and then automatically inserting these into your HTTP call?

Overall we are both successful in changing day/night camera operations by using two different approaches.

As a correction, the 5849 (IPC-Color4K-X) has one timeline for entering sunrise and sunset times. i.e. the LPR (7442) camera has one timeline per month for the same function. Both inadequate for camera operations in the far northern or southern latitudes.

The 5849 is a color and b/w camera. It does not have IR. It does have LED illumination for added light, but these are a white light not IR. The camera produces a very nice night b/w image. Like it much better than an IR b/w image IMO.

The camera does not have a day/night switch based on ambient lighting conditions. Requests have been made to Dahua to add back the day/night switch when new FW is released.
 
Top