jfarmer08 / homebridge-wyze-smart-home

Wyze Smart Home plugin for Homebridge.
MIT License
103 stars 17 forks source link

Error: Client network socket disconnected before secure TLS connection was established #102

Closed MrMMcGowen closed 1 year ago

MrMMcGowen commented 1 year ago

Describe The Bug:

Homebridge logs shows errors where the client network socket disconnects before secure TLS connection was established. Child bridge process restarts and produces same error message. Happens a few more times before eventually connecting again for a while, then cycle happens again.

To Reproduce:

Constant

Expected behavior:

Client network socket maintains a connection while establishing a secure TLS connection.

Logs:

[04/06/2023, 11:30:01] [Wyze] Request failed: Error: Client network socket disconnected before secure TLS connection was established [04/06/2023, 11:30:01] [Wyze] Error: Client network socket disconnected before secure TLS connection was established at connResetException (node:internal/errors:717:14) at TLSSocket.onConnectEnd (node:_tls_wrap:1595:19) at TLSSocket.emit (node:events:525:35) at endReadableNT (node:internal/streams/readable:1359:12) at processTicksAndRejections (node:internal/process/task_queues:82:21) { code: 'ECONNRESET', path: null, host: 'api.wyzecam.com', port: 443, localAddress: undefined, config: { url: 'app/v2/home_page/get_object_list', method: 'post', data: '{"access_token”:”xxxxx”,”app_name":"com.hualai.WyzeCam","app_ver":"com.hualai.WyzeCam___2.18.44","app_version":"2.18.44","phone_id”:”xxxxxx”,”phone_system_type":"1","sc":"9f275790cab94a72bd206c8876429f3c","sv":"9d74946e652647e9b6c9d59326aef104","ts":1685892541086}', headers: { Accept: 'application/json, text/plain, /', 'Content-Type': 'application/json', 'User-Agent': 'axios/0.21.4', 'Content-Length': 494 }, baseURL: 'https://api.wyzecam.com', transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, adapter: [Function: httpAdapter], xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, validateStatus: [Function: validateStatus], transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false } }, request: <ref *1> Writable { _writableState: WritableState { objectMode: false, highWaterMark: 16384, finalCalled: false, needDrain: false, ending: false, ended: false, finished: false, destroyed: false, decodeStrings: true, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: true, bufferProcessing: false, onwrite: [Function: bound onwrite], writecb: null, writelen: 0, afterWriteTickInfo: null, buffered: [], bufferedIndex: 0, allBuffers: true, allNoop: true, pendingcb: 0, constructed: true, prefinished: false, errorEmitted: false, emitClose: true, autoDestroy: true, errored: null, closed: false, closeEmitted: false,

},
_events: [Object: null prototype] {
  response: [Function: handleResponse],
  error: [Function: handleRequestError]
},
_eventsCount: 2,
_maxListeners: undefined,
_options: {
  maxRedirects: 21,
  maxBodyLength: 10485760,
  protocol: 'https:',
  path: '/app/v2/home_page/get_object_list',
  method: 'POST',
  headers: [Object],
  agent: undefined,
  agents: [Object],
  auth: undefined,
  hostname: 'api.wyzecam.com',
  port: null,
  nativeProtocols: [Object],
  pathname: '/app/v2/home_page/get_object_list'
},
_ended: false,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 494,
_requestBodyBuffers: [ [Object] ],
_onNativeResponse: [Function (anonymous)],
_currentRequest: ClientRequest {
  _events: [Object: null prototype],
  _eventsCount: 7,
  _maxListeners: undefined,
  outputData: [],
  outputSize: 0,
  writable: true,
  destroyed: false,
  _last: true,
  chunkedEncoding: false,
  shouldKeepAlive: false,
  maxRequestsOnConnectionReached: false,
  _defaultKeepAlive: true,
  useChunkedEncodingByDefault: true,
  sendDate: false,
  _removedConnection: false,
  _removedContLen: false,
  _removedTE: false,
  strictContentLength: false,
  _contentLength: 494,
  _hasBody: true,
  _trailer: '',
  finished: false,
  _headerSent: true,
  _closed: false,
  socket: [TLSSocket],
  _header: 'POST /app/v2/home_page/get_object_list HTTP/1.1\r\n' +
    'Accept: application/json, text/plain, */*\r\n' +
    'Content-Type: application/json\r\n' +
    'User-Agent: axios/0.21.4\r\n' +
    'Content-Length: 494\r\n' +
    'Host: api.wyzecam.com\r\n' +
    'Connection: close\r\n' +
    '\r\n',
  _keepAliveTimeout: 0,
  _onPendingData: [Function: nop],
  agent: [Agent],
  socketPath: undefined,
  method: 'POST',
  maxHeaderSize: undefined,
  insecureHTTPParser: undefined,
  joinDuplicateHeaders: undefined,
  path: '/app/v2/home_page/get_object_list',
  _ended: false,
  res: null,
  aborted: false,
  timeoutCb: null,
  upgradeOrConnect: false,
  parser: null,
  maxHeadersCount: null,
  reusedSocket: false,
  host: 'api.wyzecam.com',
  protocol: 'https:',
  _redirectable: [Circular *1],
  [Symbol(kCapture)]: false,
  [Symbol(kBytesWritten)]: 0,
  [Symbol(kNeedDrain)]: false,
  [Symbol(corked)]: 0,
  [Symbol(kOutHeaders)]: [Object: null prototype],
  [Symbol(errored)]: null,
  [Symbol(kUniqueHeaders)]: null
},
_currentUrl: 'https://api.wyzecam.com/app/v2/home_page/get_object_list',
[Symbol(kCapture)]: false

}, response: undefined, isAxiosError: true, toJSON: [Function: toJSON] } [04/06/2023, 11:30:01] [Wyze] Error, refreshing access token and trying again [04/06/2023, 11:31:01] [Wyze] Request failed: Error: Client network socket disconnected before secure TLS connection was established [04/06/2023, 11:31:01] [Wyze] Error, logging in and trying again [04/06/2023, 11:32:02] [Wyze] Request failed: Error: Client network socket disconnected before secure TLS connection was established [04/06/2023, 11:32:02] [Wyze] Error getting devices: Error: Client network socket disconnected before secure TLS connection was established [04/06/2023, 11:32:53] [Wyze] Request failed: Error: Client network socket disconnected before secure TLS connection was established Error: Client network socket disconnected before secure TLS connection was established at connResetException (node:internal/errors:717:14) at TLSSocket.onConnectEnd (node:_tls_wrap:1595:19) at TLSSocket.emit (node:events:525:35) at endReadableNT (node:internal/streams/readable:1359:12) at processTicksAndRejections (node:internal/process/task_queues:82:21) [04/06/2023, 11:32:53] [Wyze] Child bridge process ended [04/06/2023, 11:32:53] [Wyze] Process Ended. Code: 1, Signal: null [04/06/2023, 11:33:00] [Wyze] Restarting Process... [04/06/2023, 11:33:02] [Wyze] Launched child bridge with PID 13759 [04/06/2023, 11:33:02] Registering platform 'homebridge-wyze-smart-home.WyzeSmartHome' [04/06/2023, 11:33:02] [Wyze] Loaded homebridge-wyze-smart-home v0.5.25.1 child bridge successfully [04/06/2023, 11:33:02] Loaded 9 cached accessories from cachedAccessories.0E72D62DE626. [04/06/2023, 11:33:02] Homebridge v1.6.1 (HAP v0.11.1) (Wyze) is running on port 43383. [04/06/2023, 11:34:03] [Wyze] Request failed: Error: Client network socket disconnected before secure TLS connection was established [04/06/2023, 11:34:03] [Wyze] Error: Client network socket disconnected before secure TLS connection was established at connResetException (node:internal/errors:717:14) at TLSSocket.onConnectEnd (node:_tls_wrap:1595:19) at TLSSocket.emit (node:events:525:35) at endReadableNT (node:internal/streams/readable:1359:12) at processTicksAndRejections (node:internal/process/task_queues:82:21) { code: 'ECONNRESET', path: null, host: 'api.wyzecam.com', port: 443, localAddress: undefined, config: { url: 'app/v2/home_page/get_object_list', method: 'post', data: '{"access_token”:”xxxxxxx”,”app_name":"com.hualai.WyzeCam","app_ver":"com.hualai.WyzeCam___2.18.44","app_version":"2.18.44","phone_id”:”xxxxxxx”,”phone_system_type":"1","sc":"9f275790cab94a72bd206c8876429f3c","sv":"9d74946e652647e9b6c9d59326aef104","ts":1685892782604}', headers: { Accept: 'application/json, text/plain, /', 'Content-Type': 'application/json', 'User-Agent': 'axios/0.21.4', 'Content-Length': 494 }, baseURL: 'https://api.wyzecam.com', transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, adapter: [Function: httpAdapter], xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, validateStatus: [Function: validateStatus], transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false } }, request: <ref *1> Writable { _writableState: WritableState { objectMode: false, highWaterMark: 16384, finalCalled: false, needDrain: false, ending: false, ended: false, finished: false, destroyed: false, decodeStrings: true, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: true, bufferProcessing: false, onwrite: [Function: bound onwrite], writecb: null, writelen: 0, afterWriteTickInfo: null, buffered: [], bufferedIndex: 0, allBuffers: true, allNoop: true, pendingcb: 0, constructed: true, prefinished: false, errorEmitted: false, emitClose: true, autoDestroy: true, errored: null, closed: false, closeEmitted: false,

},
_events: [Object: null prototype] {
  response: [Function: handleResponse],
  error: [Function: handleRequestError]
},
_eventsCount: 2,
_maxListeners: undefined,
_options: {
  maxRedirects: 21,
  maxBodyLength: 10485760,
  protocol: 'https:',
  path: '/app/v2/home_page/get_object_list',
  method: 'POST',
  headers: [Object],
  agent: undefined,
  agents: [Object],
  auth: undefined,
  hostname: 'api.wyzecam.com',
  port: null,
  nativeProtocols: [Object],
  pathname: '/app/v2/home_page/get_object_list'
},
_ended: false,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 494,
_requestBodyBuffers: [ [Object] ],
_onNativeResponse: [Function (anonymous)],
_currentRequest: ClientRequest {
  _events: [Object: null prototype],
  _eventsCount: 7,
  _maxListeners: undefined,
  outputData: [],
  outputSize: 0,
  writable: true,
  destroyed: false,
  _last: true,
  chunkedEncoding: false,
  shouldKeepAlive: false,
  maxRequestsOnConnectionReached: false,
  _defaultKeepAlive: true,
  useChunkedEncodingByDefault: true,
  sendDate: false,
  _removedConnection: false,
  _removedContLen: false,
  _removedTE: false,
  strictContentLength: false,
  _contentLength: 494,
  _hasBody: true,
  _trailer: '',
  finished: false,
  _headerSent: true,
  _closed: false,
  socket: [TLSSocket],
  _header: 'POST /app/v2/home_page/get_object_list HTTP/1.1\r\n' +
    'Accept: application/json, text/plain, */*\r\n' +
    'Content-Type: application/json\r\n' +
    'User-Agent: axios/0.21.4\r\n' +
    'Content-Length: 494\r\n' +
    'Host: api.wyzecam.com\r\n' +
    'Connection: close\r\n' +
    '\r\n',
  _keepAliveTimeout: 0,
  _onPendingData: [Function: nop],
  agent: [Agent],
  socketPath: undefined,
  method: 'POST',
  maxHeaderSize: undefined,
  insecureHTTPParser: undefined,
  joinDuplicateHeaders: undefined,
  path: '/app/v2/home_page/get_object_list',
  _ended: false,
  res: null,
  aborted: false,
  timeoutCb: null,
  upgradeOrConnect: false,
  parser: null,
  maxHeadersCount: null,
  reusedSocket: false,
  host: 'api.wyzecam.com',
  protocol: 'https:',
  _redirectable: [Circular *1],
  [Symbol(kCapture)]: false,
  [Symbol(kBytesWritten)]: 0,
  [Symbol(kNeedDrain)]: false,
  [Symbol(corked)]: 0,
  [Symbol(kOutHeaders)]: [Object: null prototype],
  [Symbol(errored)]: null,
  [Symbol(kUniqueHeaders)]: null
},
_currentUrl: 'https://api.wyzecam.com/app/v2/home_page/get_object_list',
[Symbol(kCapture)]: false

}, response: undefined, isAxiosError: true, toJSON: [Function: toJSON] } [04/06/2023, 11:34:03] [Wyze] Error, refreshing access token and trying again [04/06/2023, 11:35:04] [Wyze] Request failed: Error: Client network socket disconnected before secure TLS connection was established [04/06/2023, 11:35:04] [Wyze] Error, logging in and trying again [04/06/2023, 11:35:05] [Wyze] Successfully logged into Wyze API

Plugin Config:

{     "name": "Wyze",     "username": “xxxxx”,     "password": “xxxxxx”,     "refreshInterval": 60000,     "entryExitDelay": 30,     "showAdvancedOptions": false,     "excludeMacAddress": false,     "excludedeviceType": false,     "_bridge": {         "username": "0E:72:D6:2D:E6:26",         "port": 43383     },     "platform": "WyzeSmartHome" }

Screenshots:

Environment:

Raspberry Pi 4 running latest Raspbian hardwired to router

github-actions[bot] commented 1 year ago

Message that will be displayed on users' first issue

jfarmer08 commented 1 year ago

Are you still seeing this issue?

MrMMcGowen commented 1 year ago

Yes I am

MrMMcGowen commented 1 year ago

I just updated to the latest version and configured it with the api key that I generated in the Wyze Portal. I will monitor the logs to see if I still get the errors.