homebridge-tplink-smarthome icon indicating copy to clipboard operation
homebridge-tplink-smarthome copied to clipboard

ECONNRESET during startup with HS300 power strip

Open Tom-Dibble opened this issue 1 year ago • 8 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

What happened?

On HomeBridge restart, I get errors like the following:

What, if anything, has recently changed?

Issue showed up on initial install (and each restart of HomeBridge after that). The HS300 is a 6-outlet strip; the error appears for two of the 6 outlets (note that all six are on and under load).

[2/12/2024, 8:55:58 PM] [KasaSmart.API] TCP [[ip address]]:9999 Error: connect ECONNRESET [[ip address]]:9999
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'connect',
  address: '[[ip address]]',
  port: 9999
}

Note that [[ip address]], [[uuid]] and [[id]] have been used throughout to mask off ip addresses, uuids, and device ids, respectively; contact me if the non-masked values are relevant.

Interestingly, in 4 restarts of HomeBridge the two outlets in the log below (these are outlets 1 and 6 on the strip) 3 times; the third restart a different two outlets gave the same errors (outlets 5 and 4 on the strip).

After startup, all outlets appear to be exposed in HomeKit, and even the extra power-usage value is available for them in the Eve app. Other than the errors in the logs, I don't see any issues with them.

Version

v8.0.2

Node Version

v18.19.0

Homebridge Version

1.7.0

Which OS/Platform?

Docker (Linux)

Relevant log output

[2/12/2024, 8:55:36 PM] [Homebridge UI] Changes to config.json saved.
[2/12/2024, 8:55:42 PM] [Homebridge UI] Homebridge restart request received
[2/12/2024, 8:55:42 PM] [Homebridge UI] UI / Bridge settings have not changed; only restarting Homebridge process
[2/12/2024, 8:55:42 PM] [Homebridge UI] Sending SIGTERM to Homebridge
[2/12/2024, 8:55:42 PM] Got SIGTERM, shutting down Homebridge...
[2/12/2024, 8:55:47 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null
[2/12/2024, 8:55:52 PM] [HB Supervisor] Restarting Homebridge...
[2/12/2024, 8:55:52 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /var/lib/homebridge/node_modules --strict-plugin-resolution
[2/12/2024, 8:55:52 PM] [HB Supervisor] Started Homebridge v1.7.0 with PID: 25488
[2/12/2024, 8:55:54 PM] Loaded config.json with 3 accessories and 4 platforms.
[2/12/2024, 8:55:54 PM] Loaded 9 cached accessories from cachedAccessories.
[2/12/2024, 8:55:54 PM] ---
[...]
[2/12/2024, 8:55:55 PM] Loaded plugin: [email protected]
[2/12/2024, 8:55:55 PM] Registering platform 'homebridge-tplink-smarthome.TplinkSmarthome'
[2/12/2024, 8:55:55 PM] ---
[2/12/2024, 8:55:55 PM] Loading 4 platforms...
[...]
[2/12/2024, 8:55:56 PM] [KasaSmart] Configuring cached accessory: [Terrarium Top Lamp] UUID: [[uuid]] deviceId: [[id]] 
[2/12/2024, 8:55:56 PM] [KasaSmart] Configuring cached accessory: [Terrarium Bottom Left Light] UUID: [[uuid]] deviceId: [[id]] 
[2/12/2024, 8:55:56 PM] [KasaSmart] Configuring cached accessory: [Terrarium Bottom Right Light] UUID: [[uuid]] deviceId: [[id]] 
[2/12/2024, 8:55:56 PM] [KasaSmart] Configuring cached accessory: [Terrarium Bottom LED Strips] UUID: [[uuid]] deviceId: [[id]] 
[2/12/2024, 8:55:56 PM] [KasaSmart] Configuring cached accessory: [Terrarium Bottom Heater] UUID: [[uuid]] deviceId: [[id]] 
[2/12/2024, 8:55:56 PM] [KasaSmart] Configuring cached accessory: [Terrarium Top Heaters] UUID: [[uuid]] deviceId: [[id]]
[...]
[2/12/2024, 8:55:56 PM] Homebridge v1.7.0 (HAP v0.11.1) (Homebridge 3B11) is running on port 51899.
[2/12/2024, 8:55:56 PM] [KasaSmart] Device First Online: [Terrarium Top Lamp] plug [[[id]]] [[ip address]] 9999
[2/12/2024, 8:55:56 PM] [KasaSmart] Adding: [Terrarium Top Lamp] plug [[[id]]]
[2/12/2024, 8:55:56 PM] [KasaSmart] [Terrarium Top Lamp] Removing stale Characteristic: [Outlet.Brightness] uuid:[[[uuid]]]
[2/12/2024, 8:55:56 PM] [KasaSmart] Device First Online: [Terrarium Bottom Left Light] plug [[[id]]] [[ip address]] 9999
[2/12/2024, 8:55:56 PM] [KasaSmart] Adding: [Terrarium Bottom Left Light] plug [[[id]]]
[2/12/2024, 8:55:56 PM] [KasaSmart] [Terrarium Bottom Left Light] Removing stale Characteristic: [Outlet.Brightness] uuid:[[[uuid]]]
[2/12/2024, 8:55:56 PM] [KasaSmart] Device First Online: [Terrarium Bottom Right Light] plug [[[id]]] [[ip address]] 9999
[2/12/2024, 8:55:56 PM] [KasaSmart] Adding: [Terrarium Bottom Right Light] plug [[[id]]]
[2/12/2024, 8:55:56 PM] [KasaSmart] [Terrarium Bottom Right Light] Removing stale Characteristic: [Outlet.Brightness] uuid:[[[uuid]]]
[2/12/2024, 8:55:56 PM] [KasaSmart] Device First Online: [Terrarium Bottom LED Strips] plug [[[id]]] [[ip address]] 9999
[2/12/2024, 8:55:56 PM] [KasaSmart] Adding: [Terrarium Bottom LED Strips] plug [[[id]]]
[2/12/2024, 8:55:56 PM] [KasaSmart] [Terrarium Bottom LED Strips] Removing stale Characteristic: [Outlet.Brightness] uuid:[[[uuid]]]
[2/12/2024, 8:55:56 PM] [KasaSmart] Device First Online: [Terrarium Bottom Heater] plug [[[id]]] [[ip address]] 9999
[2/12/2024, 8:55:56 PM] [KasaSmart] Adding: [Terrarium Bottom Heater] plug [[[id]]]
[2/12/2024, 8:55:56 PM] [KasaSmart] [Terrarium Bottom Heater] Removing stale Characteristic: [Outlet.Brightness] uuid:[[[uuid]]]
[2/12/2024, 8:55:56 PM] [KasaSmart] Device First Online: [Terrarium Top Heaters] plug [[[id]]] [[ip address]] 9999
[2/12/2024, 8:55:56 PM] [KasaSmart] Adding: [Terrarium Top Heaters] plug [[[id]]]
[2/12/2024, 8:55:56 PM] [KasaSmart] [Terrarium Top Heaters] Removing stale Characteristic: [Outlet.Brightness] uuid:[[[uuid]]]
[...]
[2/12/2024, 8:55:58 PM] [KasaSmart.API] TCP [[ip address]]:9999 Error: connect ECONNRESET [[ip address]]:9999
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'connect',
  address: '[[ip address]]',
  port: 9999
}
[2/12/2024, 8:55:58 PM] [KasaSmart.API] [Terrarium Top Heaters] device.send() Error: connect ECONNRESET [[ip address]]:9999
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'connect',
  address: '[[ip address]]',
  port: 9999
}
[2/12/2024, 8:55:58 PM] [KasaSmart] [Terrarium Top Heaters] {"errno":-104,"code":"ECONNRESET","syscall":"connect","address":"[[ip address]]","port":9999}
[2/12/2024, 8:55:58 PM] [KasaSmart] [Terrarium Top Heaters] {"errno":-104,"code":"ECONNRESET","syscall":"connect","address":"[[ip address]]","port":9999}
[2/12/2024, 8:55:58 PM] [KasaSmart.API] TCP [[ip address]]:9999 Error: connect ECONNRESET [[ip address]]:9999
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'connect',
  address: '[[ip address]]',
  port: 9999
}
[2/12/2024, 8:55:58 PM] [KasaSmart.API] [Terrarium Top Heaters] device.send() Error: connect ECONNRESET [[ip address]]:9999
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'connect',
  address: '[[ip address]]',
  port: 9999
}
[2/12/2024, 8:55:58 PM] [KasaSmart] [Terrarium Top Heaters] {"errno":-104,"code":"ECONNRESET","syscall":"connect","address":"[[ip address]]","port":9999}
[2/12/2024, 8:55:58 PM] [KasaSmart] [Terrarium Top Heaters] {"errno":-104,"code":"ECONNRESET","syscall":"connect","address":"[[ip address]]","port":9999}
[2/12/2024, 8:55:58 PM] [KasaSmart] [Terrarium Top Heaters] {"errno":-104,"code":"ECONNRESET","syscall":"connect","address":"[[ip address]]","port":9999}
[2/12/2024, 8:55:58 PM] [KasaSmart] [Terrarium Top Heaters] {"errno":-104,"code":"ECONNRESET","syscall":"connect","address":"[[ip address]]","port":9999}
[2/12/2024, 8:55:58 PM] [KasaSmart] [Terrarium Top Heaters] {"errno":-104,"code":"ECONNRESET","syscall":"connect","address":"[[ip address]]","port":9999}
[2/12/2024, 8:55:58 PM] [KasaSmart.API] TCP [[ip address]]:9999 Error: TCP Socket Closed. segment:0 hadError:false
    at Socket.<anonymous> (/homebridge/node_modules/homebridge-tplink-smarthome/node_modules/tplink-smarthome-api/src/network/tcp-socket.ts:128:19)
    at Object.onceWrapper (node:events:632:26)
    at Socket.emit (node:events:517:28)
    at TCP.<anonymous> (node:net:350:12)
