bropat / eufy-security-ws

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

[Bug]: Error "DeviceNotFoundError: Device doesn't exists" in AddOn log #265

Closed dernorberto closed 9 months ago

dernorberto commented 1 year ago

Version

1.6.4

Node version

16.20.1

Operating System type

Docker

Operating system version

Home Assistant

Describe the bug

Linking possibly related issue: #264

Using Homebase 3 (S380)

There's an error in the Addon log every time it is started:

2023-10-09 09:23:37.483  INFO  Eufy Security server listening on host 0.0.0.0, port 3000 
2023-10-09 09:23:40.306  INFO  Connected to station T8030P23225100A6 on host 192.168.188.222 and port 12487 
2023-10-09 09:23:42.765  INFO  Push notification connection successfully established 
2023-10-09 09:23:43.537  ERROR onStationDatabaseQueryLatest Error 
{
  error: {
    message: "DeviceNotFoundError: Device doesn't exists",
    stacktrace: "DeviceNotFoundError: Device doesn't exists\n" +
      '    at EufySecurity.getDevice (/usr/src/app/node_modules/eufy-security-client/build/eufysecurity.js:372:15)\n' +
      '    at EufySecurity.onStationDatabaseQueryLatest (/usr/src/app/node_modules/eufy-security-client/build/eufysecurity.js:2344:26)\n' +
      '    at Station.<anonymous> (/usr/src/app/node_modules/eufy-security-client/build/eufysecurity.js:479:97)\n' +
      '    at Station.emit (node:events:525:35)\n' +
      '    at Station.emit (node:domain:489:12)\n' +
      '    at Station.onDatabaseQueryLatest (/usr/src/app/node_modules/eufy-security-client/build/http/station.js:7377:14)\n' +
      '    at P2PClientProtocol.<anonymous> (/usr/src/app/node_modules/eufy-security-client/build/http/station.js:78:80)\n' +
      '    at P2PClientProtocol.emit (node:events:513:28)\n' +
      '    at P2PClientProtocol.emit (node:domain:489:12)\n' +
      '    at P2PClientProtocol.handleDataControl (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1860:42)'
  },
  stationSN: 'T8030P23225100A6',
  returnCode: 0
}
2023-10-09 09:25:39.840  INFO  Client disconnected with ip: 127.0.0.1 port: 49518 code: 1000 reason: Normal Closure 

To reproduce

  1. Go to Settings > Addons > eufy-security-ws
  2. restart
  3. go to logs

Screenshots & Logfiles

No response

Additional context

No response

jesse-kaufman commented 1 year ago

I get this after I've removed a camera from the Eufy app. From then on, I get it shows in the logs. Everything seems to work ok, though.

I have also noticed that the Home Assistant devices aren't always removed for the cameras that were removed from the Eufy app. Not sure if that's related, but it might be.

PhilippEngler commented 1 year ago

It seems that the result of the StationDatabaseQueryLatest function also contains the removed devices. It has been occurred also in my case after deleting cams from HomeBase 2. We should check if the device is in the account and if not, jump over the entry.

AFPass commented 1 year ago

Same here. The camera deleted from the account is in the error message