-
-
Notifications
You must be signed in to change notification settings - Fork 630
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
New advertiser: Avahi/D-Bus API #918
Conversation
Pull Request Test Coverage Report for Build 1638863641
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for you contribution. Especially for taking the time to illustrate the situation around mdns advertising with HAP-NodeJS. 🚀
I very much like the idea of getting back to interface with "standard" mdns implementations. This was and is a reoccurring pain point of HAP-NodeJS. Having a way to interface with avahi in a non-complex way is definitely a huge win 🎉
I know this is not part of the PR, but is there an easy way of checking if dbus and avahi is available on the currently running platform?
On a similar topic, I already though about interfacing with mDNSResponder
on macOS. To my knowledge, the easiest approach would be to interface via the dns-sd
CLI. Though, doing txt updates isn't really possible without completely readvertising, but that might be a sensible addition for the future as well.
Yes. If D-Bus is not available, then this line will throw an exception (tested on my Mac which can have D-Bus but does not have it installed):
I can easily catch this, but not sure what the right way of dealing with it is. (in the sense of what would "fit in" best with the rest of HAP-NodeJS's operation) If D-Bus is available but Avahi is not, then the avahiInvoke calls should throw an exception. (hard for me to test this) |
Okay good to know. I think it is fine if we keep the "auto configuration" separate from this PR for now.
I think the easiest way to test this, is to boot into a barebones docker container. Those typically ship without avahi. |
Even easier is probably just to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
The PR is live with 0.10.0-beta.4 EDIT: live with homebridge v1.4.0-beta.0. The UI still needs to be updated to be able to configure the advertiser. |
Thank you both! I’ll be testing this on my Raspberry Pi installations. Looking good so far (in Discovery app) on a test installation with five child bridges. |
Hm, getting a fatal error on Raspberry Pi Zero:
I also though I saw |
|
getting the following on M1 Mac:
|
Yes, looking at
Apparently not? |
That’s to be expected. No dbus nor Avahi on Mac. I hope only when setting |
yes. |
|
Looks good. I'm no where near a computer right not to actually test however. Before this goes into a Homebridge releases I'd like to see auto-fallback to a valid advertiser if Avahi is not available on the system (assuming this is not already the case?), and the default to remain as Bonjour for existing installs for at least for the initial release, (I can make it so new installs have the advertiser set to Avahi if available). |
Are you using Node 17? ARMv6 is no longer fully supported. Please go back to Node 16 in this case. |
Node v16.13.1. And |
Try node --no-expose-wasm Regarding calling node-gyp, which package is calling it? If it's |
Running Homebridge or running
Not sure. How can I force Edit found the log, indeed it’s
|
On a positive note, the avahi/dbus advertiser seems to work fine on my Pi 4B servers, running 32-bit buster or bullseye. I have the impression that Home on my iPad spends a little less time on updating the tiles than when using ciao. |
@oznu as of now bonjour-hap is still the default and avahi has to be manually configured. I would give it a shot to implement the auto-default in hap-nodes next week. Not sure if this needs modifications then in the UI (apart from adding a new case) to properly display the default in the dropdown. |
Running whatever it was that gave the ARMv6 error. |
From some Googling, it appears that Also |
The issue is that the Homebridge beta crashes on a Pi Zero, before it’s even read config.json to find out which advertiser to use. I only use the Pi Zero for testing, so I couldn’t care less, but there are people out there actually running Homebridge on an arm6. This needs to be fixed before publishing a released version with the Avahi/D-Bus advertiser, or support for the arm6 needs to be dropped officially - again, I don’t care which; I’m just reporting what I encounter. This is a standard installation as per the Wiki, and and I installed the beta through the UI. I’m willing and able to try stuff on the command line, in order to analyse this issue, but this is a real issue, in practice. |
I understand, but it's not clear how you came to the conclusion that the ARMv6 crash has something to do with the addition of the Avahi/D-Bus advertiser, and not some other dependency that's been updated in the HAP-NodeJS beta. In fact since your issue seems to come from using Homebridge, it isn't even clear that it's related to HAP-NodeJS at all. Can you share what info you have on this? Thanks! |
i don’t think this could happen until at least april 2023 when homebridge officially drops support for node 14. unless i am getting my versions of node that support arm6 mixed up! |
@ebaauw @adriancable Would be great if you could track it in a new, separate issue (tagged with |
I haven't. I'm just reacting here as Andi mentioned the Homebridge beta here. Given the time in between v1.3.9 and the beta, I guess there wouldn't be many other changes, but assumptions ...
I'm afaid, I already have. Frankly, I have no idea who issues the messages, not who causes the SIGTRAP. I'm not even sure if it's related to the invocation of |
In HAP-NodeJS or in Homebridge? |
HAP-NodeJS. Thanks! |
@adriancable : That does the trick, see the issue. Does that mean the crash is related to Again, on a positive note: I'm very happy with the PR, and it seems to run perfectly well on the Pi 4B. As I mentioned above, I have a feeling Home is spending less time Updating the tiles. |
No, unfortunately, I don't have any ARMv6 platform to test. But Googling around, I read that Node is deprecating ARMv6 from 16.1 onwards, and at least for now this command line switch seems to disable the bits which break. |
I also (independently) noticed the exact same thing. I am fairly sure the effect is real and not placebo. I wonder why this would be the case? |
### Added - Support for new advertiser [AVAHI](homebridge/HAP-NodeJS#918) - Support for new advertiser [RESOLVED](homebridge/HAP-NodeJS#965) - Added `msg.hap.reachable` parameter to get device reachable state (related to NO_RESPONSE) ### Fixed - Accessory could not be recovered from NO_RESPONSE using single Characteristic - Make unsupported Characteristic error more descriptive [#456](#456) - FFmpeg No such file or directory [#495](#495) - allChars: properties have spaces in names [#496](#496) - Wait for host to return from unpublish/destroy before exiting, set published flag on destroy - Security system with characteristics, bad behaviour [#388](#388) ### Changed - Updated hap-nodejs to [0.9.7](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.9.7) (bug fixes) - Updated hap-nodejs to [0.9.8](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.9.8) (bug fixes) - Updated hap-nodejs to [0.10.0](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.10.0) (features) - Updated hap-nodejs to [0.10.1](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.10.1) (changes) - Updated hap-nodejs to [0.10.2](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.10.2) (bug fixes) - Updated hap-nodejs to [0.10.3](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.10.3) (bug fixes) - Updated hap-nodejs to [0.10.4](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.10.4) (bug fixes) - Updated hap-nodejs to [0.11.0](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.11.0) (features and bug fixes)
♻️ Current situation
HAP-NodeJS currently doesn't work on some set-ups ('No Response'!) due to some router bugs:
HAP-NodeJS also currently doesn't work on other set-ups, for software-related reasons:
HAP-NodeJS a very long time ago used node-mdns as an advertiser which uses the Avahi Bonjour compatibility API, but:
Also:
💡 Proposed solution
Added a 3rd advertiser (in addition to, not replacing, bonjour-hap and ciao) which talks to Avahi over the D-Bus API. Because it's pure JavaScript (no node-gyp) it works on any system with Avahi/D-Bus. If there is no Avahi/D-Bus on the system just don't use it, and continue with ciao or bonjour-hap 'según el gusto'.
Testing
Not done a lot. Seems to work on Linux! Tested IPv6 announcements, and they work.