Skip to content

Instantly share code, notes, and snippets.

@mschm

mschm/README.md Secret

Created November 21, 2016 01:52
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 mschm/d3987e403d3b65639fe90359ac8038cd to your computer and use it in GitHub Desktop.
Save mschm/d3987e403d3b65639fe90359ac8038cd to your computer and use it in GitHub Desktop.
A simulated Garage (Node-RED + Dashboard + HomeKit)

This flow demonstrates basic interaction between Node-RED and HomeKit.

The contained Flow consists of a HomeKit Garage-Service node, two UI Switch nodes that represent the garage's closed and locked state and a UI Notification node, that displays opening/closing commands.

In this example the HomeKit node is paired with the displayed iPhone. So when the user asks to open or close her garage in the iOS Home App the new state is being propagated to the UI Notification node in Node-RED.

Siri voice control is also supported without further setup required. Just ask Siri to "open the garage".

Flow in action

[
{
"id": "9f2fd2c1.5ad08",
"type": "tab",
"label": "HomeKit Demo"
},
{
"id": "287b69aa.05ea66",
"type": "homekit-service",
"z": "9f2fd2c1.5ad08",
"accessory": "d1e30622.0d3aa8",
"name": "Garage",
"serviceName": "GarageDoorOpener",
"x": 280,
"y": 220,
"wires": [
[
"f9a936b9.2770b8"
]
]
},
{
"id": "37233ce8.cc8c34",
"type": "ui_switch",
"z": "9f2fd2c1.5ad08",
"name": "",
"label": "Garage is locked",
"group": "bb0e754e.70b108",
"order": 0,
"width": 0,
"height": 0,
"passthru": false,
"topic": "",
"style": "",
"onvalue": "{\"LockCurrentState\":true}",
"onvalueType": "json",
"onicon": "",
"oncolor": "",
"offvalue": "{\"LockCurrentState\":false}",
"offvalueType": "json",
"officon": "",
"offcolor": "",
"x": 250,
"y": 140,
"wires": [
[
"287b69aa.05ea66"
]
]
},
{
"id": "5ddf1232.47b404",
"type": "ui_toast",
"z": "9f2fd2c1.5ad08",
"position": "top right",
"displayTime": "3",
"name": "",
"x": 330,
"y": 340,
"wires": []
},
{
"id": "4058d217.9b6b84",
"type": "ui_switch",
"z": "9f2fd2c1.5ad08",
"name": "",
"label": "Garage is closed",
"group": "bb0e754e.70b108",
"order": 0,
"width": 0,
"height": 0,
"passthru": false,
"topic": "",
"style": "",
"onvalue": "{\"CurrentDoorState\":true}",
"onvalueType": "json",
"onicon": "",
"oncolor": "",
"offvalue": "{\"CurrentDoorState\":false}",
"offvalueType": "json",
"officon": "",
"offcolor": "",
"x": 250,
"y": 180,
"wires": [
[
"287b69aa.05ea66"
]
]
},
{
"id": "f9a936b9.2770b8",
"type": "switch",
"z": "9f2fd2c1.5ad08",
"name": "",
"property": "payload.TargetDoorState",
"propertyType": "msg",
"rules": [
{
"t": "nnull"
}
],
"checkall": "true",
"outputs": 1,
"x": 290,
"y": 300,
"wires": [
[
"5ddf1232.47b404"
]
]
},
{
"id": "d1e30622.0d3aa8",
"type": "homekit-accessory",
"z": "",
"accessoryName": "Connector",
"pinCode": "111-11-111",
"port": "",
"manufacturer": "Default Manufacturer",
"model": "Default Model",
"serialNo": "Default Serial Number"
},
{
"id": "bb0e754e.70b108",
"type": "ui_group",
"z": "",
"name": "Default",
"tab": "77efcdfa.edd224",
"disp": false,
"width": "6"
},
{
"id": "77efcdfa.edd224",
"type": "ui_tab",
"z": "",
"name": "HomeKit",
"icon": "dashboard"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment