Dahua IPC-Color4K-T has anyone figure out API to operate the LED?

camviewer43

Getting the hang of it
Joined
Mar 14, 2020
Messages
177
Reaction score
50
Location
US
I came across the API for changing night/day mode remotely, but I was wondering if anyone has figured out the API to turn on/off the warm-white LED?

The night/day mode API looks something like this:
This seems to be the best solution for now:

Until I figure it out, I use the day profile 24/7 and then setup the night profile with LED on and call the night profile on trigger and then go back to day profile. Not perfect but it works.
 
Last edited:

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
25,945
Reaction score
50,679
Location
USA
Nope. I have been trying and others have asked about that in the master thread to no avail as well.

 

TonyR

IPCT Contributor
Joined
Jul 15, 2014
Messages
17,815
Reaction score
41,568
Location
Alabama
Try this from @runraid , found here.


Turn light (illuminator)
ON:

OFF:

Where [0][1] is [ChannelNo][ConfigNo]
ChannelNo: integer, array index starts from 0, which means video channel (equals to video channel index -1, and so 0 means channel 1).
ConfigNo: array index, can be 0, 1 or 2. 0 means config for day, 1 means config for night, and 2 means config for normal scene.
 

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
25,945
Reaction score
50,679
Location
USA
^that didn't work for me because that is a deterrence camera that is designed to have the white LED come on or off with triggers whereas the 4K/T is designed to have the white LED either on or off. My best guess is the LED appears to be tied to a profile and not as a stand-alone feature. Maybe a firmware update could change this (I haven't tried it on the newest firmware yet).

Until I figure it out, I use the day profile 24/7 and then setup the night profile with LED on and call the night profile on trigger and then go back to day profile. Not perfect but it works.
 
Last edited:

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
25,945
Reaction score
50,679
Location
USA
BTW the same question was raised with the 4K/X and it was never figured out with that one either and that is on the older firmware GUI that follows the API protocol manual (unlike the newer GUI), lending to the belief that they intentionally tied the LED to a profile as this camera is designed to be a performance camera and the white LED coming on and off could impact the exposure, whereas the deterrence camera referenced above in Post #3 can have the LED come on or off based on triggers as that is the intent of a deterrence camera.
 

TonyR

IPCT Contributor
Joined
Jul 15, 2014
Messages
17,815
Reaction score
41,568
Location
Alabama
BTW the same question was raised with the 4K/X and it was never figured out with that one either and that is on the older firmware GUI that follows the API protocol manual (unlike the newer GUI), lending to the belief that they intentionally tied the LED to a profile as this camera is designed to be a performance camera and the white LED coming on and off could impact the exposure, whereas the deterrence camera referenced above in Post #3 can have the LED come on or off based on triggers as that is the intent of a deterrence camera.
Makes sense.
Glad you clarified the use of that particular API command as I haven't had the time to unpack my IPC-Color4K-T yet and try it out...this time of year the "Honey Do" list is even longer than usual.
 

wittaj

IPCT Contributor
Joined
Apr 28, 2019
Messages
25,945
Reaction score
50,679
Location
USA
FWIW - Hikvision has had their equivalent 1/1.2" sensor camera out before Dahua and they have intentionally added or deleted the ability to have its white LED come on/off based on a trigger with firmware updates, probably based on complaints of exposure when the LED would kick on.

IIRC the Hikvision latest firmware eliminated the ability to turn the white LED on/off by trigger/API.
 

camviewer43

Getting the hang of it
Joined
Mar 14, 2020
Messages
177
Reaction score
50
Location
US
Until I figure it out, I use the day profile 24/7 and then setup the night profile with LED on and call the night profile on trigger and then go back to day profile. Not perfect but it works.
Ok, that makes sense. Yeah, not perfect, but ok for now.
 

cam26

Getting the hang of it
Joined
Jan 21, 2019
Messages
233
Reaction score
99
Location
USA
These API calls- do you just enter them into a web browser in the URL space?
 

Thanamite

Young grasshopper
Joined
Jan 7, 2022
Messages
45
Reaction score
17
Location
New York
You can use an executable command like curl to submit the http calls. I got curl as part of the cygwin package.
 

Paiberfunk

Young grasshopper
Joined
Jul 14, 2024
Messages
34
Reaction score
10
Location
Boston
How does one do the day/night profile switch on trigger ? Do you have to make an API call for that, or can it all be done within the camera @wittaj ?
 

Alaska Country

Getting comfortable
Joined
Jun 10, 2021
Messages
485
Reaction score
705
Location
Alaska
If it is a Web 4 camera there is an day/night switch utility that works well with BI. If a Web 5 camera then many use the built in day/night switch that is set in the camera GUI to switch day/night modes based on available light.

