KraigM / HomeBridgeController

Provides a simplified UI for controlling your HomeBridge
87 stars 7 forks source link

Crash after first "restart hub" through Controller Link #55

Open JangoBritt opened 8 years ago

JangoBritt commented 8 years ago

Hey Kraig, I'v just used ControllerLink to modify my config for the first time...

I added Applescript-file, iTunes, cmdSwitch2.

I then added the iTunes platform, and restarted the hub.

Now every time I load homebridge, I get this error:

`events.js:141 throw er; // Unhandled 'error' event ^

Error: listen EADDRINUSE :::51828 at Object.exports._errnoException (util.js:870:11) at exports._exceptionWithHostPort (util.js:893:20) at Server._listen2 (net.js:1234:14) at listen (net.js:1270:10) at Server.listen (net.js:1366:5) at tryCatcher (/usr/local/lib/node_modules/homebridge-controllerlink/node_modules/bluebird/js/release/util.js:16:23) at Function.Promise.fromNode.Promise.fromCallback (/usr/local/lib/node_modules/homebridge-controllerlink/node_modules/bluebird/js/release/promise.js:176:30) at Server.startAsync (/usr/local/lib/node_modules/homebridge-controllerlink/lib/server.js:113:11) at Object.HomeBridgeControllerLink.accessories (/usr/local/lib/node_modules/homebridge-controllerlink/index.js:34:15) at Server._loadPlatformAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:333:20) at Server._loadPlatforms (/usr/local/lib/node_modules/homebridge/lib/server.js:277:16) at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:71:36) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) `

KraigM commented 8 years ago

Are you sure it's not already up and running in the background?

Do you have something setup to auto start HomeBridge if it stops? The controller link is designed to restart it by default so if two things try starting it, it will fail.

The only other thing I can think of is that maybe it never quit it the first time and the orig is still running?

JangoBritt commented 8 years ago

OK, yes I see... a reboot fixed that.

I notice though, that on a reboot, the controllerlink takes over the running of homebridge, from my terminal window... Is there any way to get it to do this from the very beginning? or to do it on boot-up?

KraigM commented 8 years ago

Not yet. But if the thing that auto starts for you on boot is handling restarting when it goes out (crash, manual close, etc), then you can configure the link to not auto respawn. That way restarts via the app will only stop homebridge. The config is: "restartStyle": "stopOnly"

Save that config and then reboot (so your launch agent or whatever will restart homebridge). After that you should be able to restart from HBC

KraigM commented 8 years ago

See the link plugin README for more info on the config

JangoBritt commented 8 years ago

Cheers Kraig.

If the Homebridge is respawned on restart from the controller, Does the controller app have to stay open, or is it a separate background process?

KraigM commented 8 years ago

@JangoBritt No the controller app is completely separate. The respawn even works remotely (from diff machine)

JangoBritt commented 7 years ago

So... I never closed this issue, because it still happens from time-to-time, and only a reboot will solve it.

Even with "restartStyle": "stopOnly", every time I kill the homebridge process from the Process monitor, it always restarts another one. For some reason then, there's no way to clear down port 51828, without rebooting the mac.