Intelligent scenes using HomeKit, openHAB, and node-RED

I like the concept of scenes. I work variable schedule shift work, and with young children added in the mix our routines are very difficult to automate. Scenes provide a convenient way to send batch commands to large number of devices.

As a fan of Apple products, I am tempted to use the HomeKit scenes, as they provide convenient access via Siri and via apps on my watch, phone, and computer. In particular, the HomeRun app on my Apple Watch serves as a convenient remote control for my home.

However, when the scene logic resides within the Home app, there are several problems. First, the HomeKit items have a habit of periodically resetting themselves, breaking my automations and causing a lot of repeat setup work. Second, openHAB is unable to take part in the setting of scenes in this scenario. This makes it difficult to work HABpanel into my control scheme, which is unfortunate since it’s such a great tool and I have several devices set up and available to my family.

In order to solve these problems, I came up with the following approach using node-RED, openHAB, and HomeKit:

  • node-RED contains the scene logic
  • openHAB has scene dimmer item, one for each zone or area that is to be controlled
  • HomeKit has a dimmer item for each corresponding item in openHAB

The result is very intuitive and seamless. When I want to sit down to dinner with my family, I can either ask Siri on my watch, press a button on HABpanel, or make a selection in the openHAB phone app. The result is the same: the lights adjust to the preset appropriate levels.

In order to implement this, you’ll need to have a working node-RED installation that is connected to openHAB and HomeKit. I also use and recommend the Gate node. Recommended reading:

I have a pretty complex scenes setup at this point, so I’m going to provide a snapshot of it for the purposes of demonstration. I included four scenes from level 3 (I live in a split, not a mansion house :grinning:).

Items:

Dimmer  S_SYSP_SceneL3   (Group_HabPanel_Dashboard)      

node-RED flow:

[
    {
        "id": "68d4a16b.219e28",
        "type": "tab",
        "label": "Demo",
        "disabled": false,
        "info": ""
    },
    {
        "id": "7644c54e.e076fc",
        "type": "openhab2-in",
        "z": "68d4a16b.219e28",
        "name": "",
        "controller": "e80889f5.d5d3c",
        "itemname": "S_SYSP_SceneL3",
        "x": 150,
        "y": 100,
        "wires": [
            [
                "b194e02c.8fa5"
            ],
            []
        ]
    },
    {
        "id": "b194e02c.8fa5",
        "type": "delay",
        "z": "68d4a16b.219e28",
        "name": "",
        "pauseType": "rate",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "5",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 340,
        "y": 100,
        "wires": [
            [
                "f34fcb43.75bb7"
            ]
        ]
    },
    {
        "id": "f34fcb43.75bb7",
        "type": "gate",
        "z": "68d4a16b.219e28",
        "name": "",
        "controlTopic": "control",
        "defaultState": "closed",
        "openCmd": "open",
        "closeCmd": "close",
        "toggleCmd": "toggle",
        "defaultCmd": "default",
        "persist": false,
        "x": 510,
        "y": 100,
        "wires": [
            [
                "161d5763.1a8ae9",
                "26f5490c.7954f6"
            ]
        ]
    },
    {
        "id": "161d5763.1a8ae9",
        "type": "function",
        "z": "68d4a16b.219e28",
        "name": "OH to HK",
        "func": "var input = msg.payload;\nif (input < 101){\n    if (input < 1) {\n        msg.payload = {\n        \"On\": false\n    }\n    }\n    else {\n        msg.payload = {\n        \"Brightness\": input,\n        //\"On\": true\n    }\n    }\n    return msg;\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 660,
        "y": 100,
        "wires": [
            [
                "eeb09538.2b936"
            ]
        ]
    },
    {
        "id": "26f5490c.7954f6",
        "type": "switch",
        "z": "68d4a16b.219e28",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "0",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "30",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "33",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "48",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "57",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 5,
        "x": 670,
        "y": 260,
        "wires": [
            [
                "ffb96108.6fec8"
            ],
            [
                "fdc331b3.999af8"
            ],
            [
                "5a6c1592.6647a4"
            ],
            [
                "13c33928.694c47"
            ],
            [
                "887082f3.3ba72"
            ]
        ]
    },
    {
        "id": "eeb09538.2b936",
        "type": "homekit-service",
        "z": "68d4a16b.219e28",
        "isParent": true,
        "bridge": "d9992c49.b8d12",
        "parentService": "",
        "name": "SceneL3",
        "serviceName": "Lightbulb",
        "topic": "",
        "filter": false,
        "manufacturer": "Scene Interop",
        "model": "V1",
        "serialNo": "Virtual",
        "cameraConfigVideoProcessor": "",
        "cameraConfigSource": "",
        "cameraConfigStillImageSource": "",
        "cameraConfigMaxStreams": "",
        "cameraConfigMaxWidth": "",
        "cameraConfigMaxHeight": "",
        "cameraConfigMaxFPS": "",
        "cameraConfigMaxBitrate": "",
        "cameraConfigVideoCodec": "",
        "cameraConfigAudioCodec": "",
        "cameraConfigAudio": false,
        "cameraConfigPacketSize": "",
        "cameraConfigVerticalFlip": false,
        "cameraConfigHorizontalFlip": false,
        "cameraConfigMapVideo": "",
        "cameraConfigMapAudio": "",
        "cameraConfigVideoFilter": "",
        "cameraConfigAdditionalCommandLine": "",
        "cameraConfigDebug": false,
        "characteristicProperties": "{\"Brightness\":true}",
        "x": 800,
        "y": 100,
        "wires": [
            [
                "dc46953d.cb38f"
            ],
            []
        ],
        "inputLabels": [
            "{\"Brightness\":true}"
        ]
    },
    {
        "id": "ffb96108.6fec8",
        "type": "link out",
        "z": "68d4a16b.219e28",
        "name": "L3 OFF",
        "links": [
            "1f7d8941.53de1f",
            "fb5d0d54.25a81",
            "7d0311d7.c6c67",
            "5c269343.0a83cc",
            "78cb1bae.d0d94c",
            "af06b38.46c6e5",
            "f7d838a2.aaf9b",
            "7f43dff5.29313"
        ],
        "x": 875,
        "y": 180,
        "wires": []
    },
    {
        "id": "fdc331b3.999af8",
        "type": "link out",
        "z": "68d4a16b.219e28",
        "name": "L3 Ambient",
        "links": [
            "8e02ae9c.abbac8",
            "ed4bf8e2.81ee38",
            "fd1e0ae3.910fb8",
            "f99b42bd.751e",
            "c9b40d26.b46bc8",
            "a4e39d52.f4b58"
        ],
        "x": 875,
        "y": 220,
        "wires": []
    },
    {
        "id": "5a6c1592.6647a4",
        "type": "link out",
        "z": "68d4a16b.219e28",
        "name": "L3 Bright",
        "links": [
            "5f58796c.318bd",
            "945f546b.a771f",
            "6d57cc3c.5b60d4",
            "b9977817.fbf3c8",
            "a77e2973.3170a8",
            "3073790.c8a7588",
            "11207a90.b9670d",
            "9cc17d9f.89ed08",
            "b6a68456.3137b8",
            "df86de6d.79ee3"
        ],
        "x": 875,
        "y": 260,
        "wires": []
    },
    {
        "id": "13c33928.694c47",
        "type": "link out",
        "z": "68d4a16b.219e28",
        "name": "L3 Dining",
        "links": [
            "a213eea0.d1bbf8",
            "cc8b77d3.834488",
            "ec49121c.794148",
            "10bcef81.5c1308",
            "9380f794.e82eb",
            "cc4acba9.4dc0e8",
            "427a2a0a.d1216c",
            "e82dbc15.b25a5"
        ],
        "x": 875,
        "y": 300,
        "wires": []
    },
    {
        "id": "887082f3.3ba72",
        "type": "link out",
        "z": "68d4a16b.219e28",
        "name": "L3 Party",
        "links": [
            "94763760.ed6238",
            "575e1907.4cfb88",
            "b7f355d2.58d08"
        ],
        "x": 875,
        "y": 340,
        "wires": []
    },
    {
        "id": "dc46953d.cb38f",
        "type": "function",
        "z": "68d4a16b.219e28",
        "name": "HK to OH",
        "func": "var b = context.get('b')||0;\nif(msg.payload.Brightness){\n    b = msg.payload.Brightness;\n    context.set('b',b);\n    msg.payload=b\n}\nif (msg.hap.context !== undefined) {\n    if(msg.payload.Brightness === 0){\n        msg.payload = 0\n    }\n    if(msg.payload.On === false){\n        msg.payload = 0\n    }\n    if(msg.payload.On === true){\n        msg.payload = b\n    }\n    return msg\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 940,
        "y": 100,
        "wires": [
            [
                "f0f90bea.ee547"
            ]
        ]
    },
    {
        "id": "f0f90bea.ee547",
        "type": "openhab2-out",
        "z": "68d4a16b.219e28",
        "name": "",
        "controller": "e80889f5.d5d3c",
        "itemname": "S_SYSP_SceneL3",
        "topic": "ItemCommand",
        "payload": "",
        "x": 1110,
        "y": 100,
        "wires": [
            []
        ]
    },
    {
        "id": "fa4292d3.eb2a78",
        "type": "function",
        "z": "68d4a16b.219e28",
        "name": "gate logic",
        "func": "msg.payload = \"close\"\nmsg.topic = \"control\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 340,
        "y": 160,
        "wires": [
            [
                "f34fcb43.75bb7"
            ]
        ]
    },
    {
        "id": "c9170a4e.58d1e8",
        "type": "inject",
        "z": "68d4a16b.219e28",
        "name": "inject",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "0.0001",
        "x": 190,
        "y": 160,
        "wires": [
            [
                "fa4292d3.eb2a78"
            ]
        ]
    },
    {
        "id": "4d611cdc.77e56c",
        "type": "function",
        "z": "68d4a16b.219e28",
        "name": "gate logic",
        "func": "msg.payload = \"open\"\nmsg.topic = \"control\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 340,
        "y": 200,
        "wires": [
            [
                "f34fcb43.75bb7"
            ]
        ]
    },
    {
        "id": "33dbdc7d.d6ba8c",
        "type": "inject",
        "z": "68d4a16b.219e28",
        "name": "inject",
        "topic": "msg.payload",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "10",
        "x": 190,
        "y": 200,
        "wires": [
            [
                "4d611cdc.77e56c"
            ]
        ]
    },
    {
        "id": "7dfceeee.99c9c8",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "OFF",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "OFF",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 500,
        "wires": [
            [
                "8b18b4d6.9109c8",
                "af78f699.458fd",
                "b0c2ff61.d26298"
            ]
        ]
    },
    {
        "id": "af06b38.46c6e5",
        "type": "link in",
        "z": "68d4a16b.219e28",
        "name": "L3 OFF",
        "links": [
            "92a3b9da.ca3b28",
            "7e6999ac.c061c8",
            "ffb96108.6fec8"
        ],
        "x": 215,
        "y": 620,
        "wires": [
            [
                "7dfceeee.99c9c8",
                "6747d687.ef6fb8",
                "8e2bc9a3.69fe28"
            ]
        ]
    },
    {
        "id": "6747d687.ef6fb8",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "OFF",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "OFF",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 620,
        "wires": [
            [
                "783c5a33.a46ec4"
            ]
        ]
    },
    {
        "id": "8e2bc9a3.69fe28",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "46,56,0 (Off Warm)",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "46,56,0",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 760,
        "wires": [
            [
                "e47c4253.6637d",
                "2cf73ad4.ab5d1e",
                "4ff07d99.eb8f2c"
            ]
        ]
    },
    {
        "id": "e7c83aa2.f56a48",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "ON",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "ON",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 540,
        "wires": [
            [
                "8b18b4d6.9109c8",
                "b0c2ff61.d26298",
                "af78f699.458fd"
            ]
        ]
    },
    {
        "id": "8b18b4d6.9109c8",
        "type": "openhab2-out",
        "z": "68d4a16b.219e28",
        "name": "",
        "controller": "e80889f5.d5d3c",
        "itemname": "A_3LVR_ChristmasTree",
        "topic": "ItemCommand",
        "payload": "",
        "x": 1050,
        "y": 480,
        "wires": [
            []
        ]
    },
    {
        "id": "af78f699.458fd",
        "type": "openhab2-out",
        "z": "68d4a16b.219e28",
        "name": "",
        "controller": "e80889f5.d5d3c",
        "itemname": "A_3LVR_Mantle_Holiday",
        "topic": "ItemCommand",
        "payload": "",
        "x": 1050,
        "y": 520,
        "wires": [
            []
        ]
    },
    {
        "id": "b0c2ff61.d26298",
        "type": "openhab2-out",
        "z": "68d4a16b.219e28",
        "name": "",
        "controller": "e80889f5.d5d3c",
        "itemname": "A_3LVR_Piano_Holiday",
        "topic": "ItemCommand",
        "payload": "",
        "x": 1050,
        "y": 560,
        "wires": [
            []
        ]
    },
    {
        "id": "f99b42bd.751e",
        "type": "link in",
        "z": "68d4a16b.219e28",
        "name": "L3 Ambient",
        "links": [
            "9e4fea8.87f0c18",
            "b16a0346.6536f",
            "fdc331b3.999af8"
        ],
        "x": 215,
        "y": 700,
        "wires": [
            [
                "1162c8f6.8dbfef",
                "6747d687.ef6fb8",
                "e7c83aa2.f56a48"
            ]
        ]
    },
    {
        "id": "783c5a33.a46ec4",
        "type": "openhab2-out",
        "z": "68d4a16b.219e28",
        "name": "",
        "controller": "e80889f5.d5d3c",
        "itemname": "A_3LVR_Entryway_Dimmer",
        "topic": "ItemCommand",
        "payload": "",
        "x": 1060,
        "y": 660,
        "wires": [
            []
        ]
    },
    {
        "id": "e47c4253.6637d",
        "type": "delay",
        "z": "68d4a16b.219e28",
        "name": "500ms",
        "pauseType": "delay",
        "timeout": "500",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 850,
        "y": 820,
        "wires": [
            [
                "b2cd49f6.6dd1d8"
            ]
        ]
    },
    {
        "id": "2cf73ad4.ab5d1e",
        "type": "delay",
        "z": "68d4a16b.219e28",
        "name": "500ms",
        "pauseType": "delay",
        "timeout": "500",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 850,
        "y": 900,
        "wires": [
            [
                "8a7febd9.1883f8"
            ]
        ]
    },
    {
        "id": "4ff07d99.eb8f2c",
        "type": "delay",
        "z": "68d4a16b.219e28",
        "name": "500ms",
        "pauseType": "delay",
        "timeout": "500",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 850,
        "y": 980,
        "wires": [
            [
                "176c67a7.8bcf88"
            ]
        ]
    },
    {
        "id": "9cc17d9f.89ed08",
        "type": "link in",
        "z": "68d4a16b.219e28",
        "name": "L3 Bright",
        "links": [
            "9183f71d.4e6d38",
            "5a6c1592.6647a4"
        ],
        "x": 215,
        "y": 780,
        "wires": [
            [
                "b0c5500.eaaa03",
                "e7c83aa2.f56a48",
                "12b0c1a1.7281e6"
            ]
        ]
    },
    {
        "id": "1162c8f6.8dbfef",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "46,56,25 (Dim Warm)",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "46,56,25",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 560,
        "y": 820,
        "wires": [
            [
                "e47c4253.6637d",
                "2cf73ad4.ab5d1e",
                "4ff07d99.eb8f2c"
            ]
        ]
    },
    {
        "id": "b0c5500.eaaa03",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "100",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "100",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 700,
        "wires": [
            [
                "783c5a33.a46ec4"
            ]
        ]
    },
    {
        "id": "846d3a32.333db8",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "40",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "40",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 660,
        "wires": [
            [
                "783c5a33.a46ec4"
            ]
        ]
    },
    {
        "id": "fc0299c8.3de51",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "46,56,75 (75% Warm)",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "46,56,75",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 560,
        "y": 920,
        "wires": [
            [
                "e47c4253.6637d"
            ]
        ]
    },
    {
        "id": "8c2b1c37.85e5c",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "46,56,25 (Dim Warm)",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "46,56,25",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 560,
        "y": 880,
        "wires": [
            [
                "2cf73ad4.ab5d1e",
                "4ff07d99.eb8f2c"
            ]
        ]
    },
    {
        "id": "b2cd49f6.6dd1d8",
        "type": "openhab2-out",
        "z": "68d4a16b.219e28",
        "name": "",
        "controller": "e80889f5.d5d3c",
        "itemname": "A_3LVR_PH_Table_Color",
        "topic": "ItemCommand",
        "payload": "",
        "x": 1050,
        "y": 820,
        "wires": [
            []
        ]
    },
    {
        "id": "12b0c1a1.7281e6",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "20,30,100 (Bright White)",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "20,30,100",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 570,
        "y": 1040,
        "wires": [
            [
                "e47c4253.6637d",
                "2cf73ad4.ab5d1e",
                "4ff07d99.eb8f2c"
            ]
        ]
    },
    {
        "id": "6a20c82e.6a2198",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "46,56,75 (75% Warm)",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "46,56,75",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 560,
        "y": 980,
        "wires": [
            [
                "e47c4253.6637d",
                "2cf73ad4.ab5d1e",
                "4ff07d99.eb8f2c"
            ]
        ]
    },
    {
        "id": "8a7febd9.1883f8",
        "type": "openhab2-out",
        "z": "68d4a16b.219e28",
        "name": "",
        "controller": "e80889f5.d5d3c",
        "itemname": "A_3LVR_PH_Hutch_Color",
        "topic": "ItemCommand",
        "payload": "",
        "x": 1050,
        "y": 900,
        "wires": [
            []
        ]
    },
    {
        "id": "176c67a7.8bcf88",
        "type": "openhab2-out",
        "z": "68d4a16b.219e28",
        "name": "",
        "controller": "e80889f5.d5d3c",
        "itemname": "A_3LVR_PH_Piano_Color",
        "topic": "ItemCommand",
        "payload": "",
        "x": 1050,
        "y": 980,
        "wires": [
            []
        ]
    },
    {
        "id": "cc4acba9.4dc0e8",
        "type": "link in",
        "z": "68d4a16b.219e28",
        "name": "L3 Dining",
        "links": [
            "98a988d.e7e2178",
            "53755c0b.8e55d4",
            "13c33928.694c47"
        ],
        "x": 215,
        "y": 860,
        "wires": [
            [
                "e7c83aa2.f56a48",
                "6747d687.ef6fb8",
                "1162c8f6.8dbfef"
            ]
        ]
    },
    {
        "id": "11ff42ef.5eb80d",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "46,56,25 (Warm 25%)",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "46,56,25",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 560,
        "y": 1380,
        "wires": [
            [
                "67bc6d11.c187f4",
                "cc3d7e5b.4ff2"
            ]
        ]
    },
    {
        "id": "a4e39d52.f4b58",
        "type": "link in",
        "z": "68d4a16b.219e28",
        "name": "L3 Ambient",
        "links": [
            "b16a0346.6536f",
            "fdc331b3.999af8"
        ],
        "x": 215,
        "y": 1220,
        "wires": [
            [
                "d0874181.e85ec",
                "11ff42ef.5eb80d",
                "341b667b.8cdb1a"
            ]
        ]
    },
    {
        "id": "67bc6d11.c187f4",
        "type": "delay",
        "z": "68d4a16b.219e28",
        "name": "500ms",
        "pauseType": "delay",
        "timeout": "500",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 850,
        "y": 1360,
        "wires": [
            [
                "2dbcf77d.6da568"
            ]
        ]
    },
    {
        "id": "cc3d7e5b.4ff2",
        "type": "delay",
        "z": "68d4a16b.219e28",
        "name": "500ms",
        "pauseType": "delay",
        "timeout": "500",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 850,
        "y": 1420,
        "wires": [
            [
                "dd8869f6.78f91"
            ]
        ]
    },
    {
        "id": "d0874181.e85ec",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "ON",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "ON",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 1180,
        "wires": [
            [
                "f76a10bf.9dda08"
            ]
        ]
    },
    {
        "id": "341b667b.8cdb1a",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "OFF",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "OFF",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 1240,
        "wires": [
            [
                "84ae49d.d6b9ab8"
            ]
        ]
    },
    {
        "id": "2dbcf77d.6da568",
        "type": "openhab2-out",
        "z": "68d4a16b.219e28",
        "name": "",
        "controller": "e80889f5.d5d3c",
        "itemname": "A_3SUN_PH_Globe_Color",
        "topic": "ItemCommand",
        "payload": "",
        "x": 1060,
        "y": 1360,
        "wires": [
            []
        ]
    },
    {
        "id": "81413522.f3388",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "46,56,0 (Off Warm)",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "46,56,0",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 1340,
        "wires": [
            [
                "67bc6d11.c187f4",
                "cc3d7e5b.4ff2"
            ]
        ]
    },
    {
        "id": "95d0f9f8.6732d",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "20,30,50 (Bright 50%)",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "20,30,50",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 560,
        "y": 1420,
        "wires": [
            [
                "67bc6d11.c187f4",
                "cc3d7e5b.4ff2"
            ]
        ]
    },
    {
        "id": "a617c3ae.441bf8",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "46,56,50 (Warm 50%)",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "46,56,50",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 560,
        "y": 1460,
        "wires": [
            [
                "cc3d7e5b.4ff2",
                "67bc6d11.c187f4"
            ]
        ]
    },
    {
        "id": "dd8869f6.78f91",
        "type": "openhab2-out",
        "z": "68d4a16b.219e28",
        "name": "",
        "controller": "e80889f5.d5d3c",
        "itemname": "A_2LAN_PH_Color",
        "topic": "ItemCommand",
        "payload": "",
        "x": 1030,
        "y": 1420,
        "wires": [
            []
        ]
    },
    {
        "id": "df86de6d.79ee3",
        "type": "link in",
        "z": "68d4a16b.219e28",
        "name": "L3 Bright",
        "links": [
            "9183f71d.4e6d38",
            "5a6c1592.6647a4"
        ],
        "x": 215,
        "y": 1300,
        "wires": [
            [
                "d0874181.e85ec",
                "854c3ee2.f2be5",
                "95d0f9f8.6732d"
            ]
        ]
    },
    {
        "id": "e82dbc15.b25a5",
        "type": "link in",
        "z": "68d4a16b.219e28",
        "name": "L3 Dining",
        "links": [
            "98a988d.e7e2178",
            "53755c0b.8e55d4",
            "13c33928.694c47"
        ],
        "x": 215,
        "y": 1380,
        "wires": [
            [
                "d0874181.e85ec",
                "341b667b.8cdb1a",
                "a617c3ae.441bf8"
            ]
        ]
    },
    {
        "id": "84ae49d.d6b9ab8",
        "type": "openhab2-out",
        "z": "68d4a16b.219e28",
        "name": "",
        "controller": "e80889f5.d5d3c",
        "itemname": "A_3SUN_ZW_Fan_LightDimmer",
        "topic": "ItemCommand",
        "payload": "",
        "x": 1070,
        "y": 1260,
        "wires": [
            []
        ]
    },
    {
        "id": "7f43dff5.29313",
        "type": "link in",
        "z": "68d4a16b.219e28",
        "name": "L3 OFF",
        "links": [
            "92a3b9da.ca3b28",
            "7e6999ac.c061c8",
            "ffb96108.6fec8"
        ],
        "x": 215,
        "y": 1140,
        "wires": [
            [
                "8575189c.95216",
                "81413522.f3388"
            ]
        ]
    },
    {
        "id": "854c3ee2.f2be5",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "100",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "100",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 1280,
        "wires": [
            [
                "84ae49d.d6b9ab8"
            ]
        ]
    },
    {
        "id": "f76a10bf.9dda08",
        "type": "openhab2-out",
        "z": "68d4a16b.219e28",
        "name": "",
        "controller": "e80889f5.d5d3c",
        "itemname": "A_3SUN_HolidayLights",
        "topic": "ItemCommand",
        "payload": "",
        "x": 1050,
        "y": 1140,
        "wires": [
            []
        ]
    },
    {
        "id": "8575189c.95216",
        "type": "change",
        "z": "68d4a16b.219e28",
        "name": "OFF",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "OFF",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 1140,
        "wires": [
            [
                "f76a10bf.9dda08"
            ]
        ]
    },
    {
        "id": "3e5b2317.4d4ffc",
        "type": "comment",
        "z": "68d4a16b.219e28",
        "name": "L3 OFF",
        "info": "",
        "x": 90,
        "y": 620,
        "wires": []
    },
    {
        "id": "36f3e3b3.8ae2ec",
        "type": "comment",
        "z": "68d4a16b.219e28",
        "name": "L3 Ambient",
        "info": "",
        "x": 110,
        "y": 700,
        "wires": []
    },
    {
        "id": "50ee12e6.4ea474",
        "type": "comment",
        "z": "68d4a16b.219e28",
        "name": "L3 Bright",
        "info": "",
        "x": 100,
        "y": 780,
        "wires": []
    },
    {
        "id": "e2e65740.3ef2e8",
        "type": "comment",
        "z": "68d4a16b.219e28",
        "name": "L3 Dining",
        "info": "",
        "x": 100,
        "y": 860,
        "wires": []
    },
    {
        "id": "53f29a93.603274",
        "type": "comment",
        "z": "68d4a16b.219e28",
        "name": "L3 OFF",
        "info": "",
        "x": 90,
        "y": 1140,
        "wires": []
    },
    {
        "id": "c9045d5e.53a4b8",
        "type": "comment",
        "z": "68d4a16b.219e28",
        "name": "L3 Ambient",
        "info": "",
        "x": 110,
        "y": 1220,
        "wires": []
    },
    {
        "id": "bd95f1d1.a40d3",
        "type": "comment",
        "z": "68d4a16b.219e28",
        "name": "L3 Bright",
        "info": "",
        "x": 100,
        "y": 1300,
        "wires": []
    },
    {
        "id": "c51676c9.4abff8",
        "type": "comment",
        "z": "68d4a16b.219e28",
        "name": "L3 Dining",
        "info": "",
        "x": 100,
        "y": 1380,
        "wires": []
    },
    {
        "id": "e80889f5.d5d3c",
        "type": "openhab2-controller",
        "z": "",
        "name": "openHAB Archon",
        "protocol": "http",
        "host": "192.168.1.80",
        "port": "8080",
        "path": "",
        "username": "",
        "password": ""
    },
    {
        "id": "d9992c49.b8d12",
        "type": "homekit-bridge",
        "z": "",
        "bridgeName": "NR Settings",
        "pinCode": "914-42-146",
        "port": "",
        "allowInsecureRequest": true,
        "manufacturer": "Archon",
        "model": "NR HK Settings Bridge",
        "serialNo": "Archon",
        "customMdnsConfig": false,
        "mdnsMulticast": true,
        "mdnsInterface": "",
        "mdnsPort": "",
        "mdnsIp": "",
        "mdnsTtl": "",
        "mdnsLoopback": true,
        "mdnsReuseAddr": true,
        "allowMessagePassthrough": true
    }
]



Once nodeRED and openHAB are talking, the last step is to connect HomeKit. The nodeRED HomeKit interface should generate a Dimmer item. Since the scenes are generated in nodeRED, you only need to set the dimmer value for each scene. You can do this on the Home app on a Mac, or on an iPhone or iPad.

First create a new scene in HomeKit. I recommend naming it something easy to remember and unique since you can call it with Siri. Then tap “Add Accessories.”

Then scroll down and find the corresponding item. Add it and tap done.

Screen Shot 2020-05-20 at 01.12.38

Then double click on the appropriate scene item. Open node-RED in your browser and determine the number for the scene you want. You can determine this by mousing over the switch node output that corresponds to the proper scene. Note that if you set up your own scenes you can only use every third number - otherwise HomeKit doesn’t treat them as distinct values. Once you have your value, drag the slider to the appropriate value. My Ambient scene uses the value 30:

Screen Shot 2020-05-20 at 01.39.11

If you want, set the scene as a favorite so it appears more prominently. Then click done. Repeat these steps for each scene you want to use. The scenes should be available to any HomeKit enabled device you have connected to your account.

Once setup is complete I recommend restarting node-RED for good measure. Then, your scenes should trigger the preset actions. Better yet, these scene selections will stay in sync across HomeKit and openHAB.

For my lower level, I have several DMX lights that are controlled via QLC+. I’m working on QLC+ tutorial with @MDAR. I will include a section that addresses activating QLC+ scenes and chasers from scenes similar to those shown above.

I hope this is helpful! Let me know if you want to implement this and need help.

2 Likes

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.