RaresAil / homebridge-tp-link-tapo

A platform to implement the tp-link tapo device and Adaptive Lighting for light bulbs
https://www.npmjs.com/package/homebridge-tp-link-tapo
Apache License 2.0
61 stars 5 forks source link

Add support for the H200 hub #56

Closed DeanKamitsis closed 1 month ago

DeanKamitsis commented 10 months ago

Describe The Bug

Currently doesn’t detect the hub, but does detect the H100.

Expected behavior

N/A

Logs

N/A

Plugin Config

N/A

Plugin Version

N/A

Homebridge Version

N/A

Node.js Version

N/A

NPM Version

N/A

Operating System

N/A

RaresAil commented 10 months ago

Hey, can you provide the logs?

john-catalano commented 8 months ago

Bumping for interest. I bought a C420 camera package, which uses the H200 hub, because I thought I read that it supported RTSP and ONVIF. I believe even TP-Link's support page actually stated so, but it's since been corrected, and the TP-Link staff in the forums claim ONVIF/RTSP is impossible for battery concerns.

Anyway, if I can be guided, I'm happy to do what I can to provide the logs/info. Thank you.

RaresAil commented 8 months ago

Bumping for interest. I bought a C420 camera package, which uses the H200 hub, because I thought I read that it supported RTSP and ONVIF. I believe even TP-Link's support page actually stated so, but it's since been corrected, and the TP-Link staff in the forums claim ONVIF/RTSP is impossible for battery concerns.

Anyway, if I can be guided, I'm happy to do what I can to provide the logs/info. Thank you.

Hey, in order to asd support for this i need you to provide some logs

john-catalano commented 8 months ago

I'd be happy to. I added the H200 by IP address (it's static). Does this help?

[10/22/2023, 11:54:12 AM] [TPLink Tapo Platform] Failed to get info about: 10.0.0.61
[10/22/2023, 11:54:22 AM] [TPLink Tapo Platform] Try for 10.0.0.61 : 1/20
[10/22/2023, 11:56:52 AM] [TPLink Tapo Platform] Error sending command: deviceInfo AxiosError: connect ETIMEDOUT 10.0.0.61:80
    at Function.AxiosError.from (/usr/local/lib/node_modules/homebridge-tp-link-tapo/node_modules/axios/lib/core/AxiosError.js:89:14)
    at RedirectableRequest.handleRequestError (/usr/local/lib/node_modules/homebridge-tp-link-tapo/node_modules/axios/lib/adapters/http.js:593:25)
    at RedirectableRequest.emit (node:events:517:28)
    at ClientRequest.eventHandlers.<computed> (/usr/local/lib/node_modules/homebridge-tp-link-tapo/node_modules/follow-redirects/index.js:14:24)
    at ClientRequest.emit (node:events:517:28)
    at Socket.socketErrorListener (node:_http_client:501:9)
    at Socket.emit (node:events:517:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  port: 80,
  address: '10.0.0.61',
  syscall: 'connect',
  code: 'ETIMEDOUT',
  errno: -60,
  config: {
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    },
    adapter: [ 'xhr', 'http' ],
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    env: { FormData: [Function], Blob: [class Blob] },
    validateStatus: [Function: validateStatus],
    headers: Object [AxiosHeaders] {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': 'application/json',
      'User-Agent': 'axios/1.5.1',
      'Content-Length': '352',
      'Accept-Encoding': 'gzip, compress, deflate, br'
    },
    httpAgent: Agent {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      defaultPort: 80,
      protocol: 'http:',
      options: [Object: null prototype],
      requests: [Object: null prototype] {},
      sockets: [Object: null prototype],
      freeSockets: [Object: null prototype] {},
      keepAliveMsecs: 1000,
      keepAlive: false,
      maxSockets: Infinity,
      maxFreeSockets: 256,
      scheduling: 'lifo',
      maxTotalSockets: Infinity,
      totalSocketCount: 1,
      [Symbol(kCapture)]: false
    },
    method: 'post',
    url: 'http://10.0.0.61/app',
    data: '{"method":"handshake","params":{"key":"-----BEGIN PUBLIC KEY-----\\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC0KxOK1ErDPmSJhzwJUdveENK0\\nexcmmPr48Y3Vpqg+VqfC8sXJI535NxOgi3fb6bZK6FjszUuYt3KpFgs9n9jl1+p0\\nHQdENJk5tz0U0okNtYeslrS/GUcZBh9CsEK5ZDuBdcFODtLG9AFNsOvPylZ9Hciw\\nD80UIZGNVh/h0A42OwIDAQAB\\n-----END PUBLIC KEY-----\\n"},"requestTimeMils":1697946937334}'
  },
  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,
      [Symbol(kOnFinished)]: []
    },
    _events: [Object: null prototype] {
      response: [Function: handleResponse],
      error: [Function: handleRequestError],
      socket: [Function: handleRequestSocket]
    },
    _eventsCount: 3,
    _maxListeners: undefined,
    _options: {
      maxRedirects: 21,
      maxBodyLength: Infinity,
      protocol: 'http:',
      path: '/app',
      method: 'POST',
      headers: [Object: null prototype],
      agents: [Object],
      auth: undefined,
      family: undefined,
      beforeRedirect: [Function: dispatchBeforeRedirect],
      beforeRedirects: [Object],
      hostname: '10.0.0.61',
      port: '',
      agent: [Agent],
      nativeProtocols: [Object],
      pathname: '/app'
    },
    _ended: false,
    _ending: true,
    _redirectCount: 0,
    _redirects: [],
    _requestBodyLength: 352,
    _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: '352',
      _hasBody: true,
      _trailer: '',
      finished: false,
      _headerSent: true,
      _closed: false,
      socket: [Socket],
      _header: 'POST /app HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'Content-Type: application/json\r\n' +
        'User-Agent: axios/1.5.1\r\n' +
        'Content-Length: 352\r\n' +
        'Accept-Encoding: gzip, compress, deflate, br\r\n' +
        'Host: 10.0.0.61\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',
      _ended: false,
      res: null,
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: '10.0.0.61',
      protocol: 'http:',
      _redirectable: [Circular *1],
      [Symbol(kCapture)]: false,
      [Symbol(kBytesWritten)]: 0,[10/22/2023, 11:56:52 AM] [TPLink Tapo Platform] Retry timeout: 10.0.0.61
m
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype],
      [Symbol(errored)]: null,
      [Symbol(kHighWaterMark)]: 16384,
      [Symbol(kRejectNonStandardBodyWrites)]: false,
      [Symbol(kUniqueHeaders)]: null
    },
    _currentUrl: 'http://10.0.0.61/app',
    [Symbol(kCapture)]: false
  },
  cause: Error: connect ETIMEDOUT 10.0.0.61:80
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
    errno: -60,
    code: 'ETIMEDOUT',
    syscall: 'connect',
    address: '10.0.0.61',
    port: 80
  }
}
[10/22/2023, 11:56:52 AM] [TPLink Tapo Platform] Failed to get info about: 10.0.0.61
RaresAil commented 8 months ago

By the error I don't think is possible, as it might not use HTTP for communication

chan-vince commented 4 months ago

I have an H200 and if I run nmap, I can see a couple of open ports:

$ nmap 192.168.1.122
Starting Nmap 7.94 ( https://nmap.org ) at 2024-03-14 15:09 GMT
Nmap scan report for 192.168.1.122
Host is up (0.0013s latency).
Not shown: 998 filtered tcp ports (no-response)
PORT     STATE SERVICE
443/tcp  open  https
8800/tcp open  sunwebadmin

Nmap done: 1 IP address (1 host up) scanned in 42.45 seconds

Curling https://192.168.1.122 returns an empty JSON response, and http://192.168.1.122:8800 redirects to a /404.html Not Found page.

@RaresAil do you have any more ideas on what I could poke? It does look like it uses HTTP at least.

john-catalano commented 1 month ago

Are bounties a thing? Even investing several hundred dollars in new equipment won't give me what I am looking for...

RaresAil commented 1 month ago

I have an H200 and if I run nmap, I can see a couple of open ports:


$ nmap 192.168.1.122

Starting Nmap 7.94 ( https://nmap.org ) at 2024-03-14 15:09 GMT

Nmap scan report for 192.168.1.122

Host is up (0.0013s latency).

Not shown: 998 filtered tcp ports (no-response)

PORT     STATE SERVICE

443/tcp  open  https

8800/tcp open  sunwebadmin

Nmap done: 1 IP address (1 host up) scanned in 42.45 seconds

Curling https://192.168.1.122 returns an empty JSON response, and http://192.168.1.122:8800 redirects to a /404.html Not Found page.

@RaresAil do you have any more ideas on what I could poke? It does look like it uses HTTP at least.

I don't know how the h200 works behind the scenes sadly

RaresAil commented 1 month ago

Tapo added support for matter even in H100, so all the hubs will no longer receive any updates