Another option is to use an API HTTP GET statement to switch the camera. In that case the Web 5 camera is set to "customized scene". These are threads on this site detailing specific setup procedures.
 

Paiberfunk

Young grasshopper
Joined
Jul 14, 2024
Messages
34
Reaction score
10
Location
Boston
If it is a Web 4 camera there is an day/night switch utility that works well with BI. If a Web 5 camera then many use the built in day/night switch that is set in the camera GUI to switch day/night modes based on available light.

Another option is to use an API HTTP GET statement to switch the camera. In that case the Web 5 camera is set to "customized scene". These are threads on this site detailing specific setup procedures.
It’s a modern one , the t180 , so I think that makes it web 5.0 from what I gather .

I certainly know there’s the “auto” brightness setting and also about the day/night modes … but setting day /night modes based on time of day is not ideal considering nighttime starts at very different times at difference seasons of year, and there’s no “sundown” option or similar :/

I was looking to know how to do the HTTP GET methods so I could do something like tell it to do an API call… but then you gotta have an annoying docker container or raspi or whatever running just for that purpose (eg it feels like it should be something you can trigger optionally ). I wonder if this is something @EMPIRETECANDY would consider feeding back to Dahua as a firmware improvement ?
 

Alaska Country

Getting comfortable
Joined
Jun 10, 2021
Messages
485
Reaction score
705
Location
Alaska
Yes, also found that using a monthly time based system is not very good when the times shifts almost 6 minutes per day at its peak. To solve that issue, use an API that changes the schedule on a daily basis based on local sunrise and sunset times. This is run in Hubitat as it takes care of the local set/rise times as a SEND GET HTTP statement.

One could try power shell plus an app to generate local sunrise/set times, etc.

Andy, most likely is aware of this issue and Dahua has no interest in changing as the folks here are not the market Dahua is interested in.
 

Paiberfunk

Young grasshopper
Joined
Jul 14, 2024
Messages
34
Reaction score
10
Location
Boston
Yes, also found that using a monthly time based system is not very good when the times shifts almost 6 minutes per day at its peak. To solve that issue, use an API that changes the schedule on a daily basis based on local sunrise and sunset times. This is run in Hubitat as it takes care of the local set/rise times as a SEND GET HTTP statement.

One could try power shell plus an app to generate local sunrise/set times, etc.

Andy, most likely is aware of this issue and Dahua has no interest in changing as the folks here are not the market Dahua is interested in.
Have you managed to figure out how to get digest authentication to work via Hubitat? , I can’t seem to get basic authentication turned on on this particular camera for some reason
 

Alaska Country

Getting comfortable
Joined
Jun 10, 2021
Messages
485
Reaction score
705
Location
Alaska
If you are referring to the camera user/password, then that is placed in the URL for authorization purposes.

Also, for sunrise/set use a LUX sensor through Hubitat in place of local rise/set times. Both work but LUX takes care of the cloudy days.

The Hubitat apps get a little long with 27 GET statements and it will throw errors. By adding a delay every ten cameras or so that resolves the issue.
 

Paiberfunk

Young grasshopper
Joined
Jul 14, 2024
Messages
34
Reaction score
10
Location
Boston
If you are referring to the camera user/password, then that is placed in the URL for authorization purposes.

Also, for sunrise/set use a LUX sensor through Hubitat in place of local rise/set times. Both work but LUX takes care of the cloudy days.

The Hubitat apps get a little long with 27 GET statements and it will throw errors. By adding a delay every ten cameras or so that resolves the issue.
So you just use basic auth ? What you were describing is basic auth for the API, as far as I know .. I’m just not sure how to turn it on via the web 5 interface for API calls… or, maybe habitat handles all of that transparently, but the API testing cool I’m using certainly doesn’t, and results in a authorization error
 

Alaska Country

Getting comfortable
Joined
Jun 10, 2021
Messages
485
Reaction score
705
Location
Alaska
An example for Web 4 cameras for switching day/night modes that is run by Hubitat. Also can be checked by using a web browser. Using FireFox on this end for checking. If it runs, the result will display an OK. If not, an error message.

Sunrise
Code:
http://admin:password@192.168.55.30/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions.NightOptions.SwitchMode=0
Sunset
Code:
http://admin:password@192.168.55.30/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions.NightOptions.SwitchMode=3
These are then used in Hubitat to change modes. Note: This will NOT work for Web 5 cameras.

In Hubitat..

Rules Machine > Create New Action > HTTP Request > Send HTTP GET > Enter URL to send request to > Paste in URL

Then check the logs to see if it ran or generated any errors. Plus check the camera to see if the action did occur.

Both BI and Hubitat must be on the same network. In my case the Hub is on 192.168.55.xxx so that it can see the cameras on the BI sub net.
 
Last edited:
Top