Closed NN708 closed 5 years ago
Hi @NN708
Does homebridge bind with the intended interface?
please check.
opkg update
opkg install avahi-utils
avahi-browse -t _hap._tcp
It returns nothing. What should I do to bind with the interface?
Can you see the QR code that homebridge outputs in logread?
Yes, I can. I scanned the QR code with Home app, then it was searching for accessory, but finally no accessory was found.
hmm... You should see "_hap._tcp" if homebrige is started correctly. So I think homebridge is not running.
In my test environment:
~ # avahi-browse -t _hap._tcp
+ br-lan IPv4 Homebridge-CAD8 _hap._tcp local
~ # avahi-browse -rt _hap._tcp
+ br-lan IPv4 Homebridge-CAD8 _hap._tcp local
= br-lan IPv4 Homebridge-CAD8 _hap._tcp local
hostname = [CC_22_3D_E3_CE_30.local]
address = [172.17.0.2]
port = [33291]
txt = ["sh=hJpPnw==" "sf=1" "ci=2" "ff=0" "s#=1" "c#=2" "id=CC:22:3D:E3:CE:30" "pv=1.0" "md=Homebridge"]
I run ps | grep homebridge
and that shows it is running. Also, the port of Homebridge is seen open on another computer.
hmm... It is a curious condition.
avahi-browse -t _hap._tcp
It does not work if _hap._tcp service is not registered.
Please check the simple check of avahi.
opkg install avahi-daemon-service-ssh
/etc/init.d/avahi-daemon restart
avahi-browse -at
There are something about OpenWrt:
root@OpenWrt:~# avahi-browse -at
+ wlan1 IPv6 OpenWrt _ssh._tcp local
+ wlan0 IPv6 OpenWrt _ssh._tcp local
+ br-lan IPv6 OpenWrt _ssh._tcp local
+ br-lan IPv4 OpenWrt _ssh._tcp local
+ eth0 IPv6 OpenWrt _ssh._tcp local
It's a homebridge side problem because avahi seems to be working.
Which network interface do you want to use?
br-lan IPv4 OpenWrt
correct?
Yes
I'm trying to find the Homebridge log file. Homebridge Wiki says:
Homebridge logs to two places: /var/log/homebridge.log /var/log/homebridge.err
But I can't find these files. Where are they on OpenWrt?
But I can't find these files. Where are they on OpenWrt?
All logs are in ring buffer memory. Using logread command is the Openwrt style. :)
I tried to add "mdns": {"interface": "192.168.1.1"}
to my config.json, but in avahi-browse -a
there are still nothing. The good news is, the Home app prompts "Uncertified Accessory" now, but after I press "Add Anyway", it says "Home couldn't connect to this accessory".
How about this command
avahi-browse -t _hap._tcp
Check accessories and platforms in config.json. Try restarting your homebridge, see below https://github.com/nfarina/homebridge#my-ios-app-cant-find-homebridge
I have already read and tried it, but no use. I think the problem is that Homebridge didn't broadcast via avahi, but it didn't give out any error message...
[FYI] The default config.json path of the OpenWrt homebridge package is
/usr/share/homebridge/config.json
and The privilege to operate is "homebridge" user.
check
/etc/avhi/avahi-daemon.conf
specify
allow-interfaces=br-lan
It didn't solve the problem. And there's a warning with avahi-daemon:
*** WARNING: Detected another IPv4 mDNS stack running on this host. This makes mDNS unreliable and is thus not recommended. ***
killall avahi-daemon
/etc/init.d/avahi-daemon start
then
/etc/init.d/homebridge restart
Interesting... homebridge bind udp 5353
This procedure may be necessary if you want to restart avahi-daemon.
/etc/init.d/homebridge stop
/etc/init.d/avahi-daemon restart
/etc/init.d/homebridge start
Now the Home app can discover Homebridge on OpenWrt, so perhaps it is not the problem with avahi...
What's more, I tried to run Homebridge my Raspberry Pi again and there's no _hap._tcp in avahi-browse -a
, but I can connect to it normally.
It does not appear in "-at" even in my environment. Please check with "-t _hap._tcp"
@NN708 If possible, I hope you publish a summary of the solution.
Thank you.
There isn't any solution so far... Home app can only "discover" Homebridge, but can't connect to it...
Home app can find the accessory: Then I try to connect to it: But failed: Looks like some connection issues between Home app and Homebridge...
Ping youre iPhone from the OpenWrt host and check continuity.
This may also be useful for problem solving.
iPhone app - Discovery - DNS-SD Browser https://apps.apple.com/us/app/discovery-dns-sd-browser/id305441017
A common thing to try in case of home bridge connection problem is disable IPv6, restart the router, disable IGMP snooping setting on the router.
Thank you for your suggestions. Ping is OK, and I found that when I try to connect Homebridge in my Home app, the CPU usage increases to 50% (normally it is about 2%). That indicates there’s no connection problem between iOS and Homebridge. Now I guess, perhaps the issue is related to the low performance of my router (It has only 128M RAM). It takes the router more than 20 seconds to start the Homebridge process, which is normally under 5 seconds on my Raspberry Pi. If Homebridge doesn’t respond in time, the Home app may think the connection is lost.
I have a similar experience. It tries to register to home.app many times and succeeds. It works well once registered.
There are also problems with key generation, so can you try it?
opkg install haveged
I tried to use haveged, but it didn’t solve the problem.
I tested with my home router.
CPU: QCA9563 @ 775 MHz Mem: 128MB
I have run homebridge in debug mode. As a result, connected to HAPServer from the iOS side and found that the session timed out while homebridge Pairing. (60s)
It seems to be a specification on the iOS side. https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1408259-timeoutintervalforrequest?language=objc
homebridge works fine with raspberry pi zero w + openwrt (head). Also it worked in the past with AR9331 400MHz 64MB. (lede-17.01, node-v6, homebridge[unknown old version])
I found that the problem also exists in pairing with accessories (using plugin). The pairing timed out on OpenWrt, but works fine on Raspberry Pi.
I also tried to pair on Raspberry Pi first, and then copy Homebridge /persist files to OpenWrt, but it didn’t work.
Stop using the avahi package and I will try "mdnsresponder" package or "umdns" package. It will take some time to test.
It seems that there has been a change in hap-nodejs. The old precompiled binary module is no longer used. There seems to be a difference in performance.
https://github.com/KhaosT/HAP-NodeJS/commit/47966d13cfea35ce7acb4b0780faaae745eef69c#diff-b9cfc7f2cdf78a7f4b91a753d10865a2 https://github.com/KhaosT/HAP-NodeJS/commit/2a66d6fa58a51ae87346dfcae063696d0352b47f#diff-b9cfc7f2cdf78a7f4b91a753d10865a2
So we have to compile TweetNaCl.js first?
Changed to be able to select the old hap-nodejs module. (I have not tested it in my environment yet.)
https://github.com/nxhack/openwrt-node-packages/blob/master/node-hap-nodejs/Makefile
OK, I will try it later.
I tried HAP-NodeJS 0.4.49, but it has the same problem.
I tested on raspberry pi zero w with openwrt head and homebridge of community package, but I could connect easily. As you may have guessed it is a problem with floating point computing power at key generation.
I will mention in README.md that it often does not work in environments where mips fpu emu is used.
I will close the issue. Don't hesitate to re-open it if you still have the issue.
I have the same problems like yours,i used homekit-bridge,have you successfuly run it in openwrt? @NN708 I have tried run it on ar9558 and mt7621 devices,but it still can not be connected.
Sadly, no. I’m using my Raspberry Pi instead.
what a shame.I still can not figure out why after trying so many ways.
I am using OpenWrt 18.06.2 on Netgear R6220, with FPU emulator enabled. I compiled OpenWrt with node, node-npm, node-hap-nodejs, node-homebridge and avahi-dbus-daemon. However, after installation, I cannot find Homebridge in my iOS Home app. I run
logread | fgrep homebridge
andlogread | fgrep avahi-daemon
. It seems that they are working normally:I also tested the connection with Homebridge port and the port was open. Then I checked with
avahi-browse -at
and found out that there were nothing about Homebridge. However, my Raspberry Pi can still run Homebridge normally. What’s the problem? Did I omit any required packages?