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

Paiberfunk

Getting the hang of it
Joined
Jul 14, 2024
Messages
77
Reaction score
47
Location
Boston
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 ?
 

Alaska Country

Getting comfortable
Joined
Jun 10, 2021
Messages
527
Reaction score
730
Location
Alaska
Check out these threads for suggestions.







 

Alaska Country

Getting comfortable
Joined
Jun 10, 2021
Messages
527
Reaction score
730
Location
Alaska
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.
 

duplo

Getting comfortable
Joined
May 26, 2022
Messages
464
Reaction score
594
Location
Berlin, Deutschland
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

Getting the hang of it
Joined
Jul 14, 2024
Messages
77
Reaction score
47
Location
Boston
There is already known solution. You will find it in another thread if you search for it.
I’ve been looking for it but maybe I’m searching badly ? What should I be looking for / or can you link to the thread here?
 

duplo

Getting comfortable
Joined
May 26, 2022
Messages
464
Reaction score
594
Location
Berlin, Deutschland
 

Alaska Country

Getting comfortable
Joined
Jun 10, 2021
Messages
527
Reaction score
730
Location
Alaska
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

Getting the hang of it
Joined
Jul 14, 2024
Messages
77
Reaction score
47
Location
Boston
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
 

Alaska Country

Getting comfortable
Joined
Jun 10, 2021
Messages
527
Reaction score
730
Location
Alaska
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.
 

Paiberfunk

Getting the hang of it
Joined
Jul 14, 2024
Messages
77
Reaction score
47
Location
Boston
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 ?
 

Alaska Country

Getting comfortable
Joined
Jun 10, 2021
Messages
527
Reaction score
730
Location
Alaska
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.
 

Paiberfunk

Getting the hang of it
Joined
Jul 14, 2024
Messages
77
Reaction score
47
Location
Boston
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.
 

Alaska Country

Getting comfortable
Joined
Jun 10, 2021
Messages
527
Reaction score
730
Location
Alaska
Have not looked at HA as another possibility. Settled on Hubitat and it does what is needed.
 
Top