bropat / eufy-security-ws

Small server wrapper around eufy-security-client library to access it via a WebSocket.
MIT License
165 stars 24 forks source link

[Bug]: Push connection not initiated #295

Closed dougy86 closed 6 months ago

dougy86 commented 6 months ago

Version

1.7.1 using Home Assistant addon

Node version

Node version of 1.7.1 HA addon

Operating System type

eufy-security-ws 1.7.1 addon in HA

Operating system version

HAOS 11.4 - HA Core 2024.1.2 - Supervisor 2023.12.0

Describe the bug

I have 2 solocam S220 and I am using home assistant with eufy-security-ws addon and HACS eufy security integration (8.0.0). These 2 camera are sucessfully discovered, but sensors are not being updated. I think the reason is that there is not "Push notification connection successfully established" in log, although push notifications is set in mobile app. Eufy-security HA integration successfully connects to Eufy-security-ws addon, and shows my 2 cameras with numerous entities, but as a result, entities such as motions sensors are not updated.

To reproduce

  1. Configure eufy-security-ws addon with eufy account
  2. Start addon, see in log that cameras are detected, but there is no "push connection established" message
  3. Configure Eufy Security HA integration to use Eufy-security-ws addon
  4. See that devices and entities are successfully added in HA, but not updated

Screenshots & Logfiles

push mobile Capture d’écran 2024-01-12 à 14 20 45 Capture d’écran 2024-01-12 à 14 19 36 Capture d’écran 2024-01-12 à 14 20 11

Additional context

No response

dougy86 commented 6 months ago

Ok actually I found that my eufy-security-ws log was not complete, after a few minutes I got an error related to push notifications, that repeats over time.

How I can I solve this problem ?

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
2024-01-12 15:54:53.760  INFO  Eufy Security server listening on host 0.0.0.0, port 3000 
2024-01-12 15:54:58.632  INFO  Connected to station T8134P2023333DF8 on host 192.168.1.36 and port 15248 
2024-01-12 15:54:58.667  INFO  Connected to station T8134P2023336FBA on host 192.168.1.10 and port 18574 
2024-01-12 15:55:29.092  INFO  Initiated closing of connection to station T8134P2023336FBA for saving battery. 
2024-01-12 15:55:29.096  INFO  Disconnected from station T8134P2023336FBA 
2024-01-12 15:55:29.356  INFO  Initiated closing of connection to station T8134P2023333DF8 for saving battery. 
2024-01-12 15:55:29.357  INFO  Disconnected from station T8134P2023333DF8 
2024-01-12 16:03:44.632  ERROR Register FID - Generic Error 
{
  error: {
    cause: undefined,
    message: 'RequestError: connect ETIMEDOUT 2a00:1450:4007:805::200a:443',
    context: undefined,
    stacktrace: 'RequestError: connect ETIMEDOUT 2a00:1450:4007:805::200a:443\n' +
      '    at ClientRequest.<anonymous> (/usr/src/app/node_modules/got/dist/source/core/index.js:970:111)\n' +
      '    at Object.onceWrapper (node:events:632:26)\n' +
      '    at ClientRequest.emit (node:events:529:35)\n' +
      '    at ClientRequest.emit (node:domain:489:12)\n' +
      '    at origin.emit (/usr/src/app/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)\n' +
      '    at TLSSocket.socketErrorListener (node:_http_client:501:9)\n' +
      '    at TLSSocket.emit (node:events:517:28)\n' +
      '    at TLSSocket.emit (node:domain:489:12)\n' +
      '    at emitErrorNT (node:internal/streams/destroy:151:8)\n' +
      '    at emitErrorCloseNT (node:internal/streams/destroy:116:3)\n' +
      '    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)'
  }
}
2024-01-12 16:03:44.646  ERROR Create push credentials Error 
{
  error: {
    cause: RequestError: connect ETIMEDOUT 2a00:1450:4007:805::200a:443
        at ClientRequest.<anonymous> (/usr/src/app/node_modules/got/dist/source/core/index.js:970:111)
        at Object.onceWrapper (node:events:632:26)
        at ClientRequest.emit (node:events:529:35)
        at ClientRequest.emit (node:domain:489:12)
        at origin.emit (/usr/src/app/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)
        at TLSSocket.socketErrorListener (node:_http_client:501:9)
        at TLSSocket.emit (node:events:517:28)
        at TLSSocket.emit (node:domain:489:12)
        at emitErrorNT (node:internal/streams/destroy:151:8)
        at emitErrorCloseNT (node:internal/streams/destroy:116:3)
        at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
      code: 'ETIMEDOUT',
      timings: {
        start: 1705075293499,
        socket: 1705075293500,
        lookup: 1705075293504,
        connect: undefined,
        secureConnect: undefined,
        upload: undefined,
        response: undefined,
        end: undefined,
        error: 1705075424630,
        abort: undefined,
        phases: {
          wait: 1,
          dns: 4,
          tcp: undefined,
          tls: undefined,
          request: undefined,
          firstByte: undefined,
          download: undefined,
          total: 131131
        }
      }
    },
    message: 'FidRegistrationFailedError: FID registration failed',
    context: {
      fid: 'fJBiyj8aP-kMY6ols_Z8eN'
    },
    stacktrace: 'FidRegistrationFailedError: FID registration failed\n' +
      '    at PushNotificationService.registerFid (/usr/src/app/node_modules/eufy-security-client/build/push/service.js:130:19)\n' +
      '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
      '    at async PushNotificationService.createPushCredentials (/usr/src/app/node_modules/eufy-security-client/build/push/service.js:194:16)\n' +
      '    at async PushNotificationService._open (/usr/src/app/node_modules/eufy-security-client/build/push/service.js:635:32)\n' +
      '    at async PushNotificationService.open (/usr/src/app/node_modules/eufy-security-client/build/push/service.js:697:13)'
  },
  credentials: undefined,
  renew: false
}
2024-01-12 16:03:44.671  INFO  Push notification connection closed 
2024-01-12 16:03:44.673  ERROR Push notifications are disabled, because the registration failed! 
{
  credentials: undefined,
  renew: false
}
2024-01-12 16:03:44.675  INFO  Retry to register/login for push notification in 5 seconds... 
2024-01-12 16:03:49.681  INFO  Retry to register/login for push notification 
dougy86 commented 6 months ago

I have finally found a fix to this problem : I had to disable IPv6 on my host. This IP is associated with google firebase and could not be reached : 2a00:1450:4007:805::200a:443