-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This library connects to every _hap service, not just homebridges #56
Comments
The ability to use the library with any hap-nodejs implementation is a feature and not an issue. I use it with my HomeKit-bridged devices, to expose them to Alexa. For you issue with HomeKit-bridged, have you tried setting the bridge port in the config settings for HomeKit-bridged? It should reduce the number of zombie mdns records. For the PIN code issue, on my rainy day list is to add a PIN check as part of the discovery phase, to prevent this issue. For the stuck connection issue, the code is doing a simple request to retrieve a list of accessories from the device, and if it’s a true native HomeKit device, the call should immediately fail, as I’m not using a native HomeKit secure connection. The code is here Hap-Node-Client/HAPNodeJSClient.js Line 716 in c61d716
|
At the very least the API should offer a way to filter based on
I haven't tried that. I did however restart the entire nodered service and the problem has stopped happening, at least for now. I'm somewhat mystified, but since the bug occurred before, I'm guessing it will happen again. In any case, my one worry with hardcoding the port is whether that will actually stop zombie services, or whether it will just advertise multiple services with the same port.
It is ia true native HomeKit device, but it's been awfully flaky and the HomeKit implementation is terrible (it's missing most functionality from the HomeKit accessory). Looking at the code, I just tried sending my own request and what I get back is |
@lilyball I was recently working thru removing the dependency on the request package ( long since deprecated ) and replacing it with Axios and making a couple of other improvements, including better detection of native HomeKit devices and devices with an incorrect PIN and saw this during testing. That is from my Wyze cam using the Homebridge-camera-ffmpeg plugin. Your thought about filtering based on MD or CI would break the support of this device.
If you have a free moment, and you can recreate the original issue with the timeout errors from that flaky HomeKit device, could you try out the current beta of Homebridge-automation ? It uses axios instead of request and I want to see if the behaviour is improved.
|
This plugin attempts to connect to every single discovered _hap service regardless of what it is, in search of homebridges. Looking at my local services right now, it appears that homebridge sets
md=homebridge
for every bridge it advertises, so I would expect this plugin should only connect to those. If there is a need to connect to a different HAP-NodeJS server that is not homebridge, this should be supported through an option to set a differentmd
parameter to filter on.If filteirng on
md
is a problem, then at the very least this should filter onci=2
, as that signals that this device is a bridge. Again, perhaps there should be an escape hatch for specifying otherci
options to handle the scenario where someone uses HAP-NodeJS to advertise an individual accessory and someone wants to connect to it. But since this primarily appears to be for talking to homebridge, it should default to searching for things that look like homebridge instead of connecting to everything.The reason for filing this issue right now is a bug that causes zombie
_hap._tcp.
services (NRCHKB/node-red-contrib-homekit-bridged#477), and my logs are as a result filled every 15 minutes with a bunch of spam that looks likeAlso
lsof -i
shows that I have a lot of active connections to the same HomeKit accessory. This HomeKit accessory is somewhat buggy (and is using port 80 as its HAP server for some reason), and its PIN is definitely not the PIN I'm searching for, but something is keeping the connections alive. I don't know if this library is simply expecting the remote service to hang up when pairing fails, or if something else is going on, but at this moment I have 135 active connections to it, and that seems consistent with the idea that I'm getting yet another established connection on every refresh (which is 15 minutes). The accessory is using protocol version 1.0 but I'm not sure what that actually changes (besides the lack of ash
parameter, whose meaning is redacted from the current Non-Commercial HAP Specification).In any case, if this library filtered either on
md=homebridge
orci=2
then it wouldn't even attempt to connect to this accessory. Though obviously it should also figure out and fix whatever is causing the connection to persist despite the incorrect PIN.The text was updated successfully, but these errors were encountered: