I’m trying to get my Hikvision DS-2CD2087G2-L to change scenes from “Normal” to “Low Illumination” through a shell command in Home Assistant with no luck. I have set up the following:
In configuration.yaml:
shell_command:
hik3_night: curl -k --silent -H "Content-Type:application/xml" -X PUT -d '<?xml version="1.0 encoding="UTF-8"?><MountingScenario><mode>lowIllumination</mode></MountingScenario>' http://CAMERA_IP/ISAPI/Image/channels/3/mountingScenario --digest -u user:pass
Then I call the shell command service to run it and it returns the following:
stdout: |-
<?xml version="1.0" encoding="UTF-8" ?>
<ResponseStatus version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<statusCode>4</statusCode>
<statusString>Invalid Operation</statusString>
<subStatusCode>notSupport</subStatusCode>
</ResponseStatus>
stderr: ""
returncode: 0
What am I doing wrong?
For those in the same situation, I have figured it out. I have cameras connected to a Hikvision NVR, in this specific case, it’s camera 3 on POE port 65003. Ensure that the Image Parameters Switch is disabled. The following code can be put into the configuration.yaml:
shell_command:
Hik3_normal: curl -k --silent -H "Content-Type:application/xml" -X PUT -d '<?xml version="1.0 encoding="UTF-8"?><MountingScenario><mode>normal</mode></MountingScenario>' http://CAMERA_IP:65003/ISAPI/Image/channels/1/mountingScenario --digest -u user:password
Hik3_lowillumination: curl -k --silent -H "Content-Type:application/xml" -X PUT -d '<?xml version="1.0 encoding="UTF-8"?><MountingScenario><mode>lowIllumination</mode></MountingScenario>' http://CAMERA_IP:65003/ISAPI/Image/channels/1/mountingScenario --digest -u user:password
Then from any automation you can call the service “shell command” to execute it off any trigger/condition.