Skip to content

Instantly share code, notes, and snippets.

@mschm

mschm/README.md Secret

Created November 21, 2016 01:00
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mschm/c32cf0a0f6f556ba62aa726815369059 to your computer and use it in GitHub Desktop.
Save mschm/c32cf0a0f6f556ba62aa726815369059 to your computer and use it in GitHub Desktop.
A simple Siri-Switch (Node-RED + Dashboard + HomeKit)

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

The contained Flow consists of two nodes: a HomeKit Service node and a UI Switch node. They are wired as a closed loop, so they provide each other with feedback.

In this example the HomeKit node is paired with the displayed iPhone. So when the user changes the switch in the iOS Home App the new state is being propagated to the UI node in Node-RED. This even supports Siri voice control with no further setup involved :)

Flow in action

[
{
"id": "9f2fd2c1.5ad08",
"type": "tab",
"label": "HomeKit Demo"
},
{
"id": "287b69aa.05ea66",
"type": "homekit-service",
"z": "9f2fd2c1.5ad08",
"accessory": "d1e30622.0d3aa8",
"name": "Switch",
"serviceName": "Switch",
"x": 270,
"y": 200,
"wires": [
[
"37233ce8.cc8c34"
]
]
},
{
"id": "37233ce8.cc8c34",
"type": "ui_switch",
"z": "9f2fd2c1.5ad08",
"name": "",
"label": "Switch",
"group": "bb0e754e.70b108",
"order": 0,
"width": 0,
"height": 0,
"passthru": false,
"topic": "",
"style": "",
"onvalue": "{\"On\":true}",
"onvalueType": "json",
"onicon": "",
"oncolor": "",
"offvalue": "{\"On\":false}",
"offvalueType": "json",
"officon": "",
"offcolor": "",
"x": 280,
"y": 100,
"wires": [
[
"287b69aa.05ea66"
]
]
},
{
"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"
}
]
@stsmmodou
Copy link

Great job

@MattL0
Copy link

MattL0 commented Aug 23, 2018

nice.

I am new to homekit integration by node red.

what would i hve to do if i want to control a switch with dimming ? from my automation software via mqtt?

@MattL0
Copy link

MattL0 commented Aug 23, 2018

by the way your exemple work 100%on my phone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment