Control the white ColorVU LED on Hikvision cameras

Me too :wink:
Try changing the LED On parameter to Auto in the camera’s web interface, Save, then try the CURL command. Note that the checkbox on the web interface won’t refresh, to see it changed you need to click on some other menu and then back to External Device menu to see the change.

Yep! That works :slight_smile:

<?xml version="1.0" encoding="UTF-8"?>
<ResponseStatus version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<requestURL>/ISAPI/System/externalDevice</requestURL>
<statusCode>1</statusCode>
<statusString>OK</statusString>
<subStatusCode>ok</subStatusCode>
</ResponseStatus>

Now how to make it work in Hass? :smiley:
I just need the switch btw. …for now :slight_smile:

Wait it does work now :smiley:
So it was just the AUTO setting causing problems!

Yes. If you want the command to work in TIMING mode, use:

ON:
curl -k --silent -H 'Content-Type:application/xml' -X PUT -d '<ExternalDevice><SupplementLight><enabled>true</enabled><mode>schedule</mode><Schedule><TimeRange><beginTime>20:00:00</beginTime><endTime>06:00:00</endTime></TimeRange></Schedule></SupplementLight></ExternalDevice>' http://camera.ip.address/ISAPI/System/externalDevice --digest -u user:pass

OFF:
curl -k --silent -H 'Content-Type:application/xml' -X PUT -d '<ExternalDevice><SupplementLight><enabled>false</enabled><mode>schedule</mode><Schedule><TimeRange><beginTime>20:00:00</beginTime><endTime>06:00:00</endTime></TimeRange></Schedule></SupplementLight></ExternalDevice>' http://camera.ip.address/ISAPI/System/externalDevice --digest -u user:pass

The XML has to contain the timing information too.

It’s just in the second switch type in my example.
I’ll try to make it more clear.

Awesome, I’ll give it a try and report back :slight_smile:
Thanks a lot Robi!

Hiya does this work with the virtual IP thing if my 2 colorvu cameras are directly connected to my NVR ?

I think it should, the IP address would be the NVR address:port you see in the settings. As far as I remember, all the NVR does is to forward out the cameras to it’s own IP address, pretty much like a port forward to wan on a soho router.
Why don’t you try it out? Let us know if it does.

Yeah I’m going to next chance I get.
Cheers :+1:t2:

FYI - One thing I noticed in “auto LED on” mode…

When I turn it on during night it kind of goes into a crazy loop of turning on/off LED. I guess the camera confuses itself thinking it’s not dark anymore when it turns the LED on and then turns it off etc. indefinetly.

I yet have to test it with “Timing” mode (always on 00:01-23:59).

Yes. That’s why I also think Auto mode is not that good as it is influenced by many undesired factors.
Timing mode is better, and it’s also possible to update timings from Home Assistant if you want to.

As long as I can manually turn it on/off when in timing mode, I’m happy :slight_smile:

Seeing as this is such an awesome feature, would it be possible to create a similar one to turn off line crossing temporarily?

Thank for sharing.
I will try to find time to try it. :slight_smile:

As far as I see it’s perfectly feasible as all you’d have to do is to PUT to the http://YOUR.CAMERA.IP/ISAPI/Smart/LineDetection/1 url some XML (this is how it looks like on my case, it may vary on your model):

To disable:

<?xml version="1.0" encoding="UTF-8"?>
<LineDetection>
<id>1</id>
<enabled>false</enabled>
<normalizedScreenSize>
<normalizedScreenWidth>1000</normalizedScreenWidth>
<normalizedScreenHeight>1000</normalizedScreenHeight>
</normalizedScreenSize>
<LineItemList size="1">
<LineItem>
<id>1</id>
<enabled>false</enabled>
<sensitivityLevel>50</sensitivityLevel>
<directionSensitivity>right-left</directionSensitivity>
<CoordinatesList><Coordinates><positionX>1000</positionX><positionY>342</positionY></Coordinates><Coordinates><positionX>2</positionX><positionY>263</positionY></Coordinates></CoordinatesList></LineItem>
</LineItemList>
<isSupportMultiScene>false</isSupportMultiScene>
<recogRuleType>vectorMode</recogRuleType>
</LineDetection>