[2/12/2024, 8:55:58 PM] [KasaSmart.API] [Terrarium Top Lamp] device.send() Error: TCP Socket Closed. segment:0 hadError:false
    at Socket.<anonymous> (/homebridge/node_modules/homebridge-tplink-smarthome/node_modules/tplink-smarthome-api/src/network/tcp-socket.ts:128:19)
    at Object.onceWrapper (node:events:632:26)
    at Socket.emit (node:events:517:28)
    at TCP.<anonymous> (node:net:350:12)
[2/12/2024, 8:55:58 PM] [KasaSmart] [Terrarium Top Lamp] {}
[2/12/2024, 8:55:58 PM] [KasaSmart] [Terrarium Top Lamp] {}

Configuration

{
    "name": "KasaSmart",
    "addCustomCharacteristics": true,
    "inUseThreshold": 0,
    "deviceTypes": [
        "plug",
        "bulb"
    ],
    "devicesUseDiscoveryPort": false,
    "platform": "TplinkSmarthome"
}

Tom-Dibble avatar Feb 13 '24 02:02 Tom-Dibble

Same issue here. This started happening a few days ago.

LazaroFilm avatar Mar 01 '24 00:03 LazaroFilm

Isn't that same error as described https://github.com/plasticrake/homebridge-tplink-smarthome/issues/246 ?

shaarkys avatar Mar 05 '24 10:03 shaarkys

I changed over to UDP communication and the errors have gone away.

ZeliardM avatar Mar 12 '24 18:03 ZeliardM

@ZeliardM how did you do so?

roberkane212 avatar Mar 12 '24 20:03 roberkane212

I changed over to UDP communication and the errors have gone away.

So far, I can confirm this does indeed silence the errors. Thanks for sharing it.

@ZeliardM how did you do so?

In Plugin Config, under Advanced Settings flip Transport from None to UDP and restart Homebridge or the child bridge.

owine avatar Mar 12 '24 20:03 owine

@owine thank you!!

roberkane212 avatar Mar 12 '24 20:03 roberkane212

Thanks @owine!

ZeliardM avatar Mar 12 '24 23:03 ZeliardM

I changed over to UDP communication and the errors have gone away.

So far, I can confirm this does indeed silence the errors. Thanks for sharing it.

@ZeliardM how did you do so?

In Plugin Config, under Advanced Settings flip Transport from None to UDP and restart Homebridge or the child bridge.

I have done this. it seems to happen less frequently but is still happening. Restarting HomeBridge seems to solve it.

LazaroFilm avatar Mar 25 '24 14:03 LazaroFilm