Hikvision Scene Change - Curl command

speedywrx

n3wb
Joined
Jun 30, 2015
Messages
17
Reaction score
14
Hello all - since Hikvision cameras are limited to a hard time set on a monthly basis, I'm trying to tie in the cameras into my smart home (Home Assistant) and using the curl command to change the scene from Normal to Low Illumination and vice versa. This way I'll be able to automate it around sunrise/sunset.

The command I'm trying:
Code:
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
But it's returning the following error saying invalid operation:
Code:
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
Any ideas on what I'm doing wrong?

Camera: Hikvision DS-2CD2087G2-L
 

trempa92

Pulling my weight
Joined
Mar 26, 2020
Messages
745
Reaction score
231
Location
Croatia,Zagreb
Code:
PUT METHOD curl '[URL unfurl="true"]http://192.168.2.142/ISAPI/Image/channels/1/displayParamSwitch[/URL]' \

'<?xml version="1.0" encoding="UTF-8"?><DisplayParamSwitch><mode>month</mode><Month><PeriodList size="12"><Period><id>1</id><TimeRangeList><TimeRange><beginTime>00:05</beginTime><endTime>24:00</endTime><linkScene>lowIllumination</linkScene></TimeRange></TimeRangeList></Period><Period><id>2</id><TimeRangeList><TimeRange><beginTime>00:05</beginTime><endTime>24:00</endTime><linkScene>lowIllumination</linkScene></TimeRange></TimeRangeList></Period><Period><id>3</id><TimeRangeList><TimeRange><beginTime>00:05</beginTime><endTime>24:00</endTime><linkScene>lowIllumination</linkScene></TimeRange></TimeRangeList></Period><Period><id>4</id><TimeRangeList><TimeRange><beginTime>00:05</beginTime><endTime>24:00</endTime><linkScene>lowIllumination</linkScene></TimeRange></TimeRangeList></Period><Period><id>5</id><TimeRangeList><TimeRange><beginTime>00:05</beginTime><endTime>24:00</endTime><linkScene>lowIllumination</linkScene></TimeRange></TimeRangeList></Period><Period><id>6</id><TimeRangeList><TimeRange><beginTime>00:05</beginTime><endTime>24:00</endTime><linkScene>lowIllumination</linkScene></TimeRange></TimeRangeList></Period><Period><id>7</id><TimeRangeList><TimeRange><beginTime>00:05</beginTime><endTime>24:00</endTime><linkScene>lowIllumination</linkScene></TimeRange></TimeRangeList></Period><Period><id>8</id><TimeRangeList><TimeRange><beginTime>00:05</beginTime><endTime>24:00</endTime><linkScene>lowIllumination</linkScene></TimeRange></TimeRangeList></Period><Period><id>9</id><TimeRangeList><TimeRange><beginTime>00:05</beginTime><endTime>24:00</endTime><linkScene>lowIllumination</linkScene></TimeRange></TimeRangeList></Period><Period><id>10</id><TimeRangeList><TimeRange><beginTime>00:05</beginTime><endTime>24:00</endTime><linkScene>lowIllumination</linkScene></TimeRange></TimeRangeList></Period><Period><id>11</id><TimeRangeList><TimeRange><beginTime>00:05</beginTime><endTime>24:00</endTime><linkScene>lowIllumination</linkScene></TimeRange></TimeRangeList></Period><Period><id>12</id><TimeRangeList><TimeRange><beginTime>00:05</beginTime><endTime>24:00</endTime><linkScene>lowIllumination</linkScene></TimeRange></TimeRangeList></Period></PeriodList></Month></DisplayParamSwitch>' \

  --compressed \

  --insecure
 

speedywrx

n3wb
Joined
Jun 30, 2015
Messages
17
Reaction score
14
I see what you're doing with changing the values for the Image Parameters Switch on the monthly basis. I suppose one could continuously update those values based off of sunrise/sunset times.

But that is why I wanted to keep Image Parameters Switch off and just hard change the Scene as you normally could in Display Settings. No option for that?
 

trempa92

Pulling my weight
Joined
Mar 26, 2020
Messages
745
Reaction score
231
Location
Croatia,Zagreb
Im not really sure what you mean, but there are other stuff about switch


Code:
DAY NIGHT SWITCH - AUTO
curl 'http://192.168.22.122/ISAPI/Image/channels/1/ircutFilter' \
  -X 'PUT' \

  --data-raw '<?xml version="1.0" encoding="UTF-8"?><IrcutFilter><IrcutFilterType>auto</IrcutFilterType><nightToDayFilterLevel>4</nightToDayFilterLevel><nightToDayFilterTime>5</nightToDayFilterTime></IrcutFilter>' \
  --compressed \
  --insecure




DAY NIGHT SWITCH - SCHEDULE SWITCH
curl 'http://192.168.22.122/ISAPI/Image/channels/1/ircutFilter' \
  -X 'PUT' \

  --data-raw '<?xml version="1.0" encoding="UTF-8"?><IrcutFilter><IrcutFilterType>schedule</IrcutFilterType><Schedule><scheduleType>day</scheduleType><TimeRange><beginTime>06:00:00</beginTime><endTime>18:00:00</endTime></TimeRange></Schedule><nightToDayFilterLevel>4</nightToDayFilterLevel><nightToDayFilterTime>5</nightToDayFilterTime></IrcutFilter>' \
  --compressed \
  --insecure


SCHEDULE-SWITCH SHEDULED IMAGE SETTINGS
curl 'http://192.168.22.122/ISAPI/Image/channels/1/ISPMode' \
  -X 'PUT' \

  --data-raw '<?xml version="1.0" encoding="UTF-8"?><ISPMode><mode>schedule</mode><Schedule><scheduleType>day</scheduleType><TimeRange><beginTime>06:00:00</beginTime><endTime>18:00:00</endTime></TimeRange></Schedule></ISPMode>' \
  --compressed \
  --insecure


AUTO SWITCH SSCHEDULED IMAGE SETTINGS
curl 'http://192.168.22.122/ISAPI/Image/channels/1/ISPMode' \
  -X 'PUT' \

  --data-raw '<?xml version="1.0" encoding="UTF-8"?><ISPMode><mode>auto</mode><Schedule><scheduleType>day</scheduleType><TimeRange><beginTime>06:00:00</beginTime><endTime>18:00:00</endTime></TimeRange></Schedule></ISPMode>' \
  --compressed \
  --insecure
 

trempa92

Pulling my weight
Joined
Mar 26, 2020
Messages
745
Reaction score
231
Location
Croatia,Zagreb
I dont know how home assistant work, but if i need anything automated i do a win service on server and let it run
 

speedywrx

n3wb
Joined
Jun 30, 2015
Messages
17
Reaction score
14
I was able to get it to work in Home Assistant with the following syntax:

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

appreciate the help!
 
Top