kdietrich / homebridge-devolo

WARNING: this repo is not maintained anymore. Homebridge plugin for Devolo Home Control
16 stars 4 forks source link

Error: socket hang up #12

Closed KiboOst closed 7 years ago

KiboOst commented 7 years ago

Hi,

I'm using a docker homebridge image on Synology NAS with DSM6. The image: marcoraddatz/homebridge

Installed devolo plugin, got uuid, passkey and updated coonfig.json, but here is what I get:

Initializing Devolo platform... HBDevoloPlatform > Searching for Devolo Central Unit. HBDevoloPlatform > Central Unit found.

/usr/local/lib/node_modules/homebridge-devolo/dist/index.js:65 throw err; ^ Error: socket hang up at createHangUpError (_http_client.js:302:15) at Socket.socketCloseListener (_http_client.js:334:23) at emitOne (events.js:101:20) at Socket.emit (events.js:191:7) at TCP._handle.close [as _onclose] (net.js:511:12)

Any idea ?

KiboOst commented 7 years ago

Just to ad more infor, if I remove the platform devolo in config.json, all works and I can add homebridge on my iOS10 iPhone.

As soon as I add the Devolo in config.json, it crash after have find the central unit

kdietrich commented 7 years ago

Can you please start homebridge with the -D flag and provide a full log? I'll look into it. Thanks!

KiboOst commented 7 years ago

npm info using npm@4.2.0
npm info using node@v7.10.0
npm info ok
[6/20/2017, 2:59:11 PM] Loaded plugin: homebridge-devolo
[6/20/2017, 2:59:11 PM] Registering platform 'homebridge-devolo.Devolo'
[6/20/2017, 2:59:11 PM] ---
[6/20/2017, 2:59:11 PM] Loaded config.json with 0 accessories and 1 platforms.
[6/20/2017, 2:59:11 PM] ---
[6/20/2017, 2:59:12 PM] Loading 1 platforms...
[6/20/2017, 2:59:12 PM] [Devolo] Initializing Devolo platform...
[6/20/2017, 2:59:12 PM] [Devolo] HBDevoloPlatform > Initializing (Version: 201702221607)
[6/20/2017, 2:59:12 PM] [Devolo] HBDevoloPlatform > Configuration:
{ platform: 'Devolo',
name: 'Devolo',
host: '192.168.0.25',
email: 'xxx',
password: 'xxx',
uuid: 'xxx',
gateway: 'xxx',
passkey: 'xxx',
heartrate: 8 }
[6/20/2017, 2:59:12 PM] [Devolo] HBDevoloPlatform > Searching for Devolo Central Unit.
[6/20/2017, 2:59:12 PM] [Devolo] HBDevoloPlatform > Devolo API Version: 201702202047
[6/20/2017, 2:59:12 PM] [Devolo] HBDevoloCentralUnit > Initializing
[6/20/2017, 2:59:12 PM] [Devolo] HBDevoloPlatform > Central Unit found.
[6/20/2017, 2:59:12 PM] [Devolo] HBDevoloPlatform > SessionID: ID77DB5JnfJ5KGgpK60FlkLN7KkmM3ONibD32AEnd
/usr/local/lib/node_modules/homebridge-devolo/dist/index.js:65
throw err;
^

Error: socket hang up
at createHangUpError (_http_client.js:302:15)
at Socket.socketCloseListener (_http_client.js:334:23)
at emitOne (events.js:101:20)
at Socket.emit (events.js:191:7)
at TCP._handle.close [as _onclose] (net.js:511:12)

KiboOst commented 7 years ago

I just tested apt-get update/upgrade, all went fine, but still same error.

KiboOst commented 7 years ago

Any idea I could test ?

kdietrich commented 7 years ago

The error is raised when the first call to your local devolo gateway occurs. Are you sure that the IP address in config is right? Have you tried to ping the IP on the device that runs homebridge?

KiboOst commented 7 years ago

