Skip to content

Instantly share code, notes, and snippets.

@jonathanschneider
Created May 12, 2018 05:49
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 jonathanschneider/a30313e28ff5cff0f509fd48063b0cf8 to your computer and use it in GitHub Desktop.
Save jonathanschneider/a30313e28ff5cff0f509fd48063b0cf8 to your computer and use it in GitHub Desktop.
Part of my HomeKit flow to control my home entertainment devices
[
{
"id": "28abe33e.a8201c",
"type": "homekit-service",
"z": "42846943.2b4b38",
"bridge": "99f4cba3.7a5b5",
"name": "Verstärker",
"serviceName": "Outlet",
"manufacturer": "Jon",
"model": "111",
"serialNo": "111",
"characteristicProperties": "",
"x": 500,
"y": 120,
"wires": [
[
"bff884f8.593bc",
"d171a6dd.42196"
]
]
},
{
"id": "bff884f8.593bc",
"type": "function",
"z": "42846943.2b4b38",
"name": "ControlDevices",
"func": "msgTV = {};\nmsgHTS = {};\nmsgAppleTV = {}\n\n// On command from Alexa or HomeKit\nif (msg.payload === \"on\" ||\n(msg.payload.On === true && msg.hap.context !== undefined)) { \n msgTV.payload = \"POWER_OFF\";\n msgHTS.payload = \"POWER_ON\\\" \\\"INPUT_AUX\";\n msgAppleTV.payload = \"echo \\\"tx 14:44:6C\\\" | cec-client -s -d 1\";\n \n // Return messages\n return [msgTV, msgHTS, msgAppleTV];\n}\n\n// Off command from Alexa or HomeKit\nelse if (msg.payload == \"off\" ||\n(msg.payload.On === false && msg.hap.context !== undefined)) {\n msgTV.payload = \"POWER_OFF\";\n msgHTS.payload = \"POWER_OFF\";\n \n // Return messages\n return [msgTV, msgHTS];\n}",
"outputs": 3,
"noerr": 0,
"x": 700,
"y": 80,
"wires": [
[
"5e2b4afa.867594",
"1e4c8c87.edeccb"
],
[
"f949afeb.7e63f",
"e9f8ef46.c06dd"
],
[
"5a4f49f8.537c08"
]
],
"outputLabels": [
"TV",
"HTS",
"AppleTV"
]
},
{
"id": "df0a28b8.f4b458",
"type": "function",
"z": "42846943.2b4b38",
"name": "WemoToHK",
"func": "msg.payload = {\"On\": (msg.payload === \"on\") ? true : false};\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 310,
"y": 120,
"wires": [
[
"28abe33e.a8201c"
]
]
},
{
"id": "5e2b4afa.867594",
"type": "delay",
"z": "42846943.2b4b38",
"name": "DelayTV",
"pauseType": "delay",
"timeout": "10",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 1000,
"y": 40,
"wires": [
[
"1e4c8c87.edeccb"
]
]
},
{
"id": "f949afeb.7e63f",
"type": "delay",
"z": "42846943.2b4b38",
"name": "DelayHTS",
"pauseType": "delay",
"timeout": "20",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 1000,
"y": 380,
"wires": [
[
"e9f8ef46.c06dd"
]
]
},
{
"id": "1e4c8c87.edeccb",
"type": "lirc-out",
"z": "42846943.2b4b38",
"name": "TV",
"controller": "db766e67.d86a7",
"device": "lg-tv",
"output": "1",
"x": 1230,
"y": 140,
"wires": []
},
{
"id": "e9f8ef46.c06dd",
"type": "lirc-out",
"z": "42846943.2b4b38",
"name": "HTS",
"controller": "db766e67.d86a7",
"device": "lg-hts",
"output": "1",
"x": 1230,
"y": 200,
"wires": []
},
{
"id": "5a4f49f8.537c08",
"type": "exec",
"z": "42846943.2b4b38",
"command": "",
"addpay": true,
"append": "",
"useSpawn": "false",
"timer": "",
"oldrc": false,
"name": "AppleTV",
"x": 1240,
"y": 260,
"wires": [
[],
[],
[]
]
},
{
"id": "99f4cba3.7a5b5",
"type": "homekit-bridge",
"z": "",
"bridgeName": "RaspberryPi",
"pinCode": "111-11-111",
"port": "",
"manufacturer": "Default Manufacturer",
"model": "Default Model",
"serialNo": "Default Serial Number"
},
{
"id": "db766e67.d86a7",
"type": "lirc-controller",
"z": "",
"name": "lirc-controller"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment