HomeKit NodeRed Sync

Hi all, I do all my automations in NodeRed, however I still had the problem that when I control things via HomeKit I could not detect any “manual” interaction.

In NodeRed the UserID is “null”, so I used the following trick:
Screenshot 2021-12-29 at 00.12.59

I have created a “dummy light” in NodeRed with the help of “node-red-contrib-homekit-bridged” Which I grouped in HomeKit with the existing light. So I get in NodeRed the commands which are made via HomeKit

So if I use my HomePod to set the light to 10% I have the interaction through HomeKit and can perform other actions.

I hope maybe I helped someone, maybe I am making a huge mistake in thinking and it would be much easier.

NodeRed Flow:

[
    {
        "id": "bea273171c4eef3d",
        "type": "homekit-service",
        "z": "2c273b3d00ef04b6",
        "isParent": true,
        "hostType": "0",
        "bridge": "8751eba15e8a503b",
        "accessoryId": "",
        "parentService": "",
        "name": "Spot Sync",
        "serviceName": "Lightbulb",
        "topic": "",
        "filter": false,
        "manufacturer": "Dodo",
        "model": "SYNC",
        "serialNo": "1.0.0",
        "firmwareRev": "1.2",
        "hardwareRev": "1.0.0",
        "softwareRev": "1.0.0",
        "cameraConfigVideoProcessor": "ffmpeg",
        "cameraConfigSource": "",
        "cameraConfigStillImageSource": "",
        "cameraConfigMaxStreams": 2,
        "cameraConfigMaxWidth": 1280,
        "cameraConfigMaxHeight": 720,
        "cameraConfigMaxFPS": 10,
        "cameraConfigMaxBitrate": 300,
        "cameraConfigVideoCodec": "libx264",
        "cameraConfigAudioCodec": "libfdk_aac",
        "cameraConfigAudio": false,
        "cameraConfigPacketSize": 1316,
        "cameraConfigVerticalFlip": false,
        "cameraConfigHorizontalFlip": false,
        "cameraConfigMapVideo": "0:0",
        "cameraConfigMapAudio": "0:1",
        "cameraConfigVideoFilter": "scale=1280:720",
        "cameraConfigAdditionalCommandLine": "-tune zerolatency",
        "cameraConfigDebug": false,
        "cameraConfigSnapshotOutput": "disabled",
        "cameraConfigInterfaceName": "",
        "characteristicProperties": "{\"Brightness\":true,\"Hue\":true,\"Saturation\":true}",
        "waitForSetupMsg": false,
        "outputs": 2,
        "x": 1150,
        "y": 880,
        "wires": [
            [
                "633143413cbd4009"
            ],
            []
        ]
    },
    {
        "id": "7c9f643168e6c2f5",
        "type": "server-state-changed",
        "z": "2c273b3d00ef04b6",
        "name": "Spot on",
        "server": "707fb62d.6e7a88",
        "version": 3,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "light.bath_spots",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": 0,
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 770,
        "y": 860,
        "wires": [
            [
                "02da18b67d20b65f"
            ],
            []
        ]
    },
    {
        "id": "02da18b67d20b65f",
        "type": "change",
        "z": "2c273b3d00ef04b6",
        "name": "set on - true",
        "rules": [
            {
                "t": "delete",
                "p": "payload",
                "pt": "msg"
            },
            {
                "t": "set",
                "p": "payload.On",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 950,
        "y": 860,
        "wires": [
            [
                "bea273171c4eef3d"
            ]
        ]
    },
    {
        "id": "fbd8f2695665453b",
        "type": "server-state-changed",
        "z": "2c273b3d00ef04b6",
        "name": "Spot off",
        "server": "707fb62d.6e7a88",
        "version": 3,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "light.bath_spots",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "off",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": 0,
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 770,
        "y": 920,
        "wires": [
            [
                "a050ad08145df96d"
            ],
            []
        ]
    },
    {
        "id": "a050ad08145df96d",
        "type": "change",
        "z": "2c273b3d00ef04b6",
        "name": "set on - false",
        "rules": [
            {
                "t": "delete",
                "p": "payload",
                "pt": "msg"
            },
            {
                "t": "set",
                "p": "payload.On",
                "pt": "msg",
                "to": "false",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 950,
        "y": 920,
        "wires": [
            [
                "bea273171c4eef3d"
            ]
        ]
    },
    {
        "id": "633143413cbd4009",
        "type": "debug",
        "z": "2c273b3d00ef04b6",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1350,
        "y": 880,
        "wires": []
    },
    {
        "id": "8751eba15e8a503b",
        "type": "homekit-bridge",
        "bridgeName": "Demo Dodo",
        "pinCode": "153-10-538",
        "port": "",
        "advertiser": "bonjour-hap",
        "allowInsecureRequest": false,
        "manufacturer": "Dodo",
        "model": "Demo",
        "serialNo": "1.1.2",
        "firmwareRev": "",
        "hardwareRev": "",
        "softwareRev": "",
        "customMdnsConfig": false,
        "mdnsMulticast": true,
        "mdnsInterface": "",
        "mdnsPort": "",
        "mdnsIp": "",
        "mdnsTtl": "",
        "mdnsLoopback": true,
        "mdnsReuseAddr": true,
        "allowMessagePassthrough": true
    },
    {
        "id": "707fb62d.6e7a88",
        "type": "server",
        "name": "Home Assistant",
        "version": 2,
        "addon": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": 30
    }
]
1 Like