NRCHKB / node-red-contrib-homekit-bridged

Node-RED Contribution - HomeKit Bridged : Node-RED nodes to simulate Apple HomeKit devices.
https://nrchkb.github.io
MIT License
412 stars 52 forks source link

[Help needed]: Connection problems - Home app stops responding shortly after initial setup #531

Closed AndreWillems closed 10 months ago

AndreWillems commented 11 months ago

Your Current NRCHKB Plugin Version

1.5.0

Operating System

Debian Linux

How can we help?

hi all. been using this plug-in in NodeRED for years, but ran into a serious issue today;

I configured a new bridge (configuration node in NodeRED) which I can discover this in Apple Homekit (Bonjour). but when I try to connect an accessory I normally used the PIN/config code in the format 111-22-333. but now it's forcing a code in the format 1111-222-3333.... The short code is not accepted (='refused') by homekit and and the config node in NodeRED does not allow to define a longer code, only 111-22-333.

I'm stuck here.. any thoughts / solution ?

Any more details?

I'm on the latest versions of NodeRED (3.0.2), NodeJS (18.17.0) and the NRCHKB plug in (1.5.0).

Any code or functions to add?

No response

TheNON75 commented 11 months ago

Hi @AndreWillems ,

The codes in the old, short format should work without any issues, simply by entering them as they are (without dashes). There are many older, official HomeKit devices with old code format, they are working also very well.

@crxporter did you experience anything similar lately?

crxporter commented 11 months ago

This came up last week on discord, was tested.

Just type in the 8 digits. The - character is not important. Don't worry about the new length codes, old ones will work.

Try again to pair by just using the 8 digits. Let us know if it doesn't work, provide screenshots please.

AndreWillems commented 11 months ago

hi @TheNON75 , @crxporter ,

thanks for your quick responses.

I tried, but my accessory gets denied;

see screenshots; 1. I can see the Bridge (IOT2023), 2. I type in the 8-digit pin from this config node as defined in NodeRED and then got 3. refused. (sorry all in Dutch, but I'm sure you'll get it).

01_HUB

02 PIN

03_Refuse

Other comments:

TheNON75 commented 11 months ago

Which iOS/tvOS are you using? Is it the same nodered instance or a separate install?

AndreWillems commented 11 months ago

tvOS = 16.5 (latest) iphone = 16.6 (latest)

they are all on the same VLAN (always been) I've never specified a port in the config node (see screenshot); not sure which port is chosen (auto config) ?

image
crxporter commented 11 months ago

A couple of things:

1- change your PIN code and try again. Pick just some other random code 2- I would recommend against doing too many full deploys

this is definitely odd. I would be surprised if it's a pin thing, I would guess something else. @TheNON75 someone else, could you test at your house with a new bridge? I wont be home to test mine until Wednesday

TheNON75 commented 11 months ago

Sure, within 8 hours (in the morning, after coffee and co)

Btw i would uncheck the "allow insecure connections"

Aaand tvOS 16.6 is the latest. Just installed.

AndreWillems commented 11 months ago

I did create again another config node, with a new, unique name and managed to get it connected now and a few accessoiries linked to it as well.

its works, but seems to be unstable; after 5-10 min or so, all accessoiries are unavailabe (homekit: 'no response') and I cant see the bridge anymore either. now, it doesnt seem to update (/connect) anymore at all, strange. restarting NodeRED doesnt solve it either. as a test, I added another new config node and that appears immediately in HomeKit when I search for new accessoiries.

i will try to test more later today...

for me to understand; I thought the AppleTV is only needed as a hub for external (outside my LAN) access and NRCHKB connects directy as a bridge to HomeKit ? did update to 16.6, but no difference.

guess I'll have to go in debug mode for NRCHKB/HapNodeJS... ?

crxporter commented 11 months ago

Apple is now using the home hub to do all communications and the iOS or other device asks the hub what's happening. The Apple TV is always used.

