danielwippermann / resol-vbus

A JavaScript library for processing RESOL VBus data
MIT License
67 stars 34 forks source link

TcpConnection socket unable to connect #37

Closed fsnaps closed 4 years ago

fsnaps commented 4 years ago

Hi,

I've used the library with success for one year peer with a Resol Vbus Lan Adapter. Sadly, since a few days, the tcp connection can't be established anymore: The error is the following: Error: Unable to connect at onSocketTermination (*****/tcp-connection.js:336:16) at Socket.OnError (*****/tcp-connection.js:367:9) at Socket.emit (events.js:189:13) at emitErrorNT (internal/streams/destroy.js:82:8) at emitErrorAndCloseNT (internal/streams/destroy.js:50:3) at process._tickCallback (internal/process/next_tick.js:63:19)

I've checked the wiring and everything seems find on that side.

When I press the reset button on the device, I'm able to reconnect and read data, but when I close the connection, I'm unable to re-connect. The device seems to be still working/connected (led active) even though the program exited.

I activated some log on the tcp-connection.js class and force connect, but it seems that I'm stuck at the PASS instruction: onData +HELLO

onLine phase:0 newPhase:40 onData +HELLO

onLine phase:0 newPhase:40 onData +HELLO

danielwippermann commented 4 years ago

Hi @fsnaps!

Hmmm, you could console.log the error that is passed into the socket.onError callback to find out what causes the socket termination.

My best guess would be that some other consumer tries to connect to the VBus/LAN adapter as well. The adapter only supports one active connection at any time. So if you have multiple consumers trying to connect to the same adapter, they will kill off each others connections, resulting in "connection reset" errors...

fsnaps commented 4 years ago

Hi Daniel,

Thanks for your feedback. Following your guess, I've changed the ip address of the device and now my cron job is working again. I still have no idea of which process was locking the connection, but that's another issue.

Anyway, thanks again for your hint.

Cheers