fuatakgun / eufy_security

Home Assistant integration to manage Eufy Security devices as cameras, home base stations, doorbells, motion and contact sensors.
843 stars 73 forks source link

Problem running streams for extended period (Error: AES key could not be decrypted! The entire stream is discarded) #1026

Closed V4ler1an closed 7 months ago

V4ler1an commented 7 months ago

Describe the bug

Whenever I try to view the camera live stream for an extended period using the WebRTC lovelace card the stream will stop after around 9 or 10 minutes. Sometimes less.

To reproduce

Steps to reproduce the behavior:

  1. Click 'Start P2P stream'

Expected behavior

I expect the stream to continue running until I click 'Stop P2P Stream'. However, if I try to click 'Stop P2P Stream' after the stream has cut I get the standard Lovelace error saying the stream is not longer running.

Additional information

Hardware Information;

2023-11-30 14:39:18.904 WARN Error: AES key could not be decrypted! The entire stream is discarded. { error: { cause: undefined, message: 'Error: Error during decryption (probably incorrect key). Original error: Error: error:0200009F:rsa routines::pkcs decoding error', context: undefined, stacktrace: 'Error: Error during decryption (probably incorrect key). Original error: Error: error:0200009F:rsa routines::pkcs decoding error\n' + ' at module.exports.NodeRSA.$$decryptKey (/usr/src/app/node_modules/node-rsa/src/NodeRSA.js:301:19)\n' + ' at module.exports.NodeRSA.decrypt (/usr/src/app/node_modules/node-rsa/src/NodeRSA.js:249:21)\n' + ' at P2PClientProtocol.handleDataBinaryAndVideo (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1319:63)\n' + ' at P2PClientProtocol.handleData (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1259:18)\n' + ' at P2PClientProtocol.parseDataMessage (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1121:26)\n' + ' at P2PClientProtocol.handleMsg (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:957:26)\n' + ' at Socket. (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:113:56)\n' + ' at Socket.emit (node:events:517:28)\n' + ' at Socket.emit (node:domain:489:12)\n' + ' at UDP.onMessage [as onmessage] (node:dgram:942:8)' }, stationSN: '', key: 'aabd76d37f0ccb0febc8f96abc6b006ff71ec326bd08ded1185521116e58aac3031a4502012a04b9f85d4d4fe965ab4c971e17597768d6fa876b0bf6a51683199b89bdf0a57cda1c8fc66011dbe67de6adabbf5a86fe561f77bb6bc34dcdd7094da690b5ab015ac0ab6661c720b7d975e7651a5ca859f018c074a74f9757e539' }

Would you share your device with me in case further debugging required? (Yes/No): Yes

Additional context

If I view the camera's live stream in the Eufy mobile app the stream runs flawlessly for as long as I wish. The Wi-Fi signal to the camera is very strong. The live stream comes up quickly and runs smoothly in HA WebRTC until is cuts off after 10 minutes or so. Streaming using the GotoRTC web page has the same behaviour as in Lovelace.

Add any other context about the problem goes here. Mainly, share everything as log files and use screenshots as last resort.

Additional context

Add any other context about the problem goes here. Mainly, share everything as log files and use screenshots as last resort.

fuatakgun commented 7 months ago

I am having the similar issue locally but I dont have a solution for the issue, it is coming from add-on, please check with bropat. I am actively watching his repositories