fuatakgun / eufy_security

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

Add-On Crashing multiple times per day, while attempting to stream P2P #1089

Open ejpenney opened 10 months ago

ejpenney commented 10 months ago

No rhyme or reason, network connection to the video doorbell is strong, plenty of resources for the Add-On and Home Assistant. Everything works, except that it's dumping notifications sometimes 30-40 times per day and everything Eufy stops working until I restart the Add-On (not reloading the integration, restarting the add-on) The crashes cluster, it'll happen 5-10 times in an hour, then be okay for a few hours.

image (these retries never succeed)

To reproduce

Steps to reproduce the behavior:

  1. Install everything as described
  2. Wait...(could be a few minutes or a few hours)
  3. Eufy Add-On will inevitably crash

Expected behavior

It shouldn't crash.

Additional information

Go to Settings -> System -> Repairs -> Click on 3 dots (...) -> System Information and get Version and Installation Type to below fields;

Hardware Information;

home-assistant_eufy_security_2024-01-18T18-01-42.540Z.log

402f1039_eufy_security_ws_2024-01-18T18-02-04.616Z.log

Additional context

I grabbed these logs 1-2 minutes after a crash, but unfortunately it looks like Home Assistant truncates Add-On logs. When debug is disabled for Add-On nothing appears in the logs, it's possible there's a message earlier, but if so I didn't find it.

Only thing I can think that might be remotely relevant, is I have some automations that start/stop the doorbell stream a few times a day. In a few words, I hate the "event images", they're grainy, and badly cropped. So basically during doorbell events, and once an hour I start a stream and use eufy_security.generate_image to create a better looking image for the stream preview. I have tried disabling these automations but it doesn't seem to make a difference for stability.

OskarLebuda commented 10 months ago

same issue here

ZogKarndon commented 10 months ago

I'm having the same issues as well; the integration always shows 'Connection to add-on broken, please reload the integration'. Reloading does not work. I was originally getting a 504 gateway error, and I tried to update the addon configuration (by enabling and disabling debug mode).

Now the 504 errors are gone:

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-20 00:48:25.522  INFO  Eufy Security server listening on host 0.0.0.0, port 3000 
2024-01-20 00:48:28.529  INFO  Connected to station T<REDACTED>A on host 192.168.0.<REDACTED> and port 20600 
2024-01-20 00:48:30.464  INFO  Push notification connection successfully established 

but nothing gets the integration working

eufysecurity commented 10 months ago

This happens when when turning on p2p streaming sometimes. You have to restart the add-on for it to be able to connect again.

mheiker commented 9 months ago

same problem!

fuatakgun commented 9 months ago

Let's make it clear that the addon process is still running but the add-on is not functioning anymore.

So add-on crashes does not mean process kill in this context.

Sadly, i have limited knowledge on add-on rather focused on integration part.

Next time, can you try to reload the integration if it resolves this issue? Based on your finding, we can focus on add-on, integration and both.

ejpenney commented 9 months ago

I have this automation which will restart the add-on when Eufy devices become unavailable, then reload the integration if the integration doesn't recover automatically:

alias: "Fix: Eufy Add-On Crash"
description: ""
trigger:
  - platform: state
    entity_id:
      - switch.doorbell_audio_recording
    to: unavailable
    for:
      hours: 0
      minutes: 1
      seconds: 0
    from: null
condition: []
action:
  - service: hassio.addon_restart
    data:
      addon: 402f1039_eufy_security_ws
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - service: persistent_notification.dismiss
    metadata: {}
    data:
      notification_id: eufy_security_addon_connection_error
  - if:
      - condition: state
        entity_id: switch.doorbell_audio_recording
        state: unavailable
    then:
      - service: homeassistant.reload_config_entry
        data: {}
        target:
          device_id: c2df091b9b6a0023c709f367e6626cde
mode: restart

After I generated those logs last week it started firing every 2 minutes, the Integration couldn't maintain a connection to the Add-On period. It basically went into a loop. I tried restarting everything, deleting, re-installing... Then I reverted back to integration 7.7.4 and the upstream RTC and everything started working again (no change to the Add-On or version). 3 days now with no crashes.

I suspect it's either the customized RTC or the Integration.

Edit: Updated my automation with clear notification step

