Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HentschelT/64b3b2b8d1c345ff425ba3d32d76f444 to your computer and use it in GitHub Desktop.
Save HentschelT/64b3b2b8d1c345ff425ba3d32d76f444 to your computer and use it in GitHub Desktop.
Kwiklock 910 zwave openhab2 nodered homebridge
[
{
"id": "1011ec1c.0424c4",
"type": "tab",
"label": "Door Lock",
"disabled": false,
"info": ""
},
{
"id": "1e9a99ae.9237c6",
"type": "homekit-service",
"z": "1011ec1c.0424c4",
"accessory": "b6e69c95.c0e34",
"name": "Front Door",
"serviceName": "Door",
"x": 570,
"y": 240,
"wires": [
[
"a6e0ef59.df747"
]
]
},
{
"id": "481aec0d.9c2074",
"type": "openhab2-in",
"z": "1011ec1c.0424c4",
"name": "Door Actuator Status",
"controller": "7d1f23c6.a5c3cc",
"itemname": "DoorLockActuator",
"x": 180,
"y": 140,
"wires": [
[
"9ab32071.0a688"
],
[]
]
},
{
"id": "f7c56a11.bb3ad8",
"type": "openhab2-out",
"z": "1011ec1c.0424c4",
"name": "Door Lock Actuator",
"controller": "7d1f23c6.a5c3cc",
"itemname": "DoorLockActuator",
"topic": "ItemCommand",
"payload": "",
"x": 910,
"y": 340,
"wires": []
},
{
"id": "5ad6cb54.156314",
"type": "function",
"z": "1011ec1c.0424c4",
"name": "2 OHAB",
"func": "if(msg.payload.TargetPosition === null) {\n return\n}\n\nif(msg.payload.TargetPosition == 0) {\n msg.payload = \"ON\";\n}\n\nif(msg.payload.TargetPosition == 100) {\n msg.payload = \"OFF\";\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 700,
"y": 340,
"wires": [
[
"f7c56a11.bb3ad8"
]
]
},
{
"id": "919217e0.256c58",
"type": "function",
"z": "1011ec1c.0424c4",
"name": "2 HK",
"func": "var sensor = flow.get('doorlock-sensor');\nvar actuator = flow.get('doorlock-actuator');\n\nif(actuator == null && sensor == null) {\n return;\n}\n\nif(actuator == null) {\n if(sensor == \"ON\") {\n msg = {\n \"payload\":\n {\n \"CurrentPosition\": 0\n }};\n }\n if(sensor == \"OFF\") {\n msg = {\n \"payload\":\n {\n \"CurrentPosition\": 100\n }};\n }\n}\n\nif(sensor == null) {\n if(actuator == \"ON\") {\n msg = {\n \"payload\":\n {\n \"TargetPosition\": 0\n }};\n }\n if(actuator == \"OFF\") {\n msg = {\n \"payload\":\n {\n \"TargetPosition\": 100\n }};\n }\n}\n\nif(sensor == \"ON\") {\n if(actuator == \"ON\") {\n msg = {\n \"payload\":\n {\n \"TargetPosition\": 0,\n \"CurrentPosition\": 0\n }};\n }\n if(actuator == \"OFF\") {\n msg = {\n \"payload\":\n {\n \"TargetPosition\": 100,\n \"CurrentPosition\": 0\n }};\n }\n}\n\nif(sensor == \"OFF\") {\n if(actuator == \"ON\") {\n msg = {\n \"payload\":\n {\n \"TargetPosition\": 0,\n \"CurrentPosition\": 100\n }};\n }\n if(actuator == \"OFF\") {\n msg = {\n \"payload\":\n {\n \"TargetPosition\": 100,\n \"CurrentPosition\": 100\n }};\n }\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 390,
"y": 240,
"wires": [
[
"1e9a99ae.9237c6"
]
]
},
{
"id": "a6e0ef59.df747",
"type": "switch",
"z": "1011ec1c.0424c4",
"name": "triggered by HK?",
"property": "hap.context",
"propertyType": "msg",
"rules": [
{
"t": "nnull"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 510,
"y": 340,
"wires": [
[
"5ad6cb54.156314"
]
]
},
{
"id": "5845e584.601b1c",
"type": "inject",
"z": "1011ec1c.0424c4",
"name": "Lock",
"topic": "",
"payload": "ON",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 690,
"y": 400,
"wires": [
[
"f7c56a11.bb3ad8"
]
]
},
{
"id": "26b6a0fa.2075a",
"type": "inject",
"z": "1011ec1c.0424c4",
"name": "Unock",
"topic": "",
"payload": "OFF",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 690,
"y": 440,
"wires": [
[
"f7c56a11.bb3ad8"
]
]
},
{
"id": "89141d6c.e5003",
"type": "openhab2-in",
"z": "1011ec1c.0424c4",
"name": "Door Lock Status",
"controller": "7d1f23c6.a5c3cc",
"itemname": "DoorLockStatus",
"x": 160,
"y": 340,
"wires": [
[
"c09c2da3.f016b"
],
[]
]
},
{
"id": "9ab32071.0a688",
"type": "function",
"z": "1011ec1c.0424c4",
"name": "store state",
"func": "var state = msg.payload;\nflow.set('doorlock-actuator', state);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 190,
"y": 220,
"wires": [
[
"919217e0.256c58"
]
]
},
{
"id": "c09c2da3.f016b",
"type": "function",
"z": "1011ec1c.0424c4",
"name": "store state",
"func": "var state = msg.payload;\n\nif(state == \"0\") {\n return;\n} \n\nvar result = \"OFF\";\nif(state == \"21\" || state == \"27\" || state == \"24\") {\n result = \"ON\";\n} \nif(state == \"0\") {\n} \nflow.set('doorlock-sensor', result);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 190,
"y": 260,
"wires": [
[
"919217e0.256c58",
"fa8949b0.b73898"
]
]
},
{
"id": "5a04d0be.19e63",
"type": "openhab2-out",
"z": "1011ec1c.0424c4",
"name": "Door Lock State Update",
"controller": "7d1f23c6.a5c3cc",
"itemname": "DoorLockActuator",
"topic": "ItemUpdate",
"payload": "",
"x": 890,
"y": 100,
"wires": []
},
{
"id": "fa8949b0.b73898",
"type": "function",
"z": "1011ec1c.0424c4",
"name": "update actuator",
"func": "var sensor = flow.get('doorlock-sensor');\nif(sensor != null) {\n msg.payload = sensor;\n return msg;\n}\n",
"outputs": 1,
"noerr": 0,
"x": 460,
"y": 100,
"wires": [
[
"5a04d0be.19e63"
]
]
},
{
"id": "b6e69c95.c0e34",
"type": "homekit-accessory",
"z": "",
"accessoryName": "Front Door",
"pinCode": "192-29-345",
"port": "",
"manufacturer": "KwickLock",
"model": "910",
"serialNo": "007-007",
"accessoryType": "6"
},
{
"id": "7d1f23c6.a5c3cc",
"type": "openhab2-controller",
"z": "",
"name": "ohab",
"protocol": "http",
"host": "localhost",
"port": "8080",
"path": "",
"username": "",
"password": ""
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment