Homekit-bridged + connection from outside the house

Hi,

I am using homekit-bridged and this works fine when I'm on the WiFi network.
Now I have a apple tv, and I should be able to just acces all my homekit devices from distance (cellular network) because the apple tv is the 'hub' who is doing this and he is configured for this.

But it does not work. I have no 'real' homekit devices to test if it's the apple tv hub who is really not working, but I can't imagine that, this is all preconfigured by apple.

But the homekit-bridged nodes have allot of configuration parameters for the network.

How I see it, I can't place why I should/would configure something. Once a device is found in the homekit app, it's done.... But probably it works different in node red....

I can't figure out with the documentation what the idea is for these parameters. What ports I should forward, why a multicastis even needed....

So, straight forward my question is: What do I need to do to controll everything from outside my network?

This is my program, and I would like to push on my 'zijdeur' on my iPhone, no matter where I am or how I'm connected to the internet.

[{"id":"ef81131f.c8cc8","type":"homekit-service","z":"2394a732.7eee28","isParent":true,"bridge":"f4272527.011798","parentService":"","name":"Zijdeur","serviceName":"LockMechanism","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","characteristicProperties":"{}","x":250,"y":260,"wires":[["b4427083.d2fd8","75e7fa8e.f36a64"]]},{"id":"ea68d6bc.0a16b8","type":"delay","z":"2394a732.7eee28","name":"","pauseType":"delayv","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":275,"y":360,"wires":[["ef81131f.c8cc8"]],"l":false},{"id":"b4427083.d2fd8","type":"function","z":"2394a732.7eee28","name":"","func":"i = msg.payload.LockTargetState\nif(i===0){\n node.send({delay:400,payload:{ LockCurrentState: 0}})\n node.send({delay:4500,payload:{ LockTargetState: 1}})\n node.send({delay:5000,payload:{ LockCurrentState: 1}})\n}\n","outputs":1,"noerr":0,"x":209,"y":360,"wires":[["ea68d6bc.0a16b8"]],"l":false},{"id":"75e7fa8e.f36a64","type":"debug","z":"2394a732.7eee28","name":"To the rest of my program","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":590,"y":260,"wires":[]},{"id":"f4272527.011798","type":"homekit-bridge","z":"","bridgeName":"NodeRed Bridge","pinCode":"111-11-111","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","customMdnsConfig":true,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true}]

Thanks

Before I dive into formulating an answer I’ve to ask you the following. Are you sure about this? Opening a door lock on your phone when you’re on-premise is one thing, but being able to open a side door to a place, whether that is a garage or garden shed, or something as big as your house or office buildings comes with security risks. If you can open it remotely, someone able to crack your system through the same route as you end up using can open it too. It’s not a direct invite for burglars, but make sure you want this for the right reasons and not because it’s just easier that way.

Hi Afelix,

that's no problem here, it does not really go to an outdoor lock. But I do want to simulate a lockmechanism with node-red that I want to conenct from a cellular network. We can make the example with a lightbulb if you want :slight_smile:

I just want to be able to control the simulated node red homekit devices for outside my network. And I keep thinking it's strange that my apple tv can't manage that but ok.... I have no idea what is working on the background.

Back to basics for a second, ignore the TV for a bit. You've set up a bridge, looking at the flow. You added a node connecting to the bridge. Have you connected to that bridge from HomeKit on your phone and is that working? Is the pin for the bridge correct? I remember having read, I believe for homebridge, that not all PINs are valid, as some are designated for specific brands. Since the homekit-bridged has 111-11-111 on the wiki, I think it will work. I set up mine with the default key for homebridge instead: 031-45-154, thought I don't think it will truly matter much here.

Are those MDNS settings correct as well? I have my own config node set up without custom MDNS settings, looks like this over here:


For the "home hub" to work correctly, I remember reading that the bridge should be visible for the TV, but since I don't have an Apple TV myself I can't check it. It simply shows like this on the homekit app for me:

You don't need the mDNS config. The key is that your Apple TV actually acts as the hub. Did you add a "home" in homekit ? This "home" should show up on your ATV. After that, try adding a homekit "device" via the node.

Homekit in combination with the homekit-bridged nodes is not without its issues. Once it is working, it keeps working, but restart node-red and you could loose everything and add everything manually again.

Restarting your phone can remedy some of the issues.
Same goes for logging out icloud on both your phone and atv etc.
Or removing the "home" and add a new "home" with a different name can also help.

Thanks all for the feedback.

So it seemed indeed that the Apple TV is doing the work, I started a whole new home. Linked the atv first, it automatically found my node red bridge with accessories and it worked....
exactly the same as I had in the begin, but then I did it not in this order. I’ll give it a few days and hopefully it stays stable :grinning:. It

One thing to add, you’re unable to block devices from being controlled remotely if that turns out to be an issue. There’s an open issue for that on the hap-node.js, if you search in the issues for “remote” you’ll find it.

So, yesterday I tested a whole day the lock maganism, it worked every time, so I was verry happy.
In the evening I added some devices on the same bridge and that was no succes, in the end they where available in my app, but nothing worked anymore. Now I'm back in the old situation that it only works on WiFi.
Pretty stupid that I can't add fluently other devices. I will need to do it in 1 time and tink verry good about what and how.

Go back to the flow that worked and add the new stuff in small steps till you find what is causing the problem.

Or try something else instead. I have mentioned homebridge-mqtt here before, works flawlessly.