fuatakgun commented 9 months ago

But 2 minutes is not long enough to recover, can you extend it for a longer period of time?

Under normal circumstances, if the connection is broken between add-on and integration, and if integration is able to understand it, it will reload itself.

The problem arises with if integration can understand it

ejpenney commented 9 months ago

I've had this automation up for 4 months, 2 minutes had been sufficient until last week, typically the integration recovers within about 30 seconds of asking the add-on to reload.

And note, this automation won't re-trigger until the entity goes from "unavailable" to something else, then back to unavailable. IE, the integration crashes again. Meaning:

  1. Automation Triggers
  2. Automation restarts the Add-On
  3. Integration recovers (by setting state to something not equal to Unavailable)
  4. Integration crashes again (it pushes a fresh notification to Home Assistant, and sets entities to "Unavailable")
  5. Wait 60 seconds
  6. Automation triggers again (goto 1)
ejpenney commented 9 months ago

My only doubt is that the "if" step rarely fires, meaning it doesn't usually end up needing to reload the Integration. Restarting the Add-On usually seems to be sufficient to get things working again. That said, I get more failures with the newer version of the Integration. Seems like something the Integration is doing (or not doing) is crashing the Add-On.

fuatakgun commented 9 months ago

But restarting the add-on, would fire a notification about broken connection and would force the integrations to reload.

During reload, integration will try to connect to add-on, if it fails, it will continuously try in increasing intervals. Home assistant is deciding on these intervals to be sure that the system will not go frenzy during the retrial period

ejpenney commented 9 months ago

I wrote this because the integration never recovers on it's own. If I disable the automation the integration entities stay unavailable indefinitely (I think the longest I let it go was 13 hours).

mheiker commented 9 months ago

If eufy is hanging, zigbee2mqtt starts struggling and needs some time to get online again. i realized it cause zigbee devices cant be reached after eufy got down.

eufysecurity commented 9 months ago

Once it crashes, yes the add-on is still running, but if you reload the integration it is not able to be reloaded until you restart the add-on.

fuatakgun commented 9 months ago

so, let's call this state as add-on is not responsive, it is definitely up and running. I am not sure how can I find the exact location of the issue? is it on add-on side or integration side.

eufysecurity commented 9 months ago

This is the Add-On log when it crashes: 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-26 14:26:26.241 INFO Eufy Security server listening on host 0.0.0.0, port 3004 2024-01-26 14:26:28.565 INFO Connected to station T8021P10**** on host 192.168.*.* and port 21839 2024-01-26 14:26:28.864 INFO MQTT connection successfully established 2024-01-26 14:26:28.912 INFO Successfully registered to MQTT notifications for lock T8500Q10** 2024-01-26 14:26:29.512 INFO Connected to station T8420N60**** on host 192.168.*.* and port 27987 2024-01-26 14:26:29.701 INFO Connected to station T8200N00** on host 192.168.*.* and port 27197 2024-01-26 14:26:29.926 WARN P2P protocol instability detected for station T8420N60**. Please reinitialise the connection to solve the problem! 2024-01-26 14:26:30.216 INFO Push notification connection successfully established 2024-01-26 14:26:59.760 WARN Result data for command not received { stationSN: 'T8420N60****', message: { sequence: 1, commandType: 1350, nestedCommandType: 1308, channel: 255, acknowledged: true, retries: 0, returnCode: -133, data: <Buffer d1 00 00 01 58 5a 59 48 46 05 d6 00 00 00 01 00 ff 00 00 00 7b 22 61 63 63 6f 75 6e 74 5f 69 64 22 3a 22 66 35 38 61 30 65 38 30 30 62 32 32 31 61 34 ... 184 more bytes> } } 2024-01-26 14:26:59.783 WARN Result data for command not received { stationSN: 'T8420N60****', message: { sequence: 3, commandType: 1103, nestedCommandType: undefined, channel: 255, acknowledged: true, retries: 0, returnCode: -133, data: <Buffer d1 00 00 03 58 5a 59 48 4f 04 04 00 00 00 01 00 ff 00 00 00 ff 00 00 00> } }

eufysecurity commented 9 months ago

This is the home assistant log from the start of the first error until it crashes with everything that appears red for me quoted:

