recallfx / node-red-contrib-eufy-security

Eufy security node for Node RED
MIT License
6 stars 6 forks source link

Loss of push notifications after "deploy" and first event #8

Open mcr-ksh opened 2 years ago

mcr-ksh commented 2 years ago

Hi,

I've been able to track down a weird issue that occurs only after the flow has changed and "deployed". The node reconnects and I'm able to receive only 1 or 2 events (motion, person, crying etc.). After that I won't be able to receive any more events.

On deploy:

4 Nov 10:48:15 - [info] Push notification connection closed 4 Nov 10:48:15 - [info] Disconnect from station T8410P..........C 4 Nov 10:48:15 - [info] Disconnect from station T8410P..........8 CLEANUP 4 Nov 10:48:15 - [info] Disconnected from station T8410P..........C 4 Nov 10:48:15 - [info] Disconnected from station T8410P..........8 ... more log events 4 Nov 10:48:18 - [info] Connected to station T8410P..........8 on host 192.168.x.5 and port 27457 4 Nov 10:48:18 - [info] Connected to station T8410P..........C on host 192.168.x.7 and port 27457 4 Nov 10:48:19 - [info] Push notification connection successfully established

It is clear that the push notification and local network connection is disconnected and reconnected. Being connected using https://github.com/bropat/eufy-security-ws for debugging I was able to see that the camera still sends the events (iOS app also receives push notifications), just node-red won't receive any more events.

If I stop node-red and restart without any changes to the flow (no "deploy") the notifications work properly. Anyone else experienced that behaviour?

recallfx commented 2 years ago

Very strange, did not see such behaviour, I see that there is an update to eufy-security-client (1.4.0), perhaps that would help.

mcr-ksh commented 2 years ago

@recallfx its not the eufy-security-client. I've already updated the library to latest and the problem still occurs. It seems to me it happens because the library is reconnecting to fast to the UDP socket and thus causing problems on the push notifications stream.

i've put this into initialise() function and seems to help in my case. This is not a bug fix but more a indication where to look.

const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); wait delay(30000);`

Furthermore i've also added this.driver.isPushConnected in connect():

if (this.initialised && !this.driver.isConnected() && !this.driver.isPushConnected()) {

UPDATE: unfortunately this did not really worked permanently. after a couple of hours the connection is gone again

xeryax commented 2 years ago

I am also having this problem--- I just got my eufy t8520 lock, so i dont know much about it... but it seems that the connection is closing to the eufy device, then only updating whenever the poll timer is reached, and the PUSH notifications aren't really doing anything.

I get: 27 Apr 14:04:20 - [info] Push notification connection successfully established

and when my device is connected for polling: 27 Apr 14:01:25 - [info] Connected to station T8520 on host 192.168. and port 28019 I get status updates instantly... but not when the device is disconnected for powersave...

I also think this is related to eufy-security-client, as this was happening in the HomeAssistant integration, which is based on the same backend.