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

Ideas:
1. Do you have the username and password in the API command?
2. Is the camera schedule set correctly for when you want the T180 in night mode?
3. Are you using On Alert and On Reset on the initiating camera's BI Trigger tab?
4. Is the BI profile enabled on the Action Set tab?
5. Is the intensity for the light turned up for the night profile?
6. Are you using "Manual" and "Off" in the API commands?

All of this assumes you're doing the same thing as I am, using a different camera to work the T180's LED. It is working very reliably for me. If you're using the T180 to trigger its own LED, maybe there's some interaction that isn't obvious to me.

From what you described the easy conclusion is that there's a hardware problem with the light, except I think that's such low probability that it must be something else.
 
I've had it all working but the LED seems to just stop working and won't turn on anymore. The API and the GUI show that the LED should be on. Then occasionally, it will come on and off for a while and then it becomes unresponsive again. Any ideas?
So, I've got a number of differences in my setup. First I've got a Color 4k-T (not 180) but the command is the same. I also don't use Blue Iris. I am issuing the commands via home assistant. I've now tried resetting the camera to defaults and setting up from scratch but this hasn't made a difference. It definitely isn't a hardware issue so it's either a configuration issue which is weird because sometimes it works or it is a firmware issue....
 
Ok, I have just figured the pattern out.. In home assistant I have the camera rtsp streaming the cameras substream. When I am viewing the substream in home assistant, the LED will not turn on even if the API and the GUI reports this is on. I'm not sure why this is and whether this is a bug in the camera firmware.
EDIT - I don't think this is a camera firmware issue as I can change the LED when the substream is being streamed via VLC.
 
Last edited:
  • Like
Reactions: tigerwillow1
Has anyone managed to send the API command using Home Assistant?

I'm trying to use a Rest Command, but it returns a 410, even if I put the username & password in the URL

I haven't managed to get a curl command working from Home Assistant, either.

I can turn the lights on & off with my browser, just by using this, without any authentication.
 
Yes, I've got a rest sensor to obtain the status of the LED and a command line sensor to switch it on or off.

Code:
binary_sensor:
    - platform: rest
      resource: http://IP_ADDRESS/cgi-bin/configManager.cgi?action=getConfig&name=Lighting_V2[0][1][0].Mode
      method: GET
      authentication: digest
      username: USERNAME
      password: PASSWORD
      name: Gate cam LED status
      device_class: light
      icon: mdi:led-on
      value_template: "{{ 'Manual' in value }}"

Code:
command_line:
  switch:
    command_on: curl -g --digest -u USERNAME:PASSWORD "IP_ADDRESS/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][1][0].Mode=Manual"
    command_off: curl -g --digest -u USERNAME:PASSWORD "IP_ADDRESS/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][1][0].Mode=Off"
    name: Gate cam LED
    icon: mdi:led-on

I hope this helps. The only issue I've come across is that I can't switch the LED on or off whilst watching the camera stream in home assistant. I think it is a bug with the camera firmware/api. Let me know if you have any luck with this....
 
Yes, I've got a rest sensor to obtain the status of the LED and a command line sensor to switch it on or off.

Code:
binary_sensor:
    - platform: rest
      resource: http://IP_ADDRESS/cgi-bin/configManager.cgi?action=getConfig&name=Lighting_V2[0][1][0].Mode
      method: GET
      authentication: digest
      username: USERNAME
      password: PASSWORD
      name: Gate cam LED status
      device_class: light
      icon: mdi:led-on
      value_template: "{{ 'Manual' in value }}"

Code:
command_line:
  switch:
    command_on: curl -g --digest -u USERNAME:PASSWORD "IP_ADDRESS/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][1][0].Mode=Manual"
    command_off: curl -g --digest -u USERNAME:PASSWORD "IP_ADDRESS/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2[0][1][0].Mode=Off"
    name: Gate cam LED
    icon: mdi:led-on

I hope this helps. The only issue I've come across is that I can't switch the LED on or off whilst watching the camera stream in home assistant. I think it is a bug with the camera firmware/api. Let me know if you have any luck with this....
Thank you, I managed to get it working on a curl command in the end, after I realised that some of the double quotes were unicode rather than ASCII, which was stopping it working. I can get the light to go on and off, but not tested it to see if watching the stream stops that happening, yet.
 
  • Like
Reactions: Edition8975