2024-01-26 09:27:19.700 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'command result', 'serialNumber': 'T8420N60****', 'command': 'set_property', 'returnCode': 0, 'returnCodeName': 'ERROR_PPCS_SUCCESSFUL', 'customData': {'property': {'name': 'enabled', 'value': True}}}} 2024-01-26 09:27:19.700 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] event not handled -T8420N60**** - Event(type='command result', data={'source': 'device', 'event': 'command result', 'serialNumber': 'T8420N60****', 'command': 'set_property', 'returnCode': 0, 'returnCodeName': 'ERROR_PPCS_SUCCESSFUL', 'customData': {'property': {'name': 'enabled', 'value': True}}})

2024-01-26 09:27:21.066 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'command result', 'serialNumber': 'T8420N60****', 'command': 'set_property', 'returnCode': 0, 'returnCodeName': 'ERROR_PPCS_SUCCESSFUL', 'customData': {'property': {'name': 'enabled', 'value': True}}}} 2024-01-26 09:27:21.066 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] event not handled -T8420N60**** - Event(type='command result', data={'source': 'device', 'event': 'command result', 'serialNumber': 'T8420N60****', 'command': 'set_property', 'returnCode': 0, 'returnCodeName': 'ERROR_PPCS_SUCCESSFUL', 'customData': {'property': {'name': 'enabled', 'value': True}}})

2024-01-26 09:27:37.845 DEBUG (MainThread) [custom_components.eufy_security] image 1 - False - None 2024-01-26 09:27:37.845 DEBUG (MainThread) [custom_components.eufy_security] async_camera_image 5 - is_empty False 2024-01-26 09:27:37.845 DEBUG (MainThread) [custom_components.eufy_security] async_camera_image 6 - 28395 2024-01-26 09:28:00.532 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] url - StreamProvider.P2P - rtsp://127.0.0.1:8554/T8200N00**** 2024-01-26 09:28:00.532 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _initiate_start_stream - info - send command to add-on - StreamProvider.P2P 2024-01-26 09:28:00.533 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] domain - device - EventSourceType.device - device.start_livestream - {'serial_no': 'T8200N00****'} - {'serialNumber': 'T8200N00****'} 2024-01-26 09:28:00.533 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] {'serialNumber': 'T8200N00****', 'command': 'device.start_livestream', 'messageId': 'device.start_livestream.78324d62f5b447c79535b76040349ae7'} 2024-01-26 09:28:00.533 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] send_message - {'serialNumber': 'T8200N00****', 'command': 'device.start_livestream', 'messageId': 'device.start_livestream.78324d62f5b447c79535b76040349ae7'} 2024-01-26 09:28:00.535 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'result', 'success': True, 'messageId': 'device.start_livestream.78324d62f5b447c79535b76040349ae7', 'result': {'async': True}}

2024-01-26 09:28:00.581 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'command result', 'serialNumber': 'T8200N00****', 'command': 'start_livestream', 'returnCode': 0, 'returnCodeName': 'ERROR_PPCS_SUCCESSFUL', 'customData': {'command': {'name': 'deviceStartLivestream', 'value': 0}}}}

2024-01-26 09:28:00.581 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] event not handled -T8200N00**** - Event(type='command result', data={'source': 'device', 'event': 'command result', 'serialNumber': 'T8200N00****', 'command': 'start_livestream', 'returnCode': 0, 'returnCodeName': 'ERROR_PPCS_SUCCESSFUL', 'customData': {'command': {'name': 'deviceStartLivestream', 'value': 0}}})

