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 Socket Closed and Connection Refused errors #46

Open jerbzz opened 3 years ago

jerbzz commented 3 years ago

Problem enconutered I'm using multiple kasa nodes (four, and then one in a subflow which appears 7 times) at different points in my flow to control a single HS100. I have another HS100 and a HS110 on my network but they are not configured in any of the kasa nodes.

I'm getting repeated errors in the Node-RED debug panel immediately after deploying the flow (this is with kasa node debug turned on):

Error connecting to device 192.168.1.112: Error: TCP Socket Closed. segment:0 hadError:false

The nodes do work - for a period of time measured in minutes or hours, and then stop working completely. Sending input does not result in the device responding and there is no output from the node. Redeploying just the node which is borked seems to get things moving again. I'm having a hard time confirming, but I don't think all the nodes stop working at the same time.

Once the node has stopped working, it's this error in the debug panel:

Polling error for 192.168.1.112: Error: connect ECONNREFUSED 192.168.1.112:9999

I have disabled polling on all but one of the nodes, which is set to 15000/10000. This hasn't seemed to make any difference - if anything, it's worse now.

Happy to share my flow if that would be helpful.

OS: Raspbian buster on Pi 3B+

jerbzz commented 3 years ago

I should add that throughout this, the Kasa app still seems to be able to do the business.

rakgupta commented 3 years ago

I am seeing this in my logs (where XXX.XX.X.XXX is the IP address of TPLink HS105) - everything seems to work (MacOS - High Sierra)

TCP XXX.XX.X.XXX:9999 Error: TCP Socket Closed. segment:0 hadError:false at Socket. (/Users/rakesh/.node-red/node_modules/tplink-smarthome-api/lib/network/tcp-socket.js:104:31) at Object.onceWrapper (events.js:284:20) at Socket.emit (events.js:196:13) at TCP. (net.js:586:12) [Hubitat Plug] device.send() Error: TCP Socket Closed. segment:0 hadError:false at Socket. (/Users/rakesh/.node-red/node_modules/tplink-smarthome-api/lib/network/tcp-socket.js:104:31) at Object.onceWrapper (events.js:284:20) at Socket.emit (events.js:196:13) at TCP. (net.js:586:12)

jerbzz commented 3 years ago

I saw that on another issue you posted.

The difference is, I think, that the node stops working for me.

Botched1 commented 3 years ago

For the record, I see the same thing on 2 KP115 units when getting energy readings @ 10s. They just stop updating after after a few days. Reload the node (typically I check/unckeck debug logging in the node and reload) then it will work again for a few days.