home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74.09k stars 31.09k forks source link

Eufy Component of core causing error message. #112758

Open karllogue opened 8 months ago

karllogue commented 8 months ago

The problem

I have been receiving this error across multiple versions of HA. Some versions of HA (the first March 2024 version for instance) cause all of the devices in the Eufy integration to no longer be recognized. Restoring to a previous version of HA fixes this. This error, however, has been consistent, even when the Eufy devices are properly recognized.

Logger: homeassistant.setup Source: setup.py:333 First occurred: 2:32:57 AM (1 occurrences) Last logged: 2:32:57 AM

Error during setup of component eufy Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 333, in _async_setup_component result = await task ^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/eufy/init.py", line 61, in setup data = lakeside.get_devices( ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/lakeside/init.py", line 39, in get_devices token = r.json()['access_token']


KeyError: 'access_token'

According to fuatakgun](https://github.com/fuatakgun, the issue "issue is coming from eufy component of core not eufy security custom component".

It seems every other iteration of HA causes Eufy to lose the devices. 

### What version of Home Assistant Core has the issue?

2024.2.5

### What was the last working version of Home Assistant Core?

_No response_

### What type of installation are you running?

Home Assistant OS

### Integration causing the issue

Eufy

### Link to integration documentation on our website

_No response_

### Diagnostics information

_No response_

### Example YAML snippet

_No response_

### Anything in the logs that might be useful for us?

```txt
2024-03-07 19:56:02.278 ERROR (MainThread) [homeassistant.setup] Error during setup of component eufy
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 390, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/eufy/__init__.py", line 61, in setup
    data = lakeside.get_devices(
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/lakeside/__init__.py", line 39, in get_devices
    token = r.json()['access_token']
            ~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'access_token'
```

### Additional information

_No response_
home-assistant[bot] commented 8 months ago

eufy documentation eufy source

billdwhite commented 6 months ago

I'm seeing this same issue as well; my Eufy components work and the integration is functioning fine. But I still see this in the system notifications after every reboot

issue-triage-workflows[bot] commented 3 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

romeoro commented 3 months ago

Issue still present with latest HA version (2024.08.0). First time installation means no devices are discovered.

Naked installation via configuration.yaml:

eufy:
  username: EMAIL_ADDRESS
  password: PASSWORD

leads to the error.

Logger: homeassistant.setup
Quelle: setup.py:416
Erstmals aufgetreten: 22:35:13 (1 Vorkommnisse)
Zuletzt protokolliert: 22:35:13

Error during setup of component eufy
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 416, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/eufy/__init__.py", line 62, in setup
    data = lakeside.get_devices(
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/lakeside/__init__.py", line 39, in get_devices
    token = r.json()['access_token']
            ~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'access_token'
logandirks commented 3 months ago

Issue Remains:

Logger: homeassistant.setup Source: setup.py:416 First occurred: 8:05:02 PM (1 occurrences) Last logged: 8:05:02 PM

Error during setup of component eufy Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 416, in _async_setup_component result = await task ^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/eufy/init.py", line 62, in setup data = lakeside.get_devices( ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/lakeside/init.py", line 39, in get_devices token = r.json()['access_token']


KeyError: 'access_token'

Core
2024.8.3
Supervisor
2024.08.0
Operating System
13.1
Frontend
20240809.0
logandirks commented 1 month ago

Issue remains, tried something else and attempted using curl to pull local access tokens as shown in the integration page and received {"res_code":500,"message":"Service is temporarily unavailable. Please try again later."}

koerbcm commented 1 month ago

I have seen this same issue since the first time I got it working. Would love to silence these error logs as it is just extra noise.

Jakobmhc commented 4 weeks ago

I could not add the integration, hence ended up here :) Is there a work-around rather than rolling back to an earlier version of HA?

Update, just took a little look in the code. It looks a lot like this old bug: https://github.com/home-assistant/core/issues/14158

Update 2, but yes it seems that the endpoint just returns an error 500, which then in turn cause the lakeside to fail due to missing tokens in the response.

How do you guys go about talking to Eufy for them to fix the endpoint? Es der any documentation for the api anywhere? I haven't been able to find any.