2024-01-26 09:28:01.006 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'livestream started', 'serialNumber': 'T8200N00****'}} 2024-01-26 09:28:01.006 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _handle_livestream_started - Event(type='livestream started', data={'source': 'device', 'event': 'livestream started', 'serialNumber': 'T8200N00****'}) 2024-01-26 09:28:01.010 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _initiate_start_stream - info - command was done 2024-01-26 09:28:01.012 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] create_stream_on_go2rtc - delete stream response (200, '{"T8200N00****":{"producers":[{"url":"T8200N00****"}],"consumers":null},"T8420N60****":{"producers":[{"url":"T8420N60****"}],"consumers":null}}\n') 2024-01-26 09:28:01.014 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] create_stream_on_go2rtc - put stream response (200, '') 2024-01-26 09:28:10.990 DEBUG (SyncWorker_4) [custom_components.eufy_security.eufy_security_api] write_bytes video - post response - 500 - EOF 2024-01-26 09:28:10.990 DEBUG (SyncWorker_4) [custom_components.eufy_security.eufy_security_api] write_bytes - post ended - {self.retry} 2024-01-26 09:28:10.990 DEBUG (SyncWorker_4) [custom_components.eufy_security.eufy_security_api] write_bytes video - ended with True 2024-01-26 09:28:11.036 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] async_restart_livestream - start - True 2024-01-26 09:28:11.037 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] domain - device - EventSourceType.device - device.stop_livestream - {'serial_no': 'T8200N00****'} - {'serialNumber': 'T8200N00****'} 2024-01-26 09:28:11.037 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] {'serialNumber': 'T8200N00****', 'command': 'device.stop_livestream', 'messageId': 'device.stop_livestream.b37f02f880b7412d9be9a2e1be94a53f'} 2024-01-26 09:28:11.037 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] send_message - {'serialNumber': 'T8200N00****', 'command': 'device.stop_livestream', 'messageId': 'device.stop_livestream.b37f02f880b7412d9be9a2e1be94a53f'} 2024-01-26 09:28:11.038 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'result', 'success': True, 'messageId': 'device.stop_livestream.b37f02f880b7412d9be9a2e1be94a53f', 'result': {'async': True}} 2024-01-26 09:28:11.038 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] async_restart_livestream - start live stream start - True 2024-01-26 09:28:11.038 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] url - StreamProvider.P2P - rtsp://127.0.0.1:8554/T8200N00**** 2024-01-26 09:28:11.038 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _initiate_start_stream - info - send command to add-on - StreamProvider.P2P 2024-01-26 09:28:11.038 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] domain - device - EventSourceType.device - device.start_livestream - {'serial_no': 'T8200N00****'} - {'serialNumber': 'T8200N00****'} 2024-01-26 09:28:11.038 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] {'serialNumber': 'T8200N00****', 'command': 'device.start_livestream', 'messageId': 'device.start_livestream.7884058ba0f64464a76db5ce994decc5'} 2024-01-26 09:28:11.039 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] send_message - {'serialNumber': 'T8200N00****', 'command': 'device.start_livestream', 'messageId': 'device.start_livestream.7884058ba0f64464a76db5ce994decc5'} 2024-01-26 09:28:11.039 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'livestream stopped', 'serialNumber': 'T8200N00****'}} 2024-01-26 09:28:11.039 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _handle_livestream_stopped - Event(type='livestream stopped', data={'source': 'device', 'event': 'livestream stopped', 'serialNumber': 'T8200N00****'}) 2024-01-26 09:28:11.042 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'result', 'success': True, 'messageId': 'device.start_livestream.7884058ba0f64464a76db5ce994decc5', 'result': {'async': True}}

2024-01-26 09:28:11.776 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'command result', 'serialNumber': 'T8200N00****', 'command': 'stop_livestream', 'returnCode': 0, 'returnCodeName': 'ERROR_PPCS_SUCCESSFUL', 'customData': {'command': {'name': 'deviceStopLivestream'}}}}

2024-01-26 09:28:11.776 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] event not handled -T8200N00**** - Event(type='command result', data={'source': 'device', 'event': 'command result', 'serialNumber': 'T8200N00****', 'command': 'stop_livestream', 'returnCode': 0, 'returnCodeName': 'ERROR_PPCS_SUCCESSFUL', 'customData': {'command': {'name': 'deviceStopLivestream'}}})