I'm glad it paired - that's progress. Next questions are about your network setup: -any fancy firewalls? -how are you running nodered (docker or on a pi or?) -is everything on a single subnet?

AndreWillems commented 11 months ago

hi @crxporter,

thanks for the clarification on the AppleTV role.... to answer your questions:

Status: -HomeKit always connects to AppleTV, no problems at all -the bridge I configured this morning is not there anymore and all accessoiries are offline ('no response'). -a newly configured brigde (config node in NodeRED) is still available (I see it when I search for new accessoiries), as I've made no connections yet; I'm sure it will dissapear once I try to connect to it.... I would hope this helps you/us pointing in the right direction ?

Thanks again, Andre

crxporter commented 11 months ago

yes, all is on the same subnet. it's a seperate VLAN for IoT.

Are the Apple TV and iOS devices on the same subnet as the debian machine?

@marcus-j-davies do you have any tips on running separate vlans for HomeKit devices?

Does the vm have host mode network or is it bridged from qnap? I'm running the same setup but on synology NAS.

Do you have MDNS enabled and "multicast enhancement" disabled on your dream machine? I had "no response" problems a lot when multicast enhancement was enabled on my dream machine...

AndreWillems commented 11 months ago

Interesting that you are searching the problem in the network...

yes, MDNS is enabled (setting for a specific VLAN) and 'multicast enhancement' is disabled (setting for specific WIFI network in config part of Unify).

but the discovery of the (new) bridge still works, as long as I dont connect to it. once I make a connection, it will initially work (and very responsive/fast, when I click a light switch on/off) but then it stops and somehow looses the connection....

marcus-j-davies commented 11 months ago

Connections are being made - so I can't imagine it's anything network related.

My only comment is to ensure that Multicast DNS is enabled on the networks that need to communicate with each other.

Example

iOS devices can also send beacons used by HomeKit, hence to enable MDNS on their networks also.

AndreWillems commented 11 months ago

hi @marcus-j-davies ,

agree, I dont think its a network issue either and I got all the network settings checked as @crxporter suggested.

I think I'll have to do some debugging in NodeRED on HKCNRB ?

crxporter commented 11 months ago

It still feels like some kind of connection problem to me... The initial pair works - then it drops after some time and never recovers.

Let's see if @Shaquu has any comments?

In the meantime, you could try changing your bridge advertiser between Bonjour, Ciao, and Avahi?

Also you could humor me and put the VM on the same vlan as your apple devices... I really think that could help things.

AndreWillems commented 11 months ago

thinking about this... i did see my Unifi DreamMachine did an update (to 3.1.15) recently; maybe the Homekit connection issues started after that (but not 100% sure). checking the release notes, I dont see anything specific/related to this but maybe you can check/confirm: https://www.reddit.com/r/unifi_versions/comments/1592fat/unifi_os_dream_machines_3115/

but if it would be anything with the Unifi OS version, I would assume more people would face HomeKit issues now...

I'm on holidays for the next 2 weeks.... will investigate further when I get back...

thanks again for all your help guys (!),

Andre

Shaquu commented 10 months ago

Is this issues still about PIN? :)

AndreWillems commented 10 months ago

Ha no, its about connectivity between end device and nodered... Back home on friday and will investigate/debug further... Should we initiate a new/other issue ?

crxporter commented 10 months ago

Should we initiate a new/other issue ?

We should continue here. I'll rename this issue.

AndreWillems commented 10 months ago

hi all, I did some further investigations on this and it seems to be solved, somehow.

I did create 2 new bridges (/config nodes) in NodeRED, one BONJOUR en one AVAHI. I can discover both in HomeKit, add accessoires and all function well, also after a few hours/days (last time it only worked for a few minutes).

I've not changed anything on my netwerk / MDNS settings since then.

I cannot reproduce the error/disconnect.

I'm happy with the fact that all works again, but have no answer to the issues I had last month.... I suggest to close the issue if nobody else came up with similar issues.

Thanks all for your support.

Andre