I wanted to be able to react to the sensors on the QolSys panel. In my use case, I want to turn on certain lights when certain doors are open.
Using @mzac’s curl command above I made a Node-Red flow to monitor the zones and call HA actions. It’s not a complex thing, but anyone searching might find it useful.
[
{
"id": "cbfaf013.0e5e",
"type": "tab",
"label": "Monitor QolSys Panel",
"disabled": false,
"info": ""
},
{
"id": "a92cf1.8c434b1",
"type": "inject",
"z": "cbfaf013.0e5e",
"name": "go",
"props": [],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"x": 90,
"y": 100,
"wires": [
[
"df1b46c2.dc0748"
]
]
},
{
"id": "df1b46c2.dc0748",
"type": "exec",
"z": "cbfaf013.0e5e",
"command": "curl -kN --http0.9 https://192.168.10.34:12345",
"addpay": true,
"append": "",
"useSpawn": "true",
"timer": "",
"oldrc": false,
"name": "curl",
"x": 110,
"y": 180,
"wires": [
[
"1f5ac981.6ccdde",
"1edaf367.8f44ed"
],
[
"f17d89c8.de8bf"
],
[
"cf10d274.0242e"
]
]
},
{
"id": "cf10d274.0242e",
"type": "debug",
"z": "cbfaf013.0e5e",
"name": "return (exit) codes",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1110,
"y": 120,
"wires": []
},
{
"id": "1f5ac981.6ccdde",
"type": "debug",
"z": "cbfaf013.0e5e",
"name": "activity events and updates",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1140,
"y": 32,
"wires": []
},
{
"id": "f17d89c8.de8bf",
"type": "debug",
"z": "cbfaf013.0e5e",
"name": "Just outputs the curl progress, not the actual output",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1220,
"y": 76,
"wires": []
},
{
"id": "8cb8b681.b122f8",
"type": "status",
"z": "cbfaf013.0e5e",
"name": "",
"scope": [
"df1b46c2.dc0748"
],
"x": 80,
"y": 460,
"wires": [
[
"aff08d86.5d518",
"67092ad5.c80174"
]
]
},
{
"id": "aff08d86.5d518",
"type": "debug",
"z": "cbfaf013.0e5e",
"name": "pid",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 990,
"y": 540,
"wires": []
},
{
"id": "67092ad5.c80174",
"type": "switch",
"z": "cbfaf013.0e5e",
"name": "get pid",
"property": "pid",
"propertyType": "flow",
"rules": [
{
"t": "eq",
"v": "$text = $split($lookup(payload.status, \"text\"), \":\")\t\t$prid = $text[1]",
"vt": "jsonata"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 200,
"y": 520,
"wires": [
[]
]
},
{
"id": "1edaf367.8f44ed",
"type": "switch",
"z": "cbfaf013.0e5e",
"name": "Ignore ACK",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "cont",
"v": "ACK",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 230,
"y": 240,
"wires": [
[],
[
"9a07870e.d047d8"
]
]
},
{
"id": "9a07870e.d047d8",
"type": "json",
"z": "cbfaf013.0e5e",
"name": "convert update to json",
"property": "payload",
"action": "",
"pretty": true,
"x": 420,
"y": 240,
"wires": [
[
"9c24717d.c5031",
"6d8421cd.eae33"
]
]
},
{
"id": "9c24717d.c5031",
"type": "debug",
"z": "cbfaf013.0e5e",
"name": "converted json",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1060,
"y": 160,
"wires": []
},
{
"id": "e535c607.f893f8",
"type": "api-call-service",
"z": "cbfaf013.0e5e",
"name": "",
"server": "8ab3acad.bd0fb",
"version": 1,
"debugenabled": true,
"service_domain": "",
"service": "",
"entityId": "",
"data": "",
"dataType": "json",
"mergecontext": "",
"output_location": "",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 670,
"y": 300,
"wires": [
[]
]
},
{
"id": "6d8421cd.eae33",
"type": "function",
"z": "cbfaf013.0e5e",
"name": "put entity_ids in msg",
"func": "zid = msg.payload[\"zone\"][\"zone_id\"]\nzstatus = msg.payload[\"zone\"][\"status\"]\nentity_ids = []\nswitch (zid) {\n case 1:\n entity_ids = [\n \"switch.s_front_door_outside\", \n \"switch.s_front_door_overhead\",\n \"switch.s_outside_garage_lights\"\n ]\n break\n case 3:\n entity_ids = [\n \"switch.s_neela_s_entry_light\", \n \"switch.s_neela_s_garage_lights\"\n ]\n break\n case 4:\n entity_ids = [\n \"switch.s_roopesh_s_garage_lights_al\", \n \"switch.s_roopesh_s_entry_light\"\n ]\n break\n}\n\n//node.warn(\"zid: \" + zid + \", status: \" + zstatus + \", entities: \" + entity_ids)\n\nmsg.entity_ids = entity_ids\nnode.warn(msg)\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 660,
"y": 240,
"wires": [
[
"929374ec.595c48",
"ed36d599.984728"
]
]
},
{
"id": "7b5ce640.877ee8",
"type": "template",
"z": "cbfaf013.0e5e",
"name": "json for HA",
"field": "payload",
"fieldType": "msg",
"format": "json",
"syntax": "mustache",
"template": "{\n \"domain\":\"switch\",\n \"service\":\"turn_on\",\n \"data\":\n {\n \"entity_id\":\"{{payload}}\"\n }\n}",
"output": "json",
"x": 450,
"y": 320,
"wires": [
[
"e535c607.f893f8",
"aad1aaf7.b1c3e8",
"929374ec.595c48"
]
]
},
{
"id": "929374ec.595c48",
"type": "array-loop",
"z": "cbfaf013.0e5e",
"name": "loop entity_ids",
"key": "al929374ec595c48",
"keyType": "msg",
"reset": true,
"resetValue": "value-null",
"array": "entity_ids",
"arrayType": "msg",
"x": 220,
"y": 300,
"wires": [
[
"1a32f917.444eb7"
],
[
"7b5ce640.877ee8",
"c2a3cc7c.d5ef1"
]
]
},
{
"id": "aad1aaf7.b1c3e8",
"type": "debug",
"z": "cbfaf013.0e5e",
"name": "json for HA",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1050,
"y": 380,
"wires": []
},
{
"id": "c2a3cc7c.d5ef1",
"type": "debug",
"z": "cbfaf013.0e5e",
"name": "looped payload",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1000,
"y": 500,
"wires": []
},
{
"id": "1a32f917.444eb7",
"type": "debug",
"z": "cbfaf013.0e5e",
"name": "end of loop payload",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1040,
"y": 440,
"wires": []
},
{
"id": "ed36d599.984728",
"type": "debug",
"z": "cbfaf013.0e5e",
"name": "added entity ids",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1050,
"y": 320,
"wires": []
},
{
"id": "8ab3acad.bd0fb",
"type": "server",
"name": "Home Assistant",
"legacy": false,
"addon": true,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": false,
"cacheJson": true
}
]