2024-01-26 09:28:15.470 DEBUG (MainThread) [custom_components.eufy_security] image 1 - False - None 2024-01-26 09:28:15.470 DEBUG (MainThread) [custom_components.eufy_security] async_camera_image 5 - is_empty False 2024-01-26 09:28:15.470 DEBUG (MainThread) [custom_components.eufy_security] async_camera_image 6 - 28395 2024-01-26 09:28:16.043 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _initiate_start_stream - error - command was failed - <asyncio.locks.Event object at 0x7f60f6ab0e90 [unset]> 2024-01-26 09:28:16.043 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] async_restart_livestream - start live stream end - True 2024-01-26 09:28:27.254 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] websocket client _on_close False 2024-01-26 09:28:27.254 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] on_close - executed - <Task finished name='Task-3115' coro=<WebSocketClient._process_messages() done, defined at /config/custom_components/eufy_security/eufy_security_api/web_socket_client.py:62> result=None> = None 2024-01-26 09:28:32.255 DEBUG (MainThread) [custom_components.eufy_security] async_unload_entry 1 2024-01-26 09:28:32.287 DEBUG (MainThread) [custom_components.eufy_security] async_unload_entry 2 2024-01-26 09:34:40.738 DEBUG (MainThread) [custom_components.eufy_security.config_flow] eufy_security async_step_user - None - {'_errors': {}, 'init_step': 'user', 'hass': , 'handler': 'eufy_security', 'flow_id': 'c381bc53e1d25185739e724e9ecbcd9d', 'context': {'source': 'user', 'show_advanced_options': True}, 'init_data': None} 2024-01-26 09:34:44.470 DEBUG (MainThread) [custom_components.eufy_security.config_flow] eufy_security async_step_user - {'host': '127.0.0.1', 'port': 3004} - {'_errors': {}, 'init_step': 'user', 'hass': , 'handler': 'eufy_security', 'flow_id': 'c381bc53e1d25185739e724e9ecbcd9d', 'context': {'source': 'user', 'show_advanced_options': True}, 'init_data': None, 'cur_step': {'type': <FlowResultType.FORM: 'form'>, 'flow_id': 'c381bc53e1d25185739e724e9ecbcd9d', 'handler': 'eufy_security', 'step_id': 'user', 'data_schema': <Schema({'host': <class 'str'>, 'port': <class 'int'>}, extra=PREVENT_EXTRA, required=False) object at 0x7f60d70e4ed0>, 'errors': {}, 'description_placeholders': None, 'last_step': None, 'preview': None}}

2024-01-26 09:39:45.252 ERROR (MainThread) [custom_components.eufy_security.config_flow] eufy_security Exception in login : Connection to add-on was broken. please reload the integration! - traceback: Traceback (most recent call last):

File "/config/custom_components/eufy_security/eufy_security_api/web_socket_client.py", line 42, in connect File "/config/custom_components/eufy_security/config_flow.py", line 123, in _test_credentials File "/config/custom_components/eufy_security/eufy_security_api/api_client.py", line 66, in ws_connect File "/config/custom_components/eufy_security/eufy_security_api/web_socket_client.py", line 44, in connect custom_components.eufy_security.eufy_security_api.exceptions.WebSocketConnectionException: Connection to add-on was broken. please reload the integration!

pr0fetul commented 9 months ago

I have the exact same issue on T8222-Z Firmware: 3.6.8

Deleted everything, rebooted HA, reinstalled per the HACS install tutorial - same issue - every 2-3 detections - the integration fails. If I restart the Addon - I can then re-initialize the integration and it works... for the next 1-2-3 detections - then it's off again.

Any ideas?

googanhiem commented 9 months ago

For those having this issue, I reverted back to 7.7.4 and the crashes stopped. (go to HACS, eufy security, in the top right menu click redownload, and choose that version).

pr0fetul commented 9 months ago

I tried reverting to 7.7.4 and in my case it did not work unfortunately, same issue hapends.

Sierek commented 9 months ago

I reverted back to 7.7.4 and the crashes stopped too.

BDubz20 commented 9 months ago

Have the same issue also. Reverting to 7.7.4 didn't seem to change the frequency of the issue.

robinhood-code commented 9 months ago

I have been running the integration + add on fine for months and only until yesterday I’ve added WebRTC for streaming and then the add on keeps crashing and becomes non responsive every now and then.

My issue with this is I’m running add on from a container so I can’t automate the restart of add on and need to do it manually which is a pain.

The streaming is definitely crashing the add on somehow.

ejpenney commented 9 months ago

Something weird is happening here. I had been dealing with numerous crashes daily for months. As I said before, after generating the logs it got so painful I had to revert. Then the issues went away for a week, so I upgraded again just to see. Weirdly enough, everything has been remarkably stable. Nothing has changed in my environment, but the issue seems to have (mostly) disappeared. I'm getting one or two crashes a day.

