caseyjhol / node-red-contrib-tplink

A collection of Node-RED nodes for TP-Link Smart Home devices
https://www.npmjs.com/package/node-red-contrib-tplink-iot
MIT License
16 stars 15 forks source link

TCP Timeout/connect EHOSTUNREACH #24

Closed caseyjhol closed 4 years ago

caseyjhol commented 4 years ago

I keep getting this TCP Timeout error for my switches. It's pretty inconsistent, but it often results in my sequences that depend on events not completing correctly. I increased the event interval for all of my switches to 30 seconds, and that certainly helped reduce how often the errors appear, but it didn't fix the issue.

I mentioned it here: https://github.com/plasticrake/tplink-smarthome-api/issues/77#issuecomment-643574892. Ultimately, I think this might be an issue with plasticrake/tplink-smarthome-api.

TCP 192.168.1.83:9999 Error: TCP Timeout
    at Timeout._onTimeout (/config/node-red/node_modules/tplink-smarthome-api/lib/network/tcp-socket.js:62:22)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7)

...

TCP 192.168.1.83:9999 Error: connect EHOSTUNREACH 192.168.1.83:9999
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1134:16) {
  errno: 'EHOSTUNREACH',
  code: 'EHOSTUNREACH',
  syscall: 'connect',
  address: '192.168.1.83',
  port: 9999
}

Is anybody else getting this?

hufftheweevil commented 4 years ago

I also noticed this the other day. Oddly enough, I just happened to come across some information at almost the same exact time. The info (which I can't seem to find now - I'm still looking for it) said that if you are encountering this problem, then set the Node-RED setting socketTimeout: 15000 in the settings.json file. It seemed to have fixed the problem for me.

caseyjhol commented 4 years ago

Thanks! I'll give that a shot.

caseyjhol commented 4 years ago

Hrmm...still getting the error. Just bumped the socketTimeout up to 120000 (2 mins). Will see what happens.

Edit: Error still happening with socketTimeout of 120000. Looks like that's the default...so no surprise there haha.

hufftheweevil commented 4 years ago

Should be all fixed now with the latest improvements. I think we can close this?

caseyjhol commented 4 years ago

Yes - especially after I made some adjustments to my wireless router to lock in 2.4Ghz on the least crowded channel.