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

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.

since I have a web 5 camera … what does one do instead ? Did the API change ?
 
Check out these threads for suggestions.







 
  • Like
Reactions: Paiberfunk
Did the API change ?

Yes, the API changed for Web 5 cameras. Some functions were added, removed and changed.
In looking through the API, there does not appear to be any references to switching modes from day to night and back again like in the Web 4 cameras. Thus the approach of changing the schedule to simulate that function was utilized.

Let us know if you find a solution.
 
Yes, the API changed for Web 5 cameras. Some functions were added, removed and changed.
In looking through the API, there does not appear to be any references to switching modes from day to night and back again like in the Web 4 cameras. Thus the approach of changing the schedule to simulate that function was utilized.

Let us know if you find a solution.

There is already known solution. You will find it in another thread if you search for it.
 
Paiberfunk:

Let's back up and see if you have success with the following URL. It obtains information from the camera and displays it in a browser.

Code:
http://admin:password@192.168.55.62/cgi-bin/configManager.cgi?action=getConfig&name=All

To use change the user, password and camera IP to your settings.

If it functions and displays pages of data, then your are on your way to success with other API calls. If it fails, then you have more work to do to resolve that issue.
 
Paiberfunk:

Let's back up and see if you have success with the following URL. It obtains information from the camera and displays it in a browser.

Code:
http://admin:password@192.168.55.62/cgi-bin/configManager.cgi?action=getConfig&name=All

To use change the user, password and camera IP to your settings.

If it functions and displays pages of data, then your are on your way to success with other API calls. If it fails, then you have more work to do to resolve that issue.


I tried this with HTTPS, and yes, my browser tells me i'm trying to login with admin to the site and then I click OK, and it dumps a huge list of stuff.

I also tried it with postman w/ digest authentication and got the following response as well: Screenshot 2024-07-20 at 4.14.31 PM.png
 
Glad to see it is working.

Did it also work when your user/password is included in the URL? That part will be needed if using Hubitat. On a Windows computer if the user/pass if not included, then the browser will pop up a login field. OK for testing but not for Hubitat use.

The next step is to review the code posted on this site and see what works for your needs using your browser. If it functions in the browser (i.e. makes the desired camera changes) then constructing an APP in Hubitat is the next step.
 
Glad to see it is working.

Did it also work when your user/password is included in the URL? That part will be needed if using Hubitat. On a Windows computer if the user/pass if not included, then the browser will pop up a login field. OK for testing but not for Hubitat use.

The next step is to review the code posted on this site and see what works for your needs using your browser. If it functions in the browser (i.e. makes the desired camera changes) then constructing an APP in Hubitat is the next step.


Well, I think there's an assumption here that I'm using hubitat.. maybe I should be.. but i'm not at that level of automation yet.. i'm still on dumb old smartthings. Is there another lighterweight way of just running an API command periodically via a docker container +script before I make the full leap into something like hubitat or another similar platform ?
 
  • Like
Reactions: Alaska Country
Have only used on the Hub. However, it would be worth a try to use Power Shell or any program that can send the URL as a "send HTTP get".

Started with ST some time ago but switched to Hubitat as did not like the dependence on the Cloud for ST. Thus have not tried ST for any Dahua HTTP API use.


There may be other ideas on how to make it work with ST.
 
Have only used on the Hub. However, it would be worth a try to use Power Shell or any program that can send the URL as a "send HTTP get".

Started with ST some time ago but switched to Hubitat as did not like the dependence on the Cloud for ST. Thus have not tried ST for any Dahua HTTP API use.


There may be other ideas on how to make it work with ST.
Any reason you settled on hubitat vs HomeAssistant ? I'm looking right now into trying to setup NodeRed as a general automation catchall platform for little annoyances like this. Ideally I'll have it query once an hour using an API call, and then have it inspect the response to see if it's the desired bitrate or not.. and if not.. then set the desired bitrate :) . It's a rediculous kludge, but I think it'll work.
 
finally figured it out:

cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][1][0].Mode=Manual

sets the white light to ON

cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][1][0].Mode=Off

sets it off
 
  • Love
Reactions: tigerwillow1
finally figured it out:


How did you figure this out? It's not in the latest API spec that I know of (v3.26). Since this is your one and only post to date, I have to ask, are you a bot?
 
How did you figure this out? It's not in the latest API spec that I know of (v3.26). Since this is your one and only post to date, I have to ask, are you a bot?
hahaha no I am not a bot.. just a lurker here but have multiple cameras from Andy.

If I recall correctly I inspected the config api and noticed this entry:
Lighting_V2[0][1][0].Mode=Off

Then tested with manual and it worked!
 
  • Like
Reactions: tigerwillow1