I assert two things:

  1. The integration does not successfully re-establish connections with the Add-On without the Add-On being restarted (some interface/integration exists issue between these two). I don't know who's bug it is, but it's clear this mechanism doesn't work (in some very common scenario). Could be the Add-On gets into a weird state and connections can't be established. If I turn up the wait on my reload automation to 30 minutes, then the integration remains useless for 30 minutes. It simply doesn't re-connect without intervention.
  2. Pushing notifications when the integration crashes is not the correct way to indicate a loss of connection. This feels to me like a "connection lost" scenario which according to the Home Assistant Quality Scale really should just be handled with a warning in the logs when connection is lost, and another when connection is restored. Additionally, if the recovery mechanism can be fixed, then the notification really shouldn't be necessary. Lost connections should come back momentarily. If we really want the user's attention then we should push a repair item, then resolve it when the connection is re-established. That would make this issue less "noisy".

An additional observation, that may be coincidental, but could be related: I have noticed that frequently the Add-On and Integration get "out-of-sync", which is to say, the camera entity will be "streaming" (with an error message), and if I stop the stream, the Add-On will error: no stream is running. Or vice versa, when the entity says idle, trying to start the stream will sometimes surface an error saying the stream is already running. Again, this can be resolved by restarting the add-on. I know very little about either the integration or the Add-On but I would guess the interface between these two needs some improvement for stability.

mariomaz87 commented 8 months ago

I have the same issue and the only way I can fix it is by rebooting HA. I'm running HA in a docker container, so also EufyWS is running in a docker. It has been running ok for months. Now I get the error message and the Integration is stuck on Initializing. I can disable and re-enable it and the problem persists. If I reboot HA it works for a few hours and the I get the error again.

ejpenney commented 7 months ago

The crashes seem to correlate to events, it's like, if I start streaming at the same time as a "person is detected" event occurs, the add-on crashes. Not always, sometimes (I believe) it's crashing when no events are occurring at all, but it definitely crashes with higher frequency if the stream correlates with an event.

mheiker commented 7 months ago

a couple of days ago, there was an update of the add-on. but without success, the integration is still crashing. is there an idea how to handle it?

sysofwan commented 7 months ago

+1 happening to me too. Mostly triggered by P2P streaming.

stefano1986 commented 7 months ago

+1 same error here. Use also P2P

HungryZebra563 commented 7 months ago

+1, same thing still happening for me. There's nothing of significance in the logs, either HA or the eufy-security-ws docker container

mercuryin commented 7 months ago

Same here using p2p streaming with s100 eufy.

ejpenney commented 7 months ago

I added this step to my recovery automation:

service: persistent_notification.dismiss
metadata: {}
data:
  notification_id: eufy_security_addon_connection_error

And it's a lot less annoying.

JannikL87 commented 5 months ago

+1 here.

I added this step to my recovery automation:

service: persistent_notification.dismiss
metadata: {}
data:
  notification_id: eufy_security_addon_connection_error

And it's a lot less annoying.

@ejpenney Could you share your full automation please? Thanks.

ejpenney commented 5 months ago

+1 here.

I added this step to my recovery automation:

service: persistent_notification.dismiss
metadata: {}
data:
  notification_id: eufy_security_addon_connection_error

And it's a lot less annoying.

@ejpenney Could you share your full automation please? Thanks.

You can see the full automation (updated) in my comment above.

programmeraren commented 4 months ago

Hello! I noticed as well, usually after a restart of Home Assistant, that the Eufy Integration fails to start. If I go to Addons and restart the "eufy-security-ws" and after it has started I go back to Integrations and choose Reload "Eufy Security" then everything starts up nicely without any issues. It will eventually crash but at least this is how I get it up and running after a restart. It is a bit unfortunate that it cannot survive a restart of Home Assistant... :/ It has been consistently like this since at least a couple of months back. I update Home Assistant to latest version at least once every month.

fuatakgun commented 3 months ago

After long streaming, add-on is failing apart because of over cpu utilization or something else, i am facing the same issue, but don't have any solution in place. I think bropat is aware of the issue