It is working now with your recipe. I had too many "data" in data field. I was following the examples above and got confused.
whyfseeguy
Posts
-
TTS in MSR? -
TTS in MSR? -
Wait for http response before running the next http requestIn my work flow, I send a number of http requests to my device. Is it possible to wait for a http response of the current action before executing the next http request action?
Thanks.
-
Using Hikvision HTTP API request with MSRHere is an example of what I did with my Hikvision camera settings using MSR and ISAPI to change the scheduled switch (day/night) based on sunrise/sunset daily etc. Nearly all configurable options on the Hikvision can be changed with ISAPI.
HTTP Request: PUT
Request URL:http://user:pass@ipcamaddr:80/ISAPI/Image/channels/1/ISPMode
Request Header:Content-Type: application/xml
Request Body:<ISPMode xmlns="http://www.hikvision.com/ver20/XMLSchema" version="2.0"> <mode>schedule</mode> <Schedule> <scheduleType>day</scheduleType> <TimeRange> <beginTime>${{hikvision_sunrise}}</beginTime> <endTime>${{hikvision_sunset}}</endTime> </TimeRange> </Schedule> </ISPMode>
Capture response to:
text_response
set the following expressions:
text_response= hikvision_sunrise=strftime( "%R" , ( getEntity( "reactor_system>sun" ).attributes.suninfo.sunrise + ( 30 * 60 * 1000 ) ) ) hikvision_sunset=strftime( "%R", ( getEntity( "reactor_system>sun" ).attributes.suninfo.sunset - ( 30 * 60 * 1000 ) ) )
I offset the sunrise and sunset time by 30 mins both ways (30 * 60 * 1000). You can use civil dusk and civil dawn too if that works better for you.
For IRCut Filter, which is where the supplemental light setting is located, set it to ON then control it with the scheduled switch (there is no ISAPI to set it on/off unfortunately)
Request:
http://user:passipcamaddr:80/ISAPI/Image/channels/1/IrcutFilter
Header is the same as above
Body:<IrcutFilter xmlns="http://www.hikvision.com/ver20/XMLSchema" version="2.0"> <IrcutFilterType>schedule</IrcutFilterType> <nightToDayFilterLevel>4</nightToDayFilterLevel> <nightToDayFilterTime>5</nightToDayFilterTime> <Schedule> <scheduleType>day</scheduleType> <TimeRange> <beginTime>${{hikvision_sunrise}}</beginTime> <endTime>${{hikvision_sunset}}</endTime> </TimeRange> </Schedule> </IrcutFilter>
With ISAPI, there are many more things you can set on the camera without using the GUI.
-
Error importing backup from veraI did a pull, now running 21257. Import seems to be working. The import tool created a bunch of rules from Vera Reactor. I will go through them 1 at a time to make the necessary changes. I will report back later if there are issues related to this.
Thanks again.
-
Error importing backup from veraYes I am using Vera Geofencing.
-
Error importing backup from veraHi Patrick,
Running MSR on docker.
Trying to import the reactor config from Vera.
My workflow is:
- docker exec -it reactor /bin/sh
- /opt/reactor # node tools/import_reactor_backup.js /var/reactor/reactor-config-backup.json vera
Got the following error: (After restarting, no reactor config from Vera was imported)
Fetching current rulesets...
Pass 1: Translating...
ReactorSensor 134 Auto (un)lock doors
Creating ruleset for ReactorSensor 134 Auto (un)lock doors
Creating rule rule-134
ReactorSensor 139 Auto Lights
Creating ruleset for ReactorSensor 139 Auto Lights
Creating rule rule-139
ReactorSensor 143 Somfy Control
Creating ruleset for ReactorSensor 143 Somfy Control
Creating rule rule-143
ReactorSensor 167 Blue Iris Control
Creating ruleset for ReactorSensor 167 Blue Iris Control
Creating rule rule-167
ReactorSensor 183 Towel and Heater Sch
Creating ruleset for ReactorSensor 183 Towel and Heater Sch
Creating rule rule-183
ReactorSensor 208 Geofencing Action
Creating ruleset for ReactorSensor 208 Geofencing Action
Creating rule rule-208
(node:639) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'split' of undefined
at fixConditions1 (/opt/reactor/tools/import_reactor_backup.js:185:82)
at /opt/reactor/tools/import_reactor_backup.js:44:13
at Array.forEach (<anonymous>)
at fixConditions1 (/opt/reactor/tools/import_reactor_backup.js:41:35)
at /opt/reactor/tools/import_reactor_backup.js:44:13
at Array.forEach (<anonymous>)
at fixConditions1 (/opt/reactor/tools/import_reactor_backup.js:41:35)
at /opt/reactor/tools/import_reactor_backup.js:438:13
at Array.forEach (<anonymous>)
at /opt/reactor/tools/import_reactor_backup.js:402:34
(Usenode --trace-warnings ...
to show where the warning was created)
(node:639) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:639) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.Any help will be appreciated. The worst case scenario is to re-do all the triggers and conditions in MSR from the ground up.
-
MSR http PUT errorI updated to 21256 (docker). The http put is working for me now. Thank you for the quick fix to the issue.
-
MSR http PUT errorHi Patrick,
I got a 403 when the body is empty, indicating it has passed through the MSR, it got rejected by the camera. So I say it is working without the body as MSR did not throw an error.
Thanks.
-
MSR http PUT errorUsing MSR on Docker. The automation is to send xml body to my Hikvision camera to change the WDR based on the time of day. But getting the following error:
TypeError: Cannot read property 'length' of undefined
at Engine._resume_reaction (/opt/reactor/server/lib/Engine.js:1319:192)
at Engine._process_reaction_queue (/opt/reactor/server/lib/Engine.js:1114:100)My MSR rule:
HTTP Request: PUT
HTTP Request: http://camipaddr/ISAPI/Image/channels/1/WDR/day
HTTP Header: Content-Type: application/xml; charset="UTF-8"
HTTP Body:
<?xml version="1.0" encoding="UTF-8"?>
<WDR version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<mode>open</mode>
<WDRLevel>40</WDRLevel>
</WDR>Any idea why I am getting the above error?
Thanks.