I will double check, but yes all is right, and it does say HBDevoloPlatform > Central Unit found and return passeky/uuid. The php API also works perfectly with same params.

kdietrich commented 7 years ago

Does it work with the session id that is output in the log file?

KiboOst commented 7 years ago

ah, interesting !! I will test that this evening when at home !

KiboOst commented 7 years ago

Ok, just did the test: homebridge -D copy sessionID paste it into php api -> it works

Could it be a socket not sending end message, or some timeout ?

ping to IP from homebridge device does answer 100%, around 2ms

KiboOst commented 7 years ago

Let me know if you have anything to test ;-)

KiboOst commented 7 years ago

Ok, just setup a raspberry Pi3 fresh raspbian with homebridge, exact same result.

[6/28/2017, 2:33:41 PM] [Devolo] HBDevoloPlatform > Searching for Devolo Central Unit. [6/28/2017, 2:33:41 PM] [Devolo] HBDevoloPlatform > Devolo API Version: 201702202047 [6/28/2017, 2:33:41 PM] [Devolo] HBDevoloCentralUnit > Initializing [6/28/2017, 2:33:41 PM] [Devolo] HBDevoloPlatform > Central Unit found. [6/28/2017, 2:33:41 PM] [Devolo] HBDevoloPlatform > SessionID: ID218DB8OcmDO6GopFP1EgdH89KdlL00EdpLKPHEnd /usr/lib/node_modules/homebridge-devolo/dist/index.js:65 throw err; ^

Error: socket hang up at createHangUpError (_http_client.js:302:15) at Socket.socketCloseListener (_http_client.js:334:23) at emitOne (events.js:101:20) at Socket.emit (events.js:191:7) at TCP._handle.close [as _onclose] (net.js:511:12)

Don't see what I could try ...

KiboOst commented 7 years ago

Just in case:

root@raspberrypi:/home/pi# wget 192.168.0.25/dhlp/portal/light --2017-06-29 18:33:17-- http://192.168.0.25/dhlp/portal/light Connecting to 192.168.0.25:80... connected. HTTP request sent, awaiting response... 401 Unauthorized Username/Password Authentication Failed.

All seems ok, any idea why it doesn't work ?

kdietrich commented 7 years ago

Which version are you on? master or latest release?

KiboOst commented 7 years ago

I guess master, I have retried again, this time following this: https://www.loggn.de/apple-home-homekit-devolo-geraete-mit-der-apple-app-steuern-homebridge/#comment-187331

installed with: npm install -g homebridge-devolo node 6.11.0 npm 3.10.10 Have tried with nearly all versions of nodes/npm, homebridge always works alone and but never got devolo running

KiboOst commented 7 years ago

Ok, tried on a full raspbian, exact same thing. Sorry, giving up, too much waste of time for me ...

kdietrich commented 7 years ago

All I can say is that the plugin - as is - is used in multiple environments without any issues. Is there a way you can give me SSH access to your raspberry? I'd really like to check what's going on.

KiboOst commented 7 years ago

How could I do that? I have a ddns and can map a port to the rasp IP but does ssh will follow ? Please send an email to kiboost thesign free point fr, won't give adress here

kdietrich commented 7 years ago

Sure, I'll ping you per mail when I'm free later!

KiboOst commented 7 years ago

ok, have access right with putty from exterior. We can connect on facebook for live discussion in needed, will test you in answer email. Thanks

kdietrich commented 7 years ago

I've contacted you per mail.

KiboOst commented 7 years ago

Many thanks Kevin, it now works ! Was a timeout in the node-devolo code, after increasing it, it now works both on Synology NAS Docker and Raspberry :-)

manix1979 commented 7 years ago

What line needs to be edited to get it work?

ramsnerm commented 7 years ago

What kind of changes did you made?

KiboOst commented 7 years ago

Hi,

You have to change the timeout value in this line:

req.setTimeout(10000, function () {
    req.connection.destroy();
});

in /usr/lib/node_modules/homebridge-devolo/node_modules/node-devolo/dist/DevoloApi.js