Closed ebaauw closed 1 year ago
For comparison, here's the log output in Homebridge v1.5.9:
[12/14/2022, 10:41:28 PM] [HB Supervisor] Restarting Homebridge...
[12/14/2022, 10:41:28 PM] [HB Supervisor] Starting Homebridge with extra flags: -P /volume1/homebridge/node_modules -D --strict-plugin-resolution
[12/14/2022, 10:41:28 PM] [HB Supervisor] Starting Homebridge with custom env: {"DEBUG":"HAP-NodeJS:Advertiser","NODE_OPTIONS":"--trace-warnings"}
[12/14/2022, 10:41:28 PM] [HB Supervisor] Started Homebridge v1.5.1 with PID: 27264
2022-12-14T21:41:29.027Z HAP-NodeJS:Advertiser Initializing HAP-NodeJS v0.10.4 ...
[12/14/2022, 10:41:29 PM] Loaded config.json with 0 accessories and 1 platforms.
[12/14/2022, 10:41:29 PM] Loaded 0 cached accessories from cachedAccessories.
[12/14/2022, 10:41:29 PM] ---
[12/14/2022, 10:41:29 PM] No plugins found.
[12/14/2022, 10:41:29 PM] Loading 1 platforms...
[12/14/2022, 10:41:29 PM] Publishing bridge accessory (name: ds2, publishInfo: {
username: 'CC:22:3D:E3:C7:3D',
port: 51826,
pincode: '***-**-***',
category: 2,
bind: undefined,
mdns: undefined,
addIdentifyingMaterial: true,
advertiser: 'avahi'
}).
Setup Payload:
X-HM://00253QFZSWX86
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:
┌────────────┐
│ 987-65-432 │
└────────────┘
[12/14/2022, 10:41:29 PM] Homebridge v1.5.1 (HAP v0.10.4) (ds2) is running on port 51826.
2022-12-14T21:41:29.317Z HAP-NodeJS:Advertiser Detected Avahi over DBus interface running version 'avahi 0.7'.
2022-12-14T21:41:29.320Z HAP-NodeJS:Advertiser Preparing Advertiser for 'ds2 0BBB' using Avahi backend!
2022-12-14T21:41:29.326Z HAP-NodeJS:Advertiser Starting to advertise 'ds2 0BBB' using Avahi backend!
Reading the logs there are two important lines here:
2022-12-14T21:39:21.484Z HAP-NodeJS:Advertiser Detected Avahi over DBus interface running version 'avahi 0.7'.
[...]
Could not create mDNS advertisement. The HAP-Server won't be discoverable: Error: No such interface found
The last line refers to a feature failing introduced with PR #970 which registers to the Server.StateChanged interface to be notified about avahi server restarts.
Secondly, you/Synology are/is running avahi version 0.7 a 6 year old release of avahi. My test environment runs avahi 0.8 so I assume there is some issues with the exposed dbus interface that was updated in the avahi 0.8 release.
Within hap-nodejs, we are using the legacy org.freedesktop.Avahi.Server
instead of the org.freedesktop.Avahi.Server2
interface that got introduced with 0.8. So I'm not sure if there are changes within the "legacy" interface that weren't properly communicated.
That's my currently analysis of the problem. I will investigate further. One possibility is to just gracefully continue if the dbus interface is not found, see: https://github.com/homebridge/HAP-NodeJS/blob/e39faf0358909e2525bd91a2746fceb68fa0274d/src/lib/Advertiser.ts#L416-L417.
But ideally we find a solution that enables restart detection also for < avahi 0.8 daemons.
Thanks for reporting this issue 🚀
Looking at the diff between 0.7 and 0.8, there are now changes in regard to the dbus interface used: https://github.com/lathiat/avahi/compare/v0.7...v0.8#diff-cda9c20b8570353458c309abfcddcac2c9be7b6fca607ef7b702a7d489ed1648
Your test in the PR also uses avahi 0.7? See https://github.com/homebridge/HAP-NodeJS/pull/970#issuecomment-1296606411
You are indeed right. I was probably still running ubuntu 20.04 back then.
Is there anyway to replicate the synology environment, is there a docker image or something?
For reference, the error comes from here within dbus-native: https://github.com/homebridge/dbus-native/blob/fc1a5bf07b448f473923a64e707110e48f0272f6/lib/introspect.js#L33
It is called by introspectBus
which is called by DBusService.getInterface(...)
You could try to manually debug, by adding a console.log(result);
before that line, maybe (file node_modules/@homebridge/dbus-native/lib/introspect.ts
).
I think Synology supports multiple DSM installations on the same DiskStation through virtualisation, but I never looked into that. I doubt DSM will run on non-Synology hardware.
In my experience, Synology tends to modify standard software, e.g. they run their own build of nut
.
So “interface” in the error message refers to the dbus
endpoint, not to the network interface.
So “interface” in the error message refers to the dbus endpoint, not to the network interface.
Exactly. And the issue also only evolves around the org.freedesktop.Avahi.Server
interface of the org.freedesktop.Avahi
service. We use that to subscribe to the StateChanged
signal.
For our other commands we use the org.freedesktop.Avahi.Server
(to check the version and create a new entry group) and org.freedesktop.Avahi.EntryGroup
(adding the mDNS service and advertising it) interfaces. Though, in those instances we only do a request-response style of communication (in hap-nodejs this is implemented in AvahiAdvertiser.avahiInvoke
). The StateChanged
signal is the only occurrence where we actually subscribe to signals of an interface (implemented via AvahiAdvertiser.avahiInterface
.
The result is just a newline. The xml reads:
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
</node>
Hm. I mean, we could incorporate a workaround where we just don't care about hooking the StateChanged
listener, maybe printing a little warning if we can't explaining that we won't be able to detect restarts.
But I would really interested why this doesn't work on Synology.
It's not about dbus itself is it (idk difference in version etc)? Maybe there is some issue within dbus-native? But the response is completely empty, so something must be going wrong even before that.
$ dbus-daemon --version
D-Bus Message Bus Daemon 1.12.16
Copyright (C) 2002, 2003 Red Hat, Inc., CodeFactory AB, and others
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
That's an old one, my Raspberry Pi servers running bullseye report 1.12.24 (with the same 2002, 2003 copyright message).
$ avahi-daemon --version
avahi-daemon 0.7
Nothing here that we didn't already know.
ping @adriancable, any ideas on this?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I installed a workaround in the latest beta release of hap-nodejs 0.11.1 and homebridhe 1.6.1. See #1003.
Analysis
Homebridge v1.6.0, or rather HAP-NodeJS v0.11.0 doesn't work on my Synlogy. I'm getting an error
Could not create mDNS advertisement. The HAP-Server won't be discoverable: Error: No such interface found
Haven't changed anything on my config; reverting to Homebridge v1.5.9 / HAP-NodeJS v0.10.4 solves the issue. Using Avahi as advertiser. I'm running a DS920+ and a DS918+, both on DSM 7.1.1. Both use link aggregation; the interface name is ovs_bond0. The Homebridge UI does find this interface, and displays the network activity graph.Expected Behavior
HAP-NodeJS should advertise itself.
Steps To Reproduce
Upgrade Homebridge to v1.6.0 on Synology with
avahi
as advertiser.Logs
Configuration
Environment
Process Supervisor
hb-service
Additional Context
I think the check through
dbus
whether Avahi is running doesn't work on Synology. I do have adbus
process running, though.