schmittx / home-assistant-eero

Eero integration for Home Assistant
MIT License
122 stars 23 forks source link

"Unknown error occurred." #77

Closed PartyingChair closed 7 months ago

PartyingChair commented 8 months ago

Tried authentication with email and with phone. Both just give me unknown error with no other info. Waited 2 days, tried again same error.

rogorvi commented 8 months ago

I got the same error with my email. When I try the phone option I get the message "Enter the verification code that was sent to..." but no code is received.

nsalazar commented 8 months ago

I also got the error AFTER i input the verification code eeroerror

I had a configuration already working until a few days ago when I just noticed the error. I tried to press the button Configure in Integrations, but I got another error. Then I deleted it and started from zero, but this error below appeared:

Here is the log of the error when after Verify Eero account:

2024-02-01 17:26:55.648 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 233, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 149, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 63, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 177, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 320, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 416, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eero/config_flow.py", line 103, in async_step_verify
    self.response = await self.hass.async_add_executor_job(self.api.update)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eero/api/__init__.py", line 197, in update
    update_data["release_notes"] = self.get_release_notes(url=update_data["manifest_resource"])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eero/api/__init__.py", line 85, in get_release_notes
    raise EeroException(response)
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eero/api/__init__.py", line 34, in __init__
    data = json.loads(response.text)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
thayerfox commented 7 months ago

I have the same issue. It was working fine until the update to 2024.2. Tried to reconfigure after the update, got error 500. Uninstalled, reinstalled and tried multiple times to set up, both via email and phone.

I think this error log is saying the json returned from the eero api is not in the expected format when parsing the release notes section?

Logger: aiohttp.server
Source: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421
First occurred: 8:02:04 PM (1 occurrences)
Last logged: 8:02:04 PM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 91, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 149, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 72, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 185, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 358, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 404, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 501, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eero/config_flow.py", line 103, in async_step_verify
    self.response = await self.hass.async_add_executor_job(self.api.update)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eero/api/__init__.py", line 197, in update
    update_data["release_notes"] = self.get_release_notes(url=update_data["manifest_resource"])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eero/api/__init__.py", line 85, in get_release_notes
    raise EeroException(response)
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eero/api/__init__.py", line 34, in __init__
    data = json.loads(response.text)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
rogorvi commented 7 months ago

For me this was solved by using an email account instead of my amzon account to login into my eero. See the notes from the readme: "This integration does not support login via Amazon account. A workaround is to create a new account without Amazon login and add that account as another network admin."

PartyingChair commented 7 months ago

I am not using an Amazon account, and never was.

On Thu, Feb 8, 2024, at 11:20 PM, rogorvi wrote:

For me this was solved by using an email account instead of my amzon account to login into my eero. See the notes from the readme: "This integration does not support login via Amazon account. A workaround is to create a new account without Amazon login and add that account as another network admin."

— Reply to this email directly, view it on GitHub https://github.com/schmittx/home-assistant-eero/issues/77#issuecomment-1935393170, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARYQVRKIINUZOGZRF6M7OE3YSW5ZJAVCNFSM6AAAAABB2QRYYCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZVGM4TGMJXGA. You are receiving this because you authored the thread.Message ID: @.***>

thayerfox commented 7 months ago

It seems to be an issue parsing the release notes section of the API JSON.

Commenting out this line: update_data["release_notes"] = self.get_release_notes(url=update_data["manifest_resource"]) and rebooting will allow the integration to authenticate. The lastest FW sensors of the Eero devices won't work though.

thayerfox commented 7 months ago

Dug a little deeper. The URL returned from the API for the manifest resource seems to be invalid.

EeroAPI network_data: {'preferred_update_hour': 2, 'min_required_firmware': 'v1.1.2', 'target_firmware': 'v7.1.1-16', 'update_to_firmware': 'v7.1.1-16', 'update_required': False, 'can_update_now': False, 'has_update': False, 'update_status': None, 'scheduled_update_time': None, 'last_update_started': '2023-12-15T18:33:18.349352Z', 'last_user_update': {'last_update_started': '2023-12-15T18:33:18.349352Z', 'unresponsive_eeros': [], 'incomplete_eeros': []}, 'manifest_resource': 'https://eeroassets.com/eeroOS-release-notes/251e2da3-e726-40c1-b9d0-34d17673d59b/v7.1.1_en-CA.json'}

the manifest_resource parsing is what is failing as it appears to be returning NoSuchKey from the API. ` NoSuchKey

The specified key does not exist. eeroOS-release-notes/251e2da3-e726-40c1-b9d0-34d17673d59b/v7.1.1_en-CA.json xxxxxx xxxxxx

`

Interestingly, the eero android app isn't loading firmware history either. I think the issue is with eero. For now, to get by, comment out line 197 of customcomponents/eero/api/ / init _.py

gravymaker17 commented 7 months ago

Excellent work, thanks for this! Commenting out line 197 of customcomponents/eero/api// init _.py solved my issue.

PacoCT commented 7 months ago

Hi,

I'm having the same error.

I do not understand "A workaround is to create a new account without Amazon login and add that account as another network admin". Where is this account suppose to be created?

Line 197 of my version in init.py is raise UpdateFailed(f"Error communicating with API: {exception.error_message}")

Is that the line that needs to be commented?

Thanks in advance

thayerfox commented 7 months ago

The line that needs to be commented out is update_data["release_notes"] = self.get_release_notes(url=update_data["manifest_resource"])

which is 197 of eero\api\ --init--py not eero\ --init--.py

PacoCT commented 7 months ago

The line that needs to be commented out is update_data["release_notes"] = self.get_release_notes(url=update_data["manifest_resource"])

which is 197 of eero\api\ --init--py not eero\ --init--.py

Thank you very much!! I was looking at the wrong --init--.py That did it, now I went one step further :-)

Now, the integration is installed but my eero network doesn't appear. It could be because I've HA installed in a PC connected by ethernet to my network. I'll keep trying. Regards,

PacoCT commented 7 months ago

Hi,

I'm having the same error.

I do not understand "A workaround is to create a new account without Amazon login and add that account as another network admin". Where is this account suppose to be created?

Line 197 of my version in init.py is raise UpdateFailed(f"Error communicating with API: {exception.error_message}")

Is that the line that needs to be commented?

Thanks in advance

I figured out the "create a new account" issue: the account need to be created in the eero app.

Creating a New eero Account:

While the eero system allows linking with an Amazon account, creating a separate eero account offers more control and flexibility. Here's a step-by-step guide on how to do it within the eero app:

Invite a New Admin: Start by inviting the "new" account to become an admin on your existing eero network. This can be done through the app's sharing settings. Important: Ensure this new admin has a unique email address that hasn't been used for an eero account before.

Log Out of the Amazon Connected Account : If you previously connected your eero to an Amazon account, you can log out of it if desired. To log out, go to the app's settings and find the connected accounts section.

Create a New eero Account: On the invited admin's device, open the eero app and select "Create Account." Enter the new admin's unique email address and create a strong password. Verify the account using the email sent to the new address.

Log In with the New Account: Back on the invited admin's device, log in to the eero app using the newly created account credentials.

Accept the Invitation: The invited admin should receive a notification within the app to accept the invitation to join the network. Tap "Accept" to join the network with the new account.

schmittx commented 7 months ago

@PacoCT Thanks for the detailed instructions for creating a new eero account, I'll add it to the documentation.

@thayerfox You're correct, the eero firmware release history and notes are incorrect on eero's side. Only thing that can be done is to update the integration to fail more gracefully. I'll try to push an update soon. Otherwise, commenting that line out is the best bet.

thayerfox commented 7 months ago

@schmittx, I actually have a support ticket in with eero, as the software version history is also broken in their latest android app. No resolution for the official app so far, but it did get escalated to a support engineer.

schmittx commented 7 months ago

I published a beta release with multiple bug fixes, give a try and let me know if it helps.

thayerfox commented 7 months ago

The integration loaded without errors, but all the entities are unavailable. Selecting configure in the integration does not show any networks in the popup. Do I need to remove and re add the network again? No errors in the log either.

schmittx commented 7 months ago

Strange. Before deleting the integration can you try enabling debug logging and/ saving responses from the configure menu?

thayerfox commented 7 months ago
image image

2024-03-04 20:16:11.724 DEBUG (SyncWorker_3) [custom_components.eero.api]

I tried to remove and readd, same thing.

schmittx commented 7 months ago

@thayerfox I published an update to the beta. Please install and let me know if it resolves the issue.

thayerfox commented 7 months ago

@schmittx the b1 version solved the initialization issue. Only thing now seems to be this extra radiobox in the configure screen. Perhaps because I don't have eero premium?

image
schmittx commented 7 months ago

@thayerfox Glad to hear it. Regarding the config screen, it looks like a frontend issue because you're missing text regarding QR code option (the 2nd radio box). Make sure you're copying strings.json and the translations folder (including en.json inside) over as well. Then do a hard refresh and/or clear the cache of your browser to ensure the frontend updates.

thayerfox commented 7 months ago

Those were copied, and I did do a ctrl+f5 on the page. Cleared browser cache as well. Same issue on mobile too.

There doesn't seem to be anything in that container?

image image
schmittx commented 7 months ago

@thayerfox I'm not very experienced with frontend work so I'm running out of suggestions unfortunately. Things seem fine on my end, and inspection shows content in that container. I'd imagine there'd be more complaints if this was a widespread issue. Only other thing I can think is that you've set the language for your Home Assistant profile to something other than American English?

image

thayerfox commented 7 months ago

I had it set to Canada/English, but no change when changing local to US/English.

Its not a huge issue, especially since I can see what the option is supposed to be with your screenshot.

schmittx commented 7 months ago

Understood, glad you can at least use it though. Any chance it's a browser-specific issue? Have you tried with Chrome, Safari, Edge, etc.?

thayerfox commented 7 months ago

I've tried with chrome and edge on windows and chrome on android. Same thing, very odd. It was also blank on 1.4.5, so its not a new bug.

schmittx commented 7 months ago

Closing this as the beta updates have been reflected into newest release here.

thayerfox commented 7 months ago

@schmittx I just updated to 2024.3 and magically the QR code option started displaying correctly. Something must have been cached I guess.

image

Thanks for your help!

schmittx commented 7 months ago

@thayerfox Awesome, glad it's resolved now!