fuatakgun / eufy_security

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

starting configuration wizard only completes after very long timeout (re-open) #993

Open toothrot opened 1 year ago

toothrot commented 1 year ago

Re-opening (#905 and #721)

Describe the bug

On step 4 of the installation instructions:

4- Install Eufy Security service from the previous step by navigating to Settings -> Devices & Services page (https://your-instance.duckdns.org/config/integrations).

The installer hangs with an indefinite spinner as in #905 and #721 (https://user-images.githubusercontent.com/1075598/216359436-d9359854-26c9-4ca9-8c08-9e6df1f0313c.png)

To reproduce

Steps to reproduce the behavior:

1- If you have not already installed, install HACS following this guide: https://hacs.xyz/docs/setup/download

2- When HACS is ready, search for Eufy Security inside HACS Integrations

3- Install Eufy Security integration, restart your Home Assistant instance.

4- Install Eufy Security service from the previous step by navigating to Settings -> Devices & Services page (https://your-instance.duckdns.org/config/integrations). Click on Add Integration and search for Eufy Security.

Expected behavior

I expected to see the configuration window described in step 5 of the installation instructions, but instead saw an indefinite spinner.

Additional information

Hardware Information;

Nothing extra in the core logs:

2023-11-10 23:44:50.411 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration ble_monitor which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-11-10 23:44:50.412 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration eufy_security which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-11-10 23:44:50.413 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-11-10 23:44:50.415 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration climate_group which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-11-10 23:44:50.417 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration smartir which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
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
2023-11-11 04:50:28.790  INFO  Eufy Security server listening on host 0.0.0.0, port 3000 
2023-11-11 04:50:30.134  INFO  MQTT connection successfully established 
2023-11-11 04:50:30.170  INFO  Successfully registered to MQTT notifications for lock [REDACTED] 
2023-11-11 04:50:33.937  INFO  Connected to station [REDACTED] on host 192.168.1.[REDACTED] and port [REDACTED]

Additional context

First-time setup. I'm not sure what else I can debug here, and would not want to completely re-install homeassistant to try again. Is it possible to just delete data for this addon stored in homeassistant to try debugging? I'm willing to try anything.

toothrot commented 1 year ago

Good news! I have new information after the wizard finally timed out after some 20 minutes:

2023-11-10 23:50:25.453 ERROR (MainThread) [homeassistant.components.hassio] Failed to to call /addons/402f1039_eufy_security_ws/stats - Can't read stats from addon_402f1039_eufy_security_ws: Expecting value: line 1 column 1 (char 0)
2023-11-10 23:56:49.048 DEBUG (MainThread) [custom_components.eufy_security.config_flow] eufy_security async_step_user - None - {'_errors': {}, 'init_step': 'user', 'hass': <HomeAssistant RUNNING>, 'handler': 'eufy_security', 'flow_id': 'f30b0cf1ef477df05c68c52924f2b064', 'context': {'source': 'user', 'show_advanced_options': True}, 'init_data': None}
2023-11-10 23:56:49.048 DEBUG (MainThread) [custom_components.eufy_security.config_flow] eufy_security async_step_user - None - {'_errors': {}, 'init_step': 'user', 'hass': <HomeAssistant RUNNING>, 'handler': 'eufy_security', 'flow_id': 'a3718a6ba106733d36fe31794741598d', 'context': {'source': 'user', 'show_advanced_options': True}, 'init_data': None}
2023-11-10 23:56:54.816 DEBUG (MainThread) [custom_components.eufy_security.config_flow] eufy_security async_step_user - {'host': '127.0.0.1', 'port': 3000} - {'_errors': {}, 'init_step': 'user', 'hass': <HomeAssistant RUNNING>, 'handler': 'eufy_security', 'flow_id': 'f30b0cf1ef477df05c68c52924f2b064', 'context': {'source': 'user', 'show_advanced_options': True}, 'init_data': None, 'cur_step': {'type': <FlowResultType.FORM: 'form'>, 'flow_id': 'f30b0cf1ef477df05c68c52924f2b064', 'handler': 'eufy_security', 'step_id': 'user', 'data_schema': <Schema({'host': <class 'str'>, 'port': <class 'int'>}, extra=PREVENT_EXTRA, required=False) object at 0x7fe86447f590>, 'errors': {}, 'description_placeholders': None, 'last_step': None, 'preview': None}}
2023-11-10 23:56:54.830 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] on_open - executed
2023-11-10 23:56:54.832 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] websocket client _on_close False
2023-11-10 23:56:54.832 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback WebSocketClient._on_close(<Task cancell...client.py:62>>)
Traceback (most recent call last):
File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/config/custom_components/eufy_security/eufy_security_api/web_socket_client.py", line 81, in _on_close
self.close_callback(future)
File "/config/custom_components/eufy_security/eufy_security_api/api_client.py", line 308, in _on_close
_LOGGER.debug(f"on_close - executed - {future} = {future.exception()}")
^^^^^^^^^^^^^^^^^^
File "/config/custom_components/eufy_security/eufy_security_api/web_socket_client.py", line 62, in _process_messages
async def _process_messages(self):
asyncio.exceptions.CancelledError
2023-11-10 23:56:54.861 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] on_open - executed
2023-11-10 23:56:54.862 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] domain - server - EventSourceType.server - set_api_schema - {'schema_version': 19} - {'schemaVersion': 19}
2023-11-10 23:56:54.863 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] {'schemaVersion': 19, 'command': 'set_api_schema', 'messageId': 'set_api_schema.06d0944f23ab42838037533f0510d0f0'}
2023-11-10 23:56:54.863 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] send_message - {'schemaVersion': 19, 'command': 'set_api_schema', 'messageId': 'set_api_schema.06d0944f23ab42838037533f0510d0f0'}
2023-11-10 23:56:54.864 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'version', 'driverVersion': '2.9.1', 'serverVersion': '1.7.1', 'minSchemaVersion': 0, 'maxSchemaVersion': 20}
2023-11-10 23:56:54.869 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'result', 'success': True, 'messageId': 'set_api_schema.06d0944f23ab42838037533f0510d0f0', 'result': {}}
2023-11-10 23:56:54.869 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _set_products 1
2023-11-10 23:56:54.869 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] domain - server - EventSourceType.server - start_listening - {} - {}
2023-11-10 23:56:54.870 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] {'command': 'start_listening', 'messageId': 'start_listening.ba569cf0d3d44bf79dfc7c68574f74ff'}
2023-11-10 23:56:54.870 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] send_message - {'command': 'start_listening', 'messageId': 'start_listening.ba569cf0d3d44bf79dfc7c68574f74ff'}
2023-11-10 23:56:54.880 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'result', 'success': True, 'messageId': 'start_listening.ba569cf0d3d44bf79dfc7c68574f74ff', 'result': {'state': {'driver': {'version': '2.9.1', 'connected': True, 'pushConnected': False, 'mqttConnected': True}, 'stations': ['[REDACTED]'], 'devices': ['[REDACTED]']}}}
2023-11-10 23:56:54.881 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _set_products 2
2023-11-10 23:56:54.881 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] domain - device - EventSourceType.product - device.get_properties - {'domain': 'device', 'serial_no': '[REDACTED]'} - {'serialNumber': '[REDACTED]'}
2023-11-10 23:56:54.881 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] {'serialNumber': '[REDACTED]', 'command': 'device.get_properties', 'messageId': 'device.get_properties.3810b597f464423784f3c4e6584a1388'}
2023-11-10 23:56:54.881 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] send_message - {'serialNumber': '[REDACTED]', 'command': 'device.get_properties', 'messageId': 'device.get_properties.3810b597f464423784f3c4e6584a1388'}
2023-11-10 23:56:54.897 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'result', 'success': True, 'messageId': 'device.get_properties.3810b597f464423784f3c4e6584a1388', 'result': {'serialNumber': '[REDACTED]', 'properties': {'name': 'Front Door', 'model': 'T8520', 'serialNumber': '[REDACTED]', 'hardwareVersion': 'P3', 'softwareVersion': '1.4.2.8', 'type': 51, 'stationSerialNumber': '[REDACTED]', 'battery': 67, 'locked': True, 'lockStatus': 4, 'autoLock': True, 'autoLockTimer': 1, 'autoLockSchedule': False, 'autoLockScheduleStartTime': '23:00', 'autoLockScheduleEndTime': '06:00', 'oneTouchLocking': True, 'wrongTryProtection': True, 'wrongTryAttempts': 3, 'wrongTryLockdownTime': 300, 'scramblePasscode': True, 'sound': 3, 'notification': False, 'notificationUnlocked': False, 'notificationLocked': True}}}
2023-11-10 23:56:54.897 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] domain - device - EventSourceType.product - device.get_properties_metadata - {'domain': 'device', 'serial_no': '[REDACTED]'} - {'serialNumber': '[REDACTED]'}
2023-11-10 23:56:54.897 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] {'serialNumber': '[REDACTED]', 'command': 'device.get_properties_metadata', 'messageId': 'device.get_properties_metadata.b1ac98a684ba49d9b0bf8f03f49db4ac'}
2023-11-10 23:56:54.898 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] send_message - {'serialNumber': '[REDACTED]', 'command': 'device.get_properties_metadata', 'messageId': 'device.get_properties_metadata.b1ac98a684ba49d9b0bf8f03f49db4ac'}
2023-11-10 23:56:54.904 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'result', 'success': True, 'messageId': 'device.get_properties_metadata.b1ac98a684ba49d9b0bf8f03f49db4ac', 'result': {'serialNumber': '[REDACTED]', 'properties': {'name': {'key': 'device_name', 'name': 'name', 'label': 'Name', 'readable': True, 'writeable': False, 'type': 'string'}, 'model': {'key': 'device_model', 'name': 'model', 'label': 'Model', 'readable': True, 'writeable': False, 'type': 'string'}, 'serialNumber': {'key': 'device_sn', 'name': 'serialNumber', 'label': 'Serial number', 'readable': True, 'writeable': False, 'type': 'string'}, 'type': {'key': 'device_type', 'name': 'type', 'label': 'Type', 'readable': True, 'writeable': False, 'type': 'number', 'states': {'0': 'Station', '1': 'Camera', '2': 'Sensor (T8900)', '3': 'Floodlight', '4': 'Camera E', '5': 'Doorbell', '7': 'Battery Doorbell', '8': 'Camera 2', '9': 'eufyCam S210 (eufyCam 2C)', '10': 'Motion Sensor (T8910)', '11': 'Keypad', '14': 'eufyCam S221 (eufyCam 2 Pro)', '15': 'eufyCam S220 (eufyCam 2C P
2023-11-10 23:56:54.905 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] domain - device - EventSourceType.product - device.get_commands - {'domain': 'device', 'serial_no': '[REDACTED]'} - {'serialNumber': '[REDACTED]'}
2023-11-10 23:56:54.905 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] {'serialNumber': '[REDACTED]', 'command': 'device.get_commands', 'messageId': 'device.get_commands.25d41158087f4872a72f2231e3ce5cf2'}
2023-11-10 23:56:54.905 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] send_message - {'serialNumber': '[REDACTED]', 'command': 'device.get_commands', 'messageId': 'device.get_commands.25d41158087f4872a72f2231e3ce5cf2'}
2023-11-10 23:56:54.908 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'result', 'success': True, 'messageId': 'device.get_commands.25d41158087f4872a72f2231e3ce5cf2', 'result': {'serialNumber': '[REDACTED]', 'commands': ['lock_calibration', 'add_user', 'delete_user', 'update_user_passcode', 'update_user_schedule', 'update_username']}}
2023-11-10 23:56:54.909 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _set_properties -[REDACTED] - {'name': 'Front Door', 'model': 'T8520', 'serialNumber': '[REDACTED]', 'hardwareVersion': 'P3', 'softwareVersion': '1.4.2.8', 'type': 51, 'stationSerialNumber': '[REDACTED]', 'battery': 67, 'locked': True, 'lockStatus': 4, 'autoLock': True, 'autoLockTimer': 1, 'autoLockSchedule': False, 'autoLockScheduleStartTime': '23:00', 'autoLockScheduleEndTime': '06:00', 'oneTouchLocking': True, 'wrongTryProtection': True, 'wrongTryAttempts': 3, 'wrongTryLockdownTime': 300, 'scramblePasscode': True, 'sound': 3, 'notification': False, 'notificationUnlocked': False, 'notificationLocked': True}
2023-11-10 23:56:54.909 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] domain - station - EventSourceType.product - station.get_properties - {'domain': 'station', 'serial_no': '[REDACTED]'} - {'serialNumber': '[REDACTED]'}
2023-11-10 23:56:54.910 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] {'serialNumber': '[REDACTED]', 'command': 'station.get_properties', 'messageId': 'station.get_properties.0b8200e981a8442ba2139e811e43f125'}
2023-11-10 23:56:54.910 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] send_message - {'serialNumber': '[REDACTED]', 'command': 'station.get_properties', 'messageId': 'station.get_properties.0b8200e981a8442ba2139e811e43f125'}
2023-11-10 23:56:54.914 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'result', 'success': True, 'messageId': 'station.get_properties.0b8200e981a8442ba2139e811e43f125', 'result': {'serialNumber': '[REDACTED]', 'properties': {'name': 'Front Door', 'model': 'T8520', 'serialNumber': '[REDACTED]', 'type': 51, 'hardwareVersion': 'P3', 'softwareVersion': '1.4.2.8'}}}
2023-11-10 23:56:54.915 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] domain - station - EventSourceType.product - station.get_properties_metadata - {'domain': 'station', 'serial_no': '[REDACTED]'} - {'serialNumber': '[REDACTED]'}
2023-11-10 23:56:54.915 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] {'serialNumber': '[REDACTED]', 'command': 'station.get_properties_metadata', 'messageId': 'station.get_properties_metadata.b35e7291303442749d3dad8ebd19cd2c'}
2023-11-10 23:56:54.915 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] send_message - {'serialNumber': '[REDACTED]', 'command': 'station.get_properties_metadata', 'messageId': 'station.get_properties_metadata.b35e7291303442749d3dad8ebd19cd2c'}
2023-11-10 23:56:54.918 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'result', 'success': True, 'messageId': 'station.get_properties_metadata.b35e7291303442749d3dad8ebd19cd2c', 'result': {'serialNumber': '[REDACTED]', 'properties': {'name': {'key': 'station_name', 'name': 'name', 'label': 'Name', 'readable': True, 'writeable': False, 'type': 'string'}, 'model': {'key': 'station_model', 'name': 'model', 'label': 'Model', 'readable': True, 'writeable': False, 'type': 'string'}, 'serialNumber': {'key': 'station_sn', 'name': 'serialNumber', 'label': 'Serial number', 'readable': True, 'writeable': False, 'type': 'string'}, 'type': {'key': 'device_type', 'name': 'type', 'label': 'Type', 'readable': True, 'writeable': False, 'type': 'number', 'states': {'0': 'Station', '1': 'Camera', '2': 'Sensor (T8900)', '3': 'Floodlight', '4': 'Camera E', '5': 'Doorbell', '7': 'Battery Doorbell', '8': 'Camera 2', '9': 'eufyCam S210 (eufyCam 2C)', '10': 'Motion Sensor (T8910)', '11': 'Keypad', '14': 'eufyCam S221 (eufyCam 2 Pro)', '15': 'eufyCam S220 (eufyCam
2023-11-10 23:56:54.919 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] domain - station - EventSourceType.product - station.get_commands - {'domain': 'station', 'serial_no': '[REDACTED]'} - {'serialNumber': '[REDACTED]'}
2023-11-10 23:56:54.919 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] {'serialNumber': '[REDACTED]', 'command': 'station.get_commands', 'messageId': 'station.get_commands.23ef9ef35b4f456cad4f7b2ad20de3ff'}
2023-11-10 23:56:54.919 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] send_message - {'serialNumber': '[REDACTED]', 'command': 'station.get_commands', 'messageId': 'station.get_commands.23ef9ef35b4f456cad4f7b2ad20de3ff'}
2023-11-10 23:56:54.922 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'result', 'success': True, 'messageId': 'station.get_commands.23ef9ef35b4f456cad4f7b2ad20de3ff', 'result': {'serialNumber': '[REDACTED]', 'commands': []}}
2023-11-10 23:56:54.922 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _set_properties -[REDACTED] - {'name': 'Front Door', 'model': 'T8520', 'serialNumber': '[REDACTED]', 'type': 51, 'hardwareVersion': 'P3', 'softwareVersion': '1.4.2.8'}
2023-11-10 23:59:15.935 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'driver', 'event': 'push disconnected'}}
toothrot commented 1 year ago

