Open BetoRn opened 6 years ago
Just for the linux beginners.... What is exactly to do? Just install harmonyhubjs-client in version 1.16? How to remove dependencys of homebridge-harmonyhub folder? And finaly: What was your problem? The Error: MAX_CLIENTS=6 or the (XMPP authentication failure)? Does this trick solve both problems?
I'd be curious if it continues to stay up for you @BetoRn. I'm currently testing with a forked version where all that's changed is that dependency in packages.json.
@imsturmdernacht for install harmonyhubjs-client: sudo npm install -g harmonyhubjs-client@latest
for finding homebridge-harmonyhub folder: npm -g -l | grep harmony
and to remove sudo rm -r [homebridge-harmonyhub_folder]/node_modules/harmonyhubjs-client
@michaeldulrich i'm also curious to see if this works for someone else, or if I just have been lucky. i'm scared to even look at my pi and cause a crash, another day without crashes so far
@BetoRn I've only had it up 3 hours or so in a docker container, but so far no problems.
I'm excited. I made the changes and tried to force the crash. No crashes of the Homebridge yet. I will report again this evening.
Now I can definitely say the latest harmonyhubjs-client solves the xmpp issues. Homebridge-harmonyhub works again perfectly. Maybe @KraigM can update the plugins dependencies. Thanks for reporting @BetoRn
I'm running this fork - https://github.com/samsymons/homebridge-harmonyhub - where the only change is the harmonyhubjs-client dependency bump and haven't had any problems.
Please let this be true! I LOVED this plugin but had to remove it because it destroyed my HomeKit setup several times.
@michaeldulrich can you explain how to install the fork?
@VeniceNerd On standard homebridge, it might be best to follow @BetoRn's method.
I'm using https://github.com/oznu/docker-homebridge so I just added "yarn add https://github.com/samsymons/homebridge-harmonyhub" to my startup.sh file, which adds the plugin every time I start the container.
After running/testing for couple of days with the updated harmonyhub-client package I just started seeing the errors show up in my syslog. I had installed the harmonyhub-client (globally), uninstalled the homebridge-harmonyhub plugin, reinstalled the current version (1.1.10), then deleted the harmonyhub-client node directory from within the homebridge-harmonyhub node-modules directory. All was working well for a couple of days then "Error: MAX_CLIENTS=6" again. @michaeldulrich @BetoRn how is your testing coming along?
@ToddGreenfield I do see the "Error: MAX_CLIENTS=6" in my logs a few times, so maybe I'm just lucky that docker is just restarting the container when it errors like that?
I'll keep testing.
I run homebridge as a service on RPI and have it restart automatically on error as well. No docker though. I am seeing it error/crash a few times per day still.
So the crashing hasn’t been solved after all? I was so hopeful. :( Is this plug in no longer maintained? I loved it so much but the crashing really messes with my other homebridge plugins. Don’t want to risk that again.
I installed samsymons/homebridge-harmonyhub fork and rebooted my Harmony Hub. No crashes in the past few days on a Pi3 running the current version of Raspbian.
Also node-v=v8.9.4 And npm -v=5.6.0
I also run homebridge as a service, if it's crashing I haven't noticed. I'll take a look at the logs when i find some time. Before this, when homebridge crashed it used to take down the hole raspberrypi, that's not happening anymore.
The homebridge instance (running as a service) was still crashing/erroring with xmpp/core/stanza errors, but it doesn't take the whole RPI down with it. If you also run the homebridge-harmonyhub plugin in its own homebridge instance it also will not take everything else out with it, but at least in my case it does continue to error out/crash the instance a couple of times per day.
When using the latest harmonyhubjs-client package, I am still seeing crashing and errors in the syslog. Experimenting further along the lines of using the latest package releases, I updated node-xmpp-client and node-xmpp-stanza the same way. I am no longer seeing the wholesale crashes in the syslog file, but am now seeing the two errors like below. The homebridge service does NOT appear to crash from what I see in the syslogs and the plugin continues to work turning on/off my connected devices - so this is making some progress.
Jan 22 10:00:51 homepi-a homebridge[4144]: errorhub XMPP authentication failure Jan 22 10:00:51 homepi-a homebridge[4144]: errorhub XMPP authentication failure
I don't have time to research further right now, but will continue to monitor.
I think this is expected, here are the release notes for harmonyhubjs-client v1.1.9 it says
xmpp: Handle XMPP error events
It didn't fixed the errors, they are now being handled properly (so it won't crashes).
This library hasn't been updated since octuber 2016, so i think this is as close as we get on stability at least as long as homebridge-harmonyhub continues to use that for comunicating with the hub.
Many nodejs Harmony Hub related projects uses this same library.
The problem was NOT solved: yestrerday I reinstalled the plugin and in 24h, homebridge has crashed six times always wit the message "MAX CLIENTS"....
Right, I can confirm I am still seeing crashes again. It must have needed to run for a longer period. Unfortunate. I have completely removed all xmpp and harmony related packages. I recall from a while back reading that the older version of this plugin may work without issue - the only draw back is it does not do automatic discovery and the IP of the hub is needed. I will probably start testing that version later this week-
Please keep us updated. It’s unfortunate that this plug in keeps crashing homebridge. Really hoping for a solution!
I ran the earlier version for several months. My recollection is that it crashed somewhat less frequently than the newer plugin versions. I just installed the latest plugin and followed the aforementioned tips to mitigate the errors and crashing (the newer harmonyhubjs-client and removing old dependency).
And now I'm bummed to hear it hasn't fixed the crashing after all :-(
The good news is that if you powercycle your Harmony hub once a day (easy to schedule in middle of the night with a smart plug) and schedule Homebridge to restart daily as well (despite running as systemd service with auto-restart, still helps), then it's pretty much bullet proof.
In earlier versions there was the possibility to add each Harmony Hub separate in the config.json by name and IP address. Maybe this would help I think.
But does anyone know the syntax how to add more hubs separate in config.json and disable auto-discovery. I habe set static DHCP entries for my 2 Harmony Hubs on my router, so the IP addresses of the Hubs will not change.
When I was running the old 0.1.1 version, I explicitly defined the IP address of my hub in config.json--unfortunately, that doesn't help with regard to this bug.
But this would help at least against the bug of always saying "same UUID" right? How can I install version 0.1.1?
I don't recall what the "same UUID" bug is--can you give more details on that? To install a different version, just do "sudo npm -g install homebridge-harmonyhub@0.1.1" (or ...@0.2.0 or @latest, etc.)
That error appears every few hours, cause harmonyhub tried to add one of my two hubs twice and homebridge stops: `/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:264 throw new Error("Cannot add a bridged Accessory with the same UUID as another bridged Accessory: " + existing.UUID); ^
Error: Cannot add a bridged Accessory with the same UUID as another bridged Accessory: 71560c9f-f148-456f-8f6b-b2775394e008 `
You can't restart homebridge until you remove the accessories directory. But if you do that, you have to re-sort a lot in HomeKit. So that is no solution.
Do you have any plan how to solve that problem?
Oh, so that stems from having multiple hubs—I only have one, so I have experience with it. Perhaps that’s why the plugin’s rewrote the multihub code in later plugin versions. I think you can still define the hubs specifically by IP in the config.json in recent version of the plugin, so maybe you should try that to see if it helps your issue.
I did try now, but unfortunately I get the message at starting homebridge, that ip addressess are ignored, because now it is using only auto-discovery. and that auto-discovery brings up that problems.
so which is the last version which is running stable with 2 harmony hubs?
So I'm currently running the standard configuration of Harmony Hub in a dedicated Docker (to prevent the plugin to take down the rest of my HomeKit Automation) and I'm seeing this error message in my logs:
> errorhub { Error: connect ENETUNREACH 10.0.1.32:5222 - Local (0.0.0.0:0)
> at Object._errnoException (util.js:1022:11)
> at _exceptionWithHostPort (util.js:1044:20)
> at internalConnect (net.js:971:16)
> at net.js:1065:9
> at _combinedTickCallback (internal/process/next_tick.js:131:7)
> at process._tickCallback (internal/process/next_tick.js:180:9)
> code: 'ENETUNREACH',
> errno: 'ENETUNREACH',
> syscall: 'connect',
> address: '10.0.1.32',
> port: 5222 }
> errorhub { Error: connect ENETUNREACH 10.0.1.31:5222 - Local (0.0.0.0:0)
> at Object._errnoException (util.js:1022:11)
> at _exceptionWithHostPort (util.js:1044:20)
> at internalConnect (net.js:971:16)
> at net.js:1065:9
> at _combinedTickCallback (internal/process/next_tick.js:131:7)
> at process._tickCallback (internal/process/next_tick.js:180:9)
> code: 'ENETUNREACH',
> errno: 'ENETUNREACH',
> syscall: 'connect',
> address: '10.0.1.31',
> port: 5222 }
Is that the error message you guys are seeing? What is the cause of this?
For the most part that is the error. This is what I see in my logs:
This crashed homebridge: /usr/lib/node_modules/homebridge-harmonyhub/node_modules/node-xmpp-core/lib/Connection.js:355 var error = new Error('' + getAllText(stanza))
This did not: errorhub { Error: connect EHOSTUNREACH 192.168.0.19:5222 at Object._errnoException (util.js:1022:11) at _exceptionWithHostPort (util.js:1044:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14) code: 'EHOSTUNREACH', errno: 'EHOSTUNREACH', syscall: 'connect', address: '192.168.0.19', port: 5222 }
It's been about 5.5 days since performing the aforementioned possible fix, and I've yet to see any errors in Homebridge logs. At the very least, it's a hell of a lot more stable than it used to be.
Helo starlessblack Can you tell us what version you use in order not to crash Thank's
Well, I'm not 100% sure it'll stop the crashing for good, but it'll certainly delay it a lot longer than it used to. I'm running the latest version of the plugin--looks like 0.3.0-alpha.2.
Interestingly, when I run npm -g list depth=0
to get a list of all npm modules, it now shows these errors at the end of the output: npm ERR! missing: harmonyhubjs-client@github:e7hz3r0/harmonyhubjs-client, required by homebridge-harmonyhub@0.3.0-alpha.2 npm ERR! extraneous: node-xmpp-client@3.0.0 /usr/lib/node_modules/homebridge-harmonyhub/node_modules/node-xmpp-client npm ERR! extraneous: node-xmpp-stanza@1.1.0 /usr/lib/node_modules/homebridge-harmonyhub/node_modules/node-xmpp-stanza npm ERR! extraneous: q@1.5.1 /usr/lib/node_modules/homebridge-harmonyhub/node_modules/q
So I guess that's because it's no longer got the old harmonyhubjs-client folder in the harmonyhub plugin's subfolder...which is strange because I wondered how this fix would work if it didn't know where the newer one was.
If it can help, this the message error an version 03.0-alpha.2
Error: MAX_CLIENTS=6
at Connection.onStanza (/usr/lib/node_modules/homebridge-harmonyhub/node_modules/node-xmpp-core/lib/Connection.js:355:17)
at StreamParser.
So I finally got my first “xmpp authentication failure” message in logs this morning, after about 7.5 days uptime. I guess I’ll just continue to wait and see if and when it finally takes down Homebridge and/or the Pi.
Soooo, I did a little digging and found my router restarted yesterday morning a bit before I received that "xmpp authentication failure" error in the Homebridge logs...I'm guessing that it was probably due to the Harmony Hub and RaspberryPi losing wi-fi connectivity for a bit and, thus, communications with each other. Homebridge service still has not restarted, and everything still seems to be running fine at the moment. No further errors since then.
I received another couple xmpp authentication failure messages in logs yesterday, and it finally took Homebridge down, and it restarted itself.
Been doing a little more investigation this morning, and I'm wondering about the aforementioned fix in this thread. I installed the newer harmonyhubjs-client package, then removed the old client package from the homebridge-harmonyhub/node_modules folder, but then how does the harmonyhub plug use the new js-client package? How does it get registered as a dependency for the harmony plugin?
The reason I ask is because I happened to notice when running npm -g list
that the harmonyhub plugin has an "unmet dependency" error now.npm ERR! missing: harmonyhubjs-client@github:e7hz3r0/harmonyhubjs-client, required by homebridge-harmonyhub@0.3.0-alpha.2
Well, mine still crashes regularly. Seems to happen roughly daily--which is more frequently than I remember the 0.1.1 plugin crashing. For the moment, I'm back to nightly power-cycling my Harmony Hub via a smart plug and then restarting Homebridge a few minutes later.
For me it works randomly. Crashes on homebridge are constant, but that wouldn't be an issue as a run it as a service. Real problem is that now, it won't load again the scenes on restart and all buttons are unresponsive. If I clear cache, buttons vanish, of course. Then I need to power cycle the hub, reinstall plugins and then they're back on... for a couple of hours.
I guess i'll switch to IFTTT homebridge switches.
The thing is, even with Homebridge running as service set to restart on failure after 10 seconds, you're still looking at at least 30-45 seconds of Home app unresponsiveness while you wait for Homebridge to come back up and everything to get re-propagated and settled. You think 10 seconds is nothing until you experience the disruption right when you're trying to turn on or off some lightbulbs or something :)
I was going to use the IFTTT-to-Harmony arrangement, but once I landed on a powercycling/Homebridge-rebooting method that kept everything humming along, I just kept using the harmony plugin since it's faster than IFTTT commands sent from internet.
I had no more Homebridge crashes after removing the Harmony plugin. IFTTT does have a much bigger delay, but it's a reasonable trade-off for the peace of mind of your relatives not complaining all the time. =)
Yeah, I got rid of all my Homebridge crashing and kept my Harmony plugin functional by putting the Harmony hub on a smartplug (could also use a cheap light timer switch) that powercycles it in the middle of the night 1x a day and then setting crontab to reboot Homebridge service right afterwards and then once again 12hrs later. Ever since then it's solid as a rock.
I did come across someone in the Macrumors forums who said he's running Harmony plugin on Homebridge on a Raspberry Pi and has never had any problems with it. He claims it's never crashed on him since whittling down his Harmony activities to like 5 or 6. I tried just that thing a while back and it never made any difference. So who knows...guess he's one of the lucky ones :)
Luckily, I haven’t had any issues and I’m running 0.3.0-alpha 2. I have one Harmony Hub with only two activities and my Homebridge is running as an add-on for my Hassio (Home Assistsnt) setup. It’s been running for about a month now with no crashes. I was really concerned before setting it up based on this thread but for whatever reason, it’s been stable so far.
People. It’s a shame this plugin crashes that much. It one of the best plugins! It there anyone who uses a program who helps it auto restart it again when it crashes? If so please let me now how you did dat in de raspberry Pi.
I am heavily dependent on Homebridge as I use it for al the thinks I can’t do my own. I driving a electric wheelchair so I use it for opening doors, curtains, kitchen supplies... now I did try harmony it works for like a week and then crashes every minute so I removed it now. I’m thinking about a extra Pi with homedridge so it do not crash al my important things.
Any suggestions will help!
Yeah, I got rid of all my Homebridge crashing and kept my Harmony plugin functional by putting the Harmony hub on a smartplug (could also use a cheap light timer switch) that powercycles it in the middle of the night 1x a day and then setting crontab to reboot Homebridge service right afterwards and then once again 12hrs later. Ever since then it's solid as a rock.
Oh, and I use the old 0.1.1 plugin, since it’s more stable than the newer versions.
Yeah I was thinking about that to... but there is not a digital way of killing Homebridge en restart it again every 12h? Where can I download the older version?
I use Putty on my PC and start HOMEBRIDGE : Redemarrge HOMEKIT toutes les 30 sec bash -c 'while [ 0 ]; do homebridge; sleep 30; done'
For those of you experiencing crashing issues - do you have multiple Harmony Hubs?
I've been running this plugin for over a month now without a crash but I'm only running one Harmony Hub. I'm also running Homebridge as an add-on to Home Assistant, but I don't think that should really matter. I was thinking about picking up another Harmony Hub but I'm thinking this issue is when multiple hubs are running.
While not ideal, another solution might be to run something like Home Assistant and use the Harmony component. Now that Home Assistant has "native" HomeKit support (i.e. you don't need to use Homebridge), you can just expose the Harmony activities as switches through Home Assistant which will show up in HomeKit.
This plugin installs version 1.1.6 of harmonyhubjs-client library, later versions have addressed the xmpp errors not beign handled.
So, I installed the latest harmonyhubjs-client version and removed the dependency under homebridge-harmonyhub installation folder, homebridge has been running for a week without issues.