To enable:

<?xml version="1.0" encoding="UTF-8"?>
<LineDetection>
<id>1</id>
<enabled>true</enabled>
<normalizedScreenSize>
<normalizedScreenWidth>1000</normalizedScreenWidth>
<normalizedScreenHeight>1000</normalizedScreenHeight>
</normalizedScreenSize>
<LineItemList size="1">
<LineItem>
<id>1</id>
<enabled>false</enabled>
<sensitivityLevel>50</sensitivityLevel>
<directionSensitivity>right-left</directionSensitivity>
<CoordinatesList><Coordinates><positionX>1000</positionX><positionY>342</positionY></Coordinates><Coordinates><positionX>2</positionX><positionY>263</positionY></Coordinates></CoordinatesList></LineItem>
</LineItemList>
<isSupportMultiScene>false</isSupportMultiScene>
<recogRuleType>vectorMode</recogRuleType>
</LineDetection>

Amazing, do you think this would work with the DVR as opposed to the camera?

No idea. Use Firefox inspector to see what data goes on when you handle it’s webpage.

Does this still work ?
i got the DS-2CD2047G2-LU model and im not getting the same XML reading. see below.

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<ResponseStatus xmlns="http://www.hikvision.com/ver20/XMLSchema" version="2.0">
<requestURL>/ISAPI/System/externalDevice</requestURL>
<statusCode>4</statusCode>
<statusString>Invalid Operation</statusString>
<subStatusCode>notSupport</subStatusCode>
</ResponseStatus>

Maybe your DS-2CD2047G2-LU has a different API parameter, you need to inspect closely.
With models originally I implemented with, it still works ever since.

Thanks, after an hour i finally found the command to turn the light from 0 (off) - 100 (max brightness)
curl -i --digest -u admin:password -X PUT -d '<SupplementLight><whiteLightBrightness>10</whiteLightBrightness></SupplementLight>' http://192.168.x.x/ISAPI/Image/Channels/1/SupplementLight

Here are my shell scripts for turning on/off the white LED on my two Colorvu cameras. The last pair of scripts has a slightly different format because it is the dual-lens panoramic variant of the 8MP 2387.

Hikvision Models:

  • DS-2CD2387G2-L(U)
  • DS-2CD2387G2P-LSU/SL (dual lens)
shell_command:
  hik_2387G2__led_on_: "curl -k --silent -H 'Content-Type:application/xml' -X PUT -d '<SupplementLight><supplementLightMode>colorVuWhiteLight</supplementLightMode><mixedLightBrightnessRegulatMode>auto</mixedLightBrightnessRegulatMode><whiteLightBrightness>100</whiteLightBrightness></SupplementLight>' http://192.168.1.2/ISAPI/Image/channels/1/supplementLight --digest -u username:password"
  hik_2387G2__led_off: "curl -k --silent -H 'Content-Type:application/xml' -X PUT -d '<SupplementLight><supplementLightMode>close</supplementLightMode><mixedLightBrightnessRegulatMode>auto</mixedLightBrightnessRegulatMode><whiteLightBrightness>100</whiteLightBrightness></SupplementLight>' http://192.168.1.2/ISAPI/Image/channels/1/supplementLight --digest -u username:password"
  hik_2387G2P_led_on_: "curl -k --silent -H 'Content-Type:application/xml' -X PUT -d '<SupplementLight><supplementLightMode>multiAzimuthWhiteLight</supplementLightMode></SupplementLight>' http://192.168.1.3/ISAPI/Image/channels/1/supplementLight --digest -u username:password"
  hik_2387G2P_led_off: "curl -k --silent -H 'Content-Type:application/xml' -X PUT -d '<SupplementLight><supplementLightMode>close</supplementLightMode></SupplementLight>' http://192.168.1.3/ISAPI/Image/channels/1/supplementLight --digest -u username:password"

2 Likes