After configuration and waiting some time, I still see repeated error messages similar to:

2023-11-11 00:30:58.222 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback WebSocketClient._on_close(<Task cancell...client.py:62>>)
Traceback (most recent call last):
File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/config/custom_components/eufy_security/eufy_security_api/web_socket_client.py", line 81, in _on_close
self.close_callback(future)
File "/config/custom_components/eufy_security/eufy_security_api/api_client.py", line 308, in _on_close
_LOGGER.debug(f"on_close - executed - {future} = {future.exception()}")
^^^^^^^^^^^^^^^^^^
File "/config/custom_components/eufy_security/eufy_security_api/web_socket_client.py", line 63, in _process_messages
async for msg in self.socket:
File "/usr/local/lib/python3.11/site-packages/aiohttp/client_ws.py", line 297, in __anext__
msg = await self.receive()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/client_ws.py", line 229, in receive
msg = await self._reader.read()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/streams.py", line 657, in read
return await super().read()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/streams.py", line 616, in read
await self._waiter
asyncio.exceptions.CancelledError
2023-11-11 00:31:36.489 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback WebSocketClient._on_close(<Task cancell...client.py:62>>)
Traceback (most recent call last):
File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/config/custom_components/eufy_security/eufy_security_api/web_socket_client.py", line 81, in _on_close
self.close_callback(future)
File "/config/custom_components/eufy_security/eufy_security_api/api_client.py", line 308, in _on_close
_LOGGER.debug(f"on_close - executed - {future} = {future.exception()}")
^^^^^^^^^^^^^^^^^^
File "/config/custom_components/eufy_security/eufy_security_api/web_socket_client.py", line 62, in _process_messages
async def _process_messages(self):
asyncio.exceptions.CancelledError
fuatakgun commented 1 year ago

I will try and install latest version of the integration in a clean dev environment and report back.

do you have any updates on your end?

mcoms commented 1 year ago

Same here with Home Assistant v2023.11.3 running in docker, however, I was able to get it working...

Versions:

The wizard completed for me after doing the following:

It seems like simply installing the integration and restarting the container wasn't enough.

yigitgungor commented 11 months ago

On Home Assistant Gree, complete reboot of the HAOS (not just restarting home assistant) seems to fix the issue.