This is part three of our homee documentation. In the first part we looked at the HTTP Interface both homee and your INSTAR camera offers and connected them. This works with all INSTAR IP cameras. In the second tutorial we used Node-RED to connected HTTP interface on the homee side to the MQTT interface on your camera using Node-RED. Note that the INSTAR MQTT Interface only available in INSTAR Full HD camera models.
This time we want to use Node-RED to create a virtual homee that directly connects to the MQTT interface. This virtual device is then controlled by our real homee.
The complete Node-RED Flow can be downloaded at the end of this article.
Installing and Setting up node-red-contrib-homee
This sounds a lot more complicated than it is as all we need is already provided by node-red-contrib-homee. Start by installing the homee support from the Manage Palette menu:
First drag a homeeAPI
node onto your work area and add your real homee's IP address and user login. The node should say that it is connected once you saved your edit:
Now we are able to create a virtual homee by dragging using a homeeDevice
node. Click on Add new virtualHomee to configure it:
Specify a unique homee ID. You can use letters and numbers (max. 10 characters) and add a user login for the virtual device:
Now I want to add a device that allows me to switch the alarm areas on my camera on
and off
. Give it a unique Node-ID and choose the OnOffPlug profile. Then continue by clicking on Attributes:
Inside the JSON editor add the following object:
[{
"id": 100,
"node_id": 1,
"instance": 0,
"minimum": 0,
"maximum": 1,
"current_value": 0,
"target_value": 0,
"last_value": 0,
"unit": "",
"step_value": 1,
"editable": 1,
"type": 1,
"state": 1,
"last_changed": 12345555,
"changed_by": 1,
"changed_by_id": 0,
"based_on": 1,
"data": ""
}]
The attribute id
has to be unique and the node_id
is the ID that you choose for your switch in the previous step. And the type
value 1
defines your switch as a switch -> see CAAttributeType.
homee-in-homee
We are now ready to add our virtual homee to the real one on our network. For this open the device menu and click to add a new WiFi device:
Choose a homee in homee device and select Add new homee:
Type in the homee ID and login you have assigned to your virtual homee in Node-RED:
Your virtual homee should now show up. Click on Send to add it:
You can now try your switch by toggling it in the On
position:
Adding a debug node to our virtual homee shows us that we now receive a status update about our switch whenever it is toggled:
{
"attributeId":100,
"targetValue":1
}
{
"attributeId":100,
"targetValue":0
}
Connecting the MQTT Interface
Toggling Camera Functions
We now have to change this message into something useful for us. For example, we can use the targetValue
to switch the 4 alarm areas on our camera with the MQTT topic instar/local/alarm/area1/enable/raw
to instar/local/alarm/area4/enable/raw
:
The message we are looking for arrives with msg.payload.targetValue
. By setting it to msg.payload
we can directly feed it into 4 MQTT-Out Nodes to switch our 4 areas on 1
or off 0
.
Don't forget that you have to add your camera's MQTT Broker to the MQTT node.
Using a tool like MQTT.fx now shows us that those MQTT Topics get updated every time the switch is used. Every message with payload 1
will switch all 4 areas on, while a 0
deactivates them:
Adding a Status Channel
The sequence above already works great. But there is one problem with it. If we use our camera's WebUI or a smartphone app to switch the alarm areas on or off we are not receiving an update in homee. For this we have to add our camera's MQTT Status Channel as an input to our virtual homee:
As you can see in the screenshot above we are using the MQTT Topics to switch the audio on our camera on or off. Note that there are 3 audio topics that we have to switch for all 3 video streams of our camera - high resolution, medium resolution and low resolution:
instar/local/multimedia/audio/enable/high/raw
instar/local/multimedia/audio/enable/mid/raw
instar/local/multimedia/audio/enable/low/raw
To receive the current state of the audio settings on our camera we have to attach MQTT input nodes with the corresponding Status Topic to the input of our virtual homee:
instar/local/status/multimedia/audio/enable/high/raw
instar/local/status/multimedia/audio/enable/mid/raw
instar/local/status/multimedia/audio/enable/low/raw
To be able to work with this input we first have to turn it into valid JSON, by adding a JSON node. And then sort out our data with a custom function node:
msg.payload = {'id':101, 'value': Number(msg.payload.val)}
return msg;
So the value
that we receive from the MQTT Status input will be either {"val":"1"} or {"val":"0"}. We simply extract the value of val
from this payload, turn it into a number and add the ID of our virtual homee device (our previous device had the ID 100
, so now we use the id 101
for our new device).
The new device is again configured to be an on/off switch. We copy our previous homee node - only need to change the name Audio
, device ID 101
and NodeID 2
to keep them unique:
Back in the homee UI you can now go back to the menu where we added our virtual homee before. Instead of adding a new homee we now have to search for new devices. I named the new device Audio
in the previous step:
Now you can try it out - deactivating the audio in the camera webUI should now also toggle the switch in our homee device UI:
You are now able to use any of the available MQTT Topics and take control over your camera through the homee UI. And every button, switch or slider you add will be available for automation scripts.
Node-RED Flow Export
Part 1
[{"id":"75393df8.e86824","type":"homeeDevice","z":"5026c83e.b368c8","virtual-homee":"","name":"Alarm_Areas","nodeId":"1","profile":"10","icon":"nodeicon_camera","attributes":"[{\"id\":100,\"node_id\":1,\"instance\":0,\"minimum\":0,\"maximum\":1,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"\",\"step_value\":1,\"editable\":1,\"type\":1,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"}]","x":110,"y":180,"wires":[["9fe0bb5a.f639d8"]]},{"id":"542704b9.3c440c","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/area1/enable","topic":"instar/local/alarm/area1/enable/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":475,"y":121,"wires":[]},{"id":"9fe0bb5a.f639d8","type":"change","z":"5026c83e.b368c8","name":"targetValue","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.targetValue","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":180,"wires":[["542704b9.3c440c","ef88a520.e5a8b8","b0746487.26ede8","63750b59.349f54"]]},{"id":"63750b59.349f54","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/area2/enable","topic":"instar/local/alarm/area2/enable/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":475,"y":161,"wires":[]},{"id":"ef88a520.e5a8b8","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/area3/enable","topic":"instar/local/alarm/area3/enable/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":475,"y":201,"wires":[]},{"id":"b0746487.26ede8","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/area4/enable","topic":"instar/local/alarm/area4/enable/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":475,"y":241,"wires":[]},{"id":"fd87a90.65ebe58","type":"homeeDevice","z":"5026c83e.b368c8","virtual-homee":"","name":"Audio","nodeId":"2","profile":"10","icon":"nodeicon_camera","attributes":"[{\"id\":101,\"node_id\":2,\"instance\":0,\"minimum\":0,\"maximum\":1,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"\",\"step_value\":1,\"editable\":1,\"type\":1,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"}]","x":716,"y":320,"wires":[["e45a2b45.bb1778"]]},{"id":"494dca42.c53fd4","type":"mqtt out","z":"5026c83e.b368c8","name":"multimedia/audio/enable/high","topic":"instar/local/multimedia/audio/enable/high/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":664,"y":376,"wires":[]},{"id":"e45a2b45.bb1778","type":"change","z":"5026c83e.b368c8","name":"targetValue","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.targetValue","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":428,"y":376,"wires":[["494dca42.c53fd4","40c78b19.acda34","6342ae78.ee176"]]},{"id":"63e55ead.2a5af","type":"mqtt in","z":"5026c83e.b368c8","name":"status/multimedia/audio/enable/high","topic":"instar/local/status/multimedia/audio/enable/high","qos":"1","datatype":"auto","broker":"996228fe.ababc8","x":160,"y":320,"wires":[["2b0f2fa0.c0d32"]]},{"id":"fc32aaac.edce58","type":"function","z":"5026c83e.b368c8","name":"attributeId/targetValue","func":"msg.payload = {'id':101, 'value': Number(msg.payload.val)}\n\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":320,"wires":[["fd87a90.65ebe58"]]},{"id":"2b0f2fa0.c0d32","type":"json","z":"5026c83e.b368c8","name":"","property":"payload","action":"","pretty":false,"x":385,"y":320,"wires":[["fc32aaac.edce58"]]},{"id":"40c78b19.acda34","type":"mqtt out","z":"5026c83e.b368c8","name":"multimedia/audio/enable/mid","topic":"instar/local/multimedia/audio/enable/mid/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":654,"y":409,"wires":[]},{"id":"6342ae78.ee176","type":"mqtt out","z":"5026c83e.b368c8","name":"multimedia/audio/enable/low","topic":"instar/local/multimedia/audio/enable/low/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":654,"y":442,"wires":[]},{"id":"296264ec.9473bc","type":"mqtt in","z":"5026c83e.b368c8","name":"status/multimedia/audio/enable/mid","topic":"instar/local/status/multimedia/audio/enable/mid","qos":"1","datatype":"auto","broker":"996228fe.ababc8","x":160,"y":353,"wires":[["2b0f2fa0.c0d32"]]},{"id":"1e5b6840.5de388","type":"mqtt in","z":"5026c83e.b368c8","name":"status/multimedia/audio/enable/low","topic":"instar/local/status/multimedia/audio/enable/low","qos":"1","datatype":"auto","broker":"996228fe.ababc8","x":160,"y":386,"wires":[["2b0f2fa0.c0d32"]]},{"id":"996228fe.ababc8","type":"mqtt-broker","z":"","name":"INSTAR MQTT","broker":"192.168.2.117","port":"1883","clientid":"iored","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Complete Flow
[{"id":"7d44a557.7d14fc","type":"homeeDevice","z":"5026c83e.b368c8","virtual-homee":"","name":"INSTAR Alarm Areas","nodeId":"3","profile":"10","icon":"nodeicon_motiondetector","attributes":"[{\"id\":800,\"node_id\":3,\"instance\":0,\"minimum\":0,\"maximum\":1,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"Area 1\",\"step_value\":1,\"editable\":1,\"type\":1,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":801,\"node_id\":3,\"instance\":1,\"minimum\":0,\"maximum\":1,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"Area 2\",\"step_value\":1,\"editable\":1,\"type\":1,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":802,\"node_id\":3,\"instance\":2,\"minimum\":0,\"maximum\":1,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"Area 3\",\"step_value\":1,\"editable\":1,\"type\":1,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":803,\"node_id\":3,\"instance\":3,\"minimum\":0,\"maximum\":1,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"Area 4\",\"step_value\":1,\"editable\":1,\"type\":1,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"}]","x":620,"y":580,"wires":[["bc1ac380.51ad7"]]},{"id":"4ca40848.af8e68","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/area1/enable","topic":"instar/local/alarm/area1/enable/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":1113,"y":531,"wires":[]},{"id":"f57cbd89.42943","type":"change","z":"5026c83e.b368c8","name":"targetValue","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.targetValue","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":938,"y":531,"wires":[["4ca40848.af8e68"]]},{"id":"b0d1e812.613028","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/area2/enable","topic":"instar/local/alarm/area2/enable/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":1113,"y":564,"wires":[]},{"id":"fbbd9b7c.261a98","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/area3/enable","topic":"instar/local/alarm/area3/enable/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":1113,"y":597,"wires":[]},{"id":"d910b125.20bed","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/area4/enable","topic":"instar/local/alarm/area4/enable/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":1113,"y":631,"wires":[]},{"id":"acb7e86d.bcc148","type":"mqtt in","z":"5026c83e.b368c8","name":"status/alarm/area1/enable","topic":"instar/local/status/alarm/area1/enable","qos":"1","datatype":"auto","broker":"996228fe.ababc8","x":115,"y":533,"wires":[["1be50c03.3550a4"]]},{"id":"96ddb0f3.5c319","type":"mqtt in","z":"5026c83e.b368c8","name":"status/alarm/area2/enable","topic":"instar/local/status/alarm/area2/enable","qos":"1","datatype":"auto","broker":"996228fe.ababc8","x":115,"y":566,"wires":[["94ab1ef9.cdf4d"]]},{"id":"8c102b6d.68cd98","type":"mqtt in","z":"5026c83e.b368c8","name":"status/alarm/area3/enable","topic":"instar/local/status/alarm/area3/enable","qos":"1","datatype":"auto","broker":"996228fe.ababc8","x":115,"y":599,"wires":[["a73911f3.a5572"]]},{"id":"1be50c03.3550a4","type":"json","z":"5026c83e.b368c8","name":"","property":"payload","action":"","pretty":false,"x":293,"y":533,"wires":[["5ec81d93.1c19e4"]]},{"id":"5ec81d93.1c19e4","type":"function","z":"5026c83e.b368c8","name":"targetValue","func":"msg.payload = {'id':800, 'value': Number(msg.payload.val)}\n\nreturn msg;","outputs":1,"noerr":0,"x":429,"y":533,"wires":[["7d44a557.7d14fc"]]},{"id":"44c68843.451618","type":"mqtt in","z":"5026c83e.b368c8","name":"status/alarm/area4/enable","topic":"instar/local/status/alarm/area4/enable","qos":"1","datatype":"auto","broker":"996228fe.ababc8","x":116,"y":633,"wires":[["d9144d11.9627a"]]},{"id":"94ab1ef9.cdf4d","type":"json","z":"5026c83e.b368c8","name":"","property":"payload","action":"","pretty":false,"x":290,"y":567,"wires":[["ca346869.a32ed8"]]},{"id":"ca346869.a32ed8","type":"function","z":"5026c83e.b368c8","name":"targetValue","func":"msg.payload = {'id':801, 'value': Number(msg.payload.val)}\n\nreturn msg;","outputs":1,"noerr":0,"x":426,"y":567,"wires":[["7d44a557.7d14fc"]]},{"id":"a73911f3.a5572","type":"json","z":"5026c83e.b368c8","name":"","property":"payload","action":"","pretty":false,"x":290,"y":600,"wires":[["9fd9d9e6.0953c8"]]},{"id":"9fd9d9e6.0953c8","type":"function","z":"5026c83e.b368c8","name":"targetValue","func":"msg.payload = {'id':802, 'value': Number(msg.payload.val)}\n\nreturn msg;","outputs":1,"noerr":0,"x":426,"y":600,"wires":[["7d44a557.7d14fc"]]},{"id":"d9144d11.9627a","type":"json","z":"5026c83e.b368c8","name":"","property":"payload","action":"","pretty":false,"x":290,"y":633,"wires":[["f68599c3.e177d8"]]},{"id":"f68599c3.e177d8","type":"function","z":"5026c83e.b368c8","name":"targetValue","func":"msg.payload = {'id':803, 'value': Number(msg.payload.val)}\n\nreturn msg;","outputs":1,"noerr":0,"x":426,"y":633,"wires":[["7d44a557.7d14fc"]]},{"id":"bc1ac380.51ad7","type":"switch","z":"5026c83e.b368c8","name":"","property":"payload.attributeId","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"num"},{"t":"eq","v":"201","vt":"num"},{"t":"eq","v":"202","vt":"num"},{"t":"eq","v":"203","vt":"num"}],"checkall":"true","repair":false,"outputs":4,"x":784,"y":580,"wires":[["f57cbd89.42943"],["29a38c94.aa4dc4"],["728fe2c4.ceb83c"],["fa856d62.124b5"]]},{"id":"29a38c94.aa4dc4","type":"change","z":"5026c83e.b368c8","name":"targetValue","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.targetValue","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":938,"y":564,"wires":[["b0d1e812.613028"]]},{"id":"728fe2c4.ceb83c","type":"change","z":"5026c83e.b368c8","name":"targetValue","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.targetValue","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":938,"y":597,"wires":[["fbbd9b7c.261a98"]]},{"id":"fa856d62.124b5","type":"change","z":"5026c83e.b368c8","name":"targetValue","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.targetValue","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":938,"y":631,"wires":[["d910b125.20bed"]]},{"id":"abf1fa60.d48ce8","type":"homeeDevice","z":"5026c83e.b368c8","virtual-homee":"","name":"INSTAR Sensitivity","nodeId":"4","profile":"1004","icon":"nodeicon_motiondetector","attributes":"[{\"id\":804,\"node_id\":4,\"instance\":0,\"minimum\":0,\"maximum\":100,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"%25 Area 1\",\"step_value\":1,\"editable\":1,\"type\":2,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":805,\"node_id\":4,\"instance\":1,\"minimum\":0,\"maximum\":100,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"%25 Area 2\",\"step_value\":1,\"editable\":1,\"type\":2,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":806,\"node_id\":4,\"instance\":2,\"minimum\":0,\"maximum\":100,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"%25 Area 3\",\"step_value\":1,\"editable\":1,\"type\":2,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":807,\"node_id\":4,\"instance\":3,\"minimum\":0,\"maximum\":100,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"%25 Area 4\",\"step_value\":1,\"editable\":1,\"type\":2,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"}]","x":632,"y":760,"wires":[["250e98b6.711328"]]},{"id":"eadc8d56.e07a9","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/area1/sensitivity","topic":"instar/local/alarm/area1/sensitivity/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":1134,"y":711,"wires":[]},{"id":"6121f440.b825bc","type":"change","z":"5026c83e.b368c8","name":"targetValue","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.targetValue","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":949,"y":711,"wires":[["eadc8d56.e07a9"]]},{"id":"92ef3632.912648","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/area2/sensitivity","topic":"instar/local/alarm/area2/sensitivity/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":1134,"y":744,"wires":[]},{"id":"ff5ed819.216878","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/area3/sensitivity","topic":"instar/local/alarm/area3/sensitivity/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":1134,"y":777,"wires":[]},{"id":"b8b1d9aa.4750e8","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/area4/sensitivity","topic":"instar/local/alarm/area4/sensitivity/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":1134,"y":811,"wires":[]},{"id":"dcd36136.9bb35","type":"mqtt in","z":"5026c83e.b368c8","name":"status/alarm/area1/sensitivity","topic":"instar/local/status/alarm/area1/sensitivity","qos":"1","datatype":"auto","broker":"996228fe.ababc8","x":125,"y":713,"wires":[["179c1d2b.b52983"]]},{"id":"664e8204.f1c2ac","type":"mqtt in","z":"5026c83e.b368c8","name":"status/alarm/area2/sensitivity","topic":"instar/local/status/alarm/area2/sensitivity","qos":"1","datatype":"auto","broker":"996228fe.ababc8","x":125,"y":746,"wires":[["a7f7a96a.42b3f8"]]},{"id":"e4b4bcbc.6d50f","type":"mqtt in","z":"5026c83e.b368c8","name":"status/alarm/area3/sensitivity","topic":"instar/local/status/alarm/area3/sensitivity","qos":"1","datatype":"auto","broker":"996228fe.ababc8","x":125,"y":779,"wires":[["9a95259a.775808"]]},{"id":"179c1d2b.b52983","type":"json","z":"5026c83e.b368c8","name":"","property":"payload","action":"","pretty":false,"x":307,"y":713,"wires":[["c7437a69.100158"]]},{"id":"c7437a69.100158","type":"function","z":"5026c83e.b368c8","name":"targetValue","func":"msg.payload = {'id':804, 'value': Number(msg.payload.val)}\n\nreturn msg;","outputs":1,"noerr":0,"x":439,"y":713,"wires":[["abf1fa60.d48ce8"]]},{"id":"2d6567fc.476c58","type":"mqtt in","z":"5026c83e.b368c8","name":"status/alarm/area4/sensitivity","topic":"instar/local/status/alarm/area4/sensitivity","qos":"1","datatype":"auto","broker":"996228fe.ababc8","x":126,"y":813,"wires":[["3600a383.8da2cc"]]},{"id":"a7f7a96a.42b3f8","type":"json","z":"5026c83e.b368c8","name":"","property":"payload","action":"","pretty":false,"x":304,"y":747,"wires":[["f06a519e.35e61"]]},{"id":"f06a519e.35e61","type":"function","z":"5026c83e.b368c8","name":"targetValue","func":"msg.payload = {'id':805, 'value': Number(msg.payload.val)}\n\nreturn msg;","outputs":1,"noerr":0,"x":436,"y":747,"wires":[["abf1fa60.d48ce8"]]},{"id":"9a95259a.775808","type":"json","z":"5026c83e.b368c8","name":"","property":"payload","action":"","pretty":false,"x":304,"y":780,"wires":[["6df42c0e.a8e674"]]},{"id":"6df42c0e.a8e674","type":"function","z":"5026c83e.b368c8","name":"targetValue","func":"msg.payload = {'id':806, 'value': Number(msg.payload.val)}\n\nreturn msg;","outputs":1,"noerr":0,"x":436,"y":780,"wires":[["abf1fa60.d48ce8"]]},{"id":"3600a383.8da2cc","type":"json","z":"5026c83e.b368c8","name":"","property":"payload","action":"","pretty":false,"x":304,"y":813,"wires":[["49c51425.19a79c"]]},{"id":"49c51425.19a79c","type":"function","z":"5026c83e.b368c8","name":"targetValue","func":"msg.payload = {'id':807, 'value': Number(msg.payload.val)}\n\nreturn msg;","outputs":1,"noerr":0,"x":436,"y":813,"wires":[["abf1fa60.d48ce8"]]},{"id":"250e98b6.711328","type":"switch","z":"5026c83e.b368c8","name":"","property":"payload.attributeId","propertyType":"msg","rules":[{"t":"eq","v":"804","vt":"num"},{"t":"eq","v":"805","vt":"num"},{"t":"eq","v":"806","vt":"num"},{"t":"eq","v":"807","vt":"num"}],"checkall":"true","repair":false,"outputs":4,"x":795,"y":760,"wires":[["6121f440.b825bc"],["6a27f00e.6e6df"],["1146a6bd.ce8c69"],["93369dd1.1cb7"]]},{"id":"6a27f00e.6e6df","type":"change","z":"5026c83e.b368c8","name":"targetValue","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.targetValue","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":949,"y":744,"wires":[["92ef3632.912648"]]},{"id":"1146a6bd.ce8c69","type":"change","z":"5026c83e.b368c8","name":"targetValue","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.targetValue","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":949,"y":777,"wires":[["ff5ed819.216878"]]},{"id":"93369dd1.1cb7","type":"change","z":"5026c83e.b368c8","name":"targetValue","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.targetValue","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":949,"y":811,"wires":[["b8b1d9aa.4750e8"]]},{"id":"b2ef12bd.7d2c9","type":"function","z":"5026c83e.b368c8","name":"targetValue","func":"msg.payload = {'id':808, 'value': 0}\n\nreturn msg;","outputs":1,"noerr":0,"x":230,"y":1293,"wires":[["51bf9ce5.21a8f4"]]},{"id":"51bf9ce5.21a8f4","type":"homeeDevice","z":"5026c83e.b368c8","virtual-homee":"","name":"INSTAR Trigger Alarm","nodeId":"11","profile":"10","icon":"nodeicon_motiondetector","attributes":"[{\"id\":808,\"node_id\":11,\"instance\":0,\"minimum\":0,\"maximum\":1,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"Alarm\",\"step_value\":1,\"editable\":1,\"type\":1,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"}]","x":419,"y":1293,"wires":[["ac83ec3b.e027c","24a4bb3b.3c08c4"]]},{"id":"6c120330.99439c","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/pushalarm","topic":"instar/local/alarm/pushalarm/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":765,"y":1293,"wires":[]},{"id":"fd6f8015.cb62","type":"mqtt in","z":"5026c83e.b368c8","name":"status/alarm/actions/email","topic":"instar/local/status/alarm/actions/email","qos":"1","datatype":"auto","broker":"996228fe.ababc8","x":115,"y":961,"wires":[["113ee65f.4c031a"]]},{"id":"113ee65f.4c031a","type":"json","z":"5026c83e.b368c8","name":"","property":"payload","action":"","pretty":false,"x":293,"y":961,"wires":[["c3b26a32.e07aa8"]]},{"id":"b3a65cc0.3af35","type":"function","z":"5026c83e.b368c8","name":"targetValue 1","func":"msg.payload = {'id':809, 'value': 1}\n\nreturn msg;","outputs":1,"noerr":0,"x":549,"y":942,"wires":[["61f02d87.6f9bd4"]]},{"id":"61f02d87.6f9bd4","type":"homeeDevice","z":"5026c83e.b368c8","virtual-homee":"","name":"INSTAR Alarm Email","nodeId":"5","profile":"10","icon":"nodeicon_motiondetector","attributes":"[{\"id\":809,\"node_id\":5,\"instance\":0,\"minimum\":0,\"maximum\":1,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"Email\",\"step_value\":1,\"editable\":1,\"type\":1,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"}]","x":745,"y":961,"wires":[["295e95f6.e7bd5a"]]},{"id":"295e95f6.e7bd5a","type":"switch","z":"5026c83e.b368c8","name":"","property":"payload.targetValue","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":910,"y":961,"wires":[["47d78e1f.aa4cd"],["9947f73e.612918"]]},{"id":"47d78e1f.aa4cd","type":"change","z":"5026c83e.b368c8","name":"on","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1024,"y":941,"wires":[["860cadd1.84f62"]]},{"id":"860cadd1.84f62","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/actions/email","topic":"instar/local/alarm/actions/email/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":1181,"y":958,"wires":[]},{"id":"ac83ec3b.e027c","type":"delay","z":"5026c83e.b368c8","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":83,"y":1293,"wires":[["b2ef12bd.7d2c9"]]},{"id":"c3b26a32.e07aa8","type":"switch","z":"5026c83e.b368c8","name":"","property":"payload.val","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":407,"y":961,"wires":[["b3a65cc0.3af35"],["176ed0b8.ae38df"]]},{"id":"176ed0b8.ae38df","type":"function","z":"5026c83e.b368c8","name":"targetValue 0","func":"msg.payload = {'id':809, 'value': 0}\n\nreturn msg;","outputs":1,"noerr":0,"x":549,"y":978,"wires":[["61f02d87.6f9bd4"]]},{"id":"9947f73e.612918","type":"change","z":"5026c83e.b368c8","name":"off","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1026,"y":977,"wires":[["860cadd1.84f62"]]},{"id":"24a4bb3b.3c08c4","type":"change","z":"5026c83e.b368c8","name":"1","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":606,"y":1293,"wires":[["6c120330.99439c"]]},{"id":"81864a6c.ee0808","type":"mqtt in","z":"5026c83e.b368c8","name":"status/alarm/actions/pir/enable","topic":"instar/local/status/alarm/actions/pir/enable","qos":"1","datatype":"auto","broker":"996228fe.ababc8","x":138,"y":888,"wires":[["129a088f.a907a7"]]},{"id":"129a088f.a907a7","type":"json","z":"5026c83e.b368c8","name":"","property":"payload","action":"","pretty":false,"x":334,"y":888,"wires":[["59cbc796.55ce28"]]},{"id":"59cbc796.55ce28","type":"function","z":"5026c83e.b368c8","name":"targetValue","func":"msg.payload = {'id':810, 'value': Number(msg.payload.val)}\n\nreturn msg;","outputs":1,"noerr":0,"x":470,"y":888,"wires":[["c3696710.adb1f8"]]},{"id":"c3696710.adb1f8","type":"homeeDevice","z":"5026c83e.b368c8","virtual-homee":"","name":"INSTAR PIR Sensor","nodeId":"6","profile":"10","icon":"nodeicon_motiondetector","attributes":"[{\"id\":810,\"node_id\":6,\"instance\":0,\"minimum\":0,\"maximum\":1,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"PIR\",\"step_value\":1,\"editable\":1,\"type\":1,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"}]","x":648,"y":888,"wires":[["ff90e61e.7a6f18"]]},{"id":"ff90e61e.7a6f18","type":"change","z":"5026c83e.b368c8","name":"targetValue","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.targetValue","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":851,"y":888,"wires":[["74eea772.00cda8"]]},{"id":"74eea772.00cda8","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/actions/pir/enable","topic":"instar/local/alarm/actions/pir/enable/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":1046,"y":888,"wires":[]},{"id":"3ad35fb4.3b9fd","type":"mqtt in","z":"5026c83e.b368c8","name":"status/alarm/actions/linkareas","topic":"instar/local/status/alarm/actions/linkareas","qos":"1","datatype":"auto","broker":"996228fe.ababc8","x":125,"y":1044,"wires":[["5023d58.dbff12c"]]},{"id":"5023d58.dbff12c","type":"json","z":"5026c83e.b368c8","name":"","property":"payload","action":"","pretty":false,"x":309,"y":1044,"wires":[["252aa218.cc297e"]]},{"id":"592b80ce.9cd","type":"function","z":"5026c83e.b368c8","name":"targetValue 1","func":"msg.payload = {'id':811, 'value': 1}\n\nreturn msg;","outputs":1,"noerr":0,"x":559,"y":1024,"wires":[["39ff78cc.73d728"]]},{"id":"39ff78cc.73d728","type":"homeeDevice","z":"5026c83e.b368c8","virtual-homee":"","name":"INSTAR Link Areas","nodeId":"7","profile":"10","icon":"nodeicon_motiondetector","attributes":"[{\"id\":811,\"node_id\":7,\"instance\":0,\"minimum\":0,\"maximum\":1,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"Link\",\"step_value\":1,\"editable\":1,\"type\":1,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"}]","x":738,"y":1043,"wires":[["dce4e978.835d48"]]},{"id":"dce4e978.835d48","type":"switch","z":"5026c83e.b368c8","name":"","property":"payload.targetValue","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":897,"y":1043,"wires":[["f236f62e.67f348"],["b0e37df5.831fe"]]},{"id":"f236f62e.67f348","type":"change","z":"5026c83e.b368c8","name":"on","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1011,"y":1023,"wires":[["39451fce.b2a85"]]},{"id":"252aa218.cc297e","type":"switch","z":"5026c83e.b368c8","name":"","property":"payload.val","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":423,"y":1044,"wires":[["592b80ce.9cd"],["6f53fb71.303594"]]},{"id":"6f53fb71.303594","type":"function","z":"5026c83e.b368c8","name":"targetValue 0","func":"msg.payload = {'id':811, 'value': 0}\n\nreturn msg;","outputs":1,"noerr":0,"x":559,"y":1060,"wires":[["39ff78cc.73d728"]]},{"id":"b0e37df5.831fe","type":"change","z":"5026c83e.b368c8","name":"off","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1013,"y":1059,"wires":[["39451fce.b2a85"]]},{"id":"39451fce.b2a85","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/actions/linkareas","topic":"instar/local/alarm/actions/linkareas/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":1189,"y":1017,"wires":[]},{"id":"7c6cc24d.e1e1ac","type":"mqtt in","z":"5026c83e.b368c8","name":"status/alarm/push/enable","topic":"instar/local/status/alarm/push/enable","qos":"1","datatype":"auto","broker":"996228fe.ababc8","x":115,"y":1126,"wires":[["34d6eda3.7f2a82"]]},{"id":"34d6eda3.7f2a82","type":"json","z":"5026c83e.b368c8","name":"","property":"payload","action":"","pretty":false,"x":295,"y":1126,"wires":[["f87641d6.d1a5e"]]},{"id":"7a5c213d.431b5","type":"function","z":"5026c83e.b368c8","name":"targetValue 1","func":"msg.payload = {'id':812, 'value': 1}\n\nreturn msg;","outputs":1,"noerr":0,"x":545,"y":1106,"wires":[["8818aa9c.9d1588"]]},{"id":"8818aa9c.9d1588","type":"homeeDevice","z":"5026c83e.b368c8","virtual-homee":"","name":"INSTAR Push","nodeId":"8","profile":"10","icon":"nodeicon_motiondetector","attributes":"[{\"id\":812,\"node_id\":8,\"instance\":0,\"minimum\":0,\"maximum\":1,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"Push\",\"step_value\":1,\"editable\":1,\"type\":1,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"}]","x":714,"y":1125,"wires":[["45d8636f.f34b2c"]]},{"id":"45d8636f.f34b2c","type":"switch","z":"5026c83e.b368c8","name":"","property":"payload.targetValue","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":861,"y":1125,"wires":[["56cb2536.c0493c"],["ab06f670.eb3c28"]]},{"id":"56cb2536.c0493c","type":"change","z":"5026c83e.b368c8","name":"on","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":975,"y":1105,"wires":[["72036965.0a3de8"]]},{"id":"f87641d6.d1a5e","type":"switch","z":"5026c83e.b368c8","name":"","property":"payload.val","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":409,"y":1126,"wires":[["7a5c213d.431b5"],["6b3bdf8b.a29c3"]]},{"id":"6b3bdf8b.a29c3","type":"function","z":"5026c83e.b368c8","name":"targetValue 0","func":"msg.payload = {'id':812, 'value': 0}\n\nreturn msg;","outputs":1,"noerr":0,"x":545,"y":1142,"wires":[["8818aa9c.9d1588"]]},{"id":"ab06f670.eb3c28","type":"change","z":"5026c83e.b368c8","name":"off","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":977,"y":1141,"wires":[["72036965.0a3de8"]]},{"id":"72036965.0a3de8","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/push/enable","topic":"instar/local/alarm/push/enable/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":1133,"y":1122,"wires":[]},{"id":"a09fcd00.a4abe","type":"mqtt in","z":"5026c83e.b368c8","name":"status/alarm/alarmserver/enable","topic":"instar/local/status/alarm/alarmserver/enable","qos":"1","datatype":"auto","broker":"996228fe.ababc8","x":136,"y":1206,"wires":[["e7411f79.18fd9"]]},{"id":"e7411f79.18fd9","type":"json","z":"5026c83e.b368c8","name":"","property":"payload","action":"","pretty":false,"x":331,"y":1206,"wires":[["8bd12c62.43983"]]},{"id":"dbc80338.521d2","type":"function","z":"5026c83e.b368c8","name":"targetValue 1","func":"msg.payload = {'id':813, 'value': 1}\n\nreturn msg;","outputs":1,"noerr":0,"x":581,"y":1186,"wires":[["999fa34a.93a35"]]},{"id":"999fa34a.93a35","type":"homeeDevice","z":"5026c83e.b368c8","virtual-homee":"","name":"INSTAR Alarmserver","nodeId":"9","profile":"10","icon":"nodeicon_motiondetector","attributes":"[{\"id\":813,\"node_id\":9,\"instance\":0,\"minimum\":0,\"maximum\":1,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"Push\",\"step_value\":1,\"editable\":1,\"type\":1,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"}]","x":770,"y":1205,"wires":[["ca817911.e36f58"]]},{"id":"ca817911.e36f58","type":"switch","z":"5026c83e.b368c8","name":"","property":"payload.targetValue","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":934,"y":1205,"wires":[["71b7bc45.e0e784"],["e7879bc3.ae0cf8"]]},{"id":"71b7bc45.e0e784","type":"change","z":"5026c83e.b368c8","name":"on","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1048,"y":1185,"wires":[["1e783ce9.a961a3"]]},{"id":"8bd12c62.43983","type":"switch","z":"5026c83e.b368c8","name":"","property":"payload.val","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":445,"y":1206,"wires":[["dbc80338.521d2"],["8d9c7ef0.678b3"]]},{"id":"8d9c7ef0.678b3","type":"function","z":"5026c83e.b368c8","name":"targetValue 0","func":"msg.payload = {'id':813, 'value': 0}\n\nreturn msg;","outputs":1,"noerr":0,"x":581,"y":1222,"wires":[["999fa34a.93a35"]]},{"id":"e7879bc3.ae0cf8","type":"change","z":"5026c83e.b368c8","name":"off","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":1221,"wires":[["1e783ce9.a961a3"]]},{"id":"1e783ce9.a961a3","type":"mqtt out","z":"5026c83e.b368c8","name":"alarm/alarmserver/enable","topic":"instar/local/alarm/alarmserver/enable/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":1226,"y":1179,"wires":[]},{"id":"946f44ca.1b2288","type":"function","z":"5026c83e.b368c8","name":"targetValue","func":"msg.payload = {'id':814, 'value': 0}\n\nreturn msg;","outputs":1,"noerr":0,"x":226,"y":1352,"wires":[["993c72f.289539"]]},{"id":"993c72f.289539","type":"homeeDevice","z":"5026c83e.b368c8","virtual-homee":"","name":"INSTAR Reboot","nodeId":"10","profile":"10","icon":"nodeicon_motiondetector","attributes":"[{\"id\":814,\"node_id\":10,\"instance\":0,\"minimum\":0,\"maximum\":1,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"Reboot\",\"step_value\":1,\"editable\":1,\"type\":1,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"}]","x":395,"y":1352,"wires":[["df89cbe2.44e028","637dcf38.9531d"]]},{"id":"27082f76.c2bca","type":"mqtt out","z":"5026c83e.b368c8","name":"system/reboot","topic":"instar/local/system/reboot/raw","qos":"1","retain":"false","broker":"996228fe.ababc8","x":751,"y":1352,"wires":[]},{"id":"df89cbe2.44e028","type":"delay","z":"5026c83e.b368c8","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":79,"y":1352,"wires":[["946f44ca.1b2288"]]},{"id":"637dcf38.9531d","type":"change","z":"5026c83e.b368c8","name":"1","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":602,"y":1352,"wires":[["27082f76.c2bca"]]},{"id":"996228fe.ababc8","type":"mqtt-broker","z":"","name":"INSTAR MQTT","broker":"192.168.2.117","port":"1883","clientid":"iored","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]