Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown error when add new Apple account #390

Open
sammy-mm opened this issue Nov 8, 2024 · 9 comments
Open

Unknown error when add new Apple account #390

sammy-mm opened this issue Nov 8, 2024 · 9 comments

Comments

@sammy-mm
Copy link

sammy-mm commented Nov 8, 2024

Hi,
had this problem with version 3.1 an still with 3.1.1.
HA is up to date.
When adding a new apple account the page give an "unknown error".
Could you help?
Thats the logfile:

Logger: aiohttp.server
Quelle: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:448
Erstmals aufgetreten: 06:00:26 (1 Vorkommnisse)
Zuletzt protokolliert: 06:00:26

Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 559, in _handle
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
return await func(self, request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 285, in post
return await super().post(request, flow_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
return await method(view, request, data, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
result = await self._flow_mgr.async_configure(flow_id, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in async_configure
result = await self._async_configure(flow_id, user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 414, in _async_configure
result = await self._async_handle_step(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 517, in _async_handle_step
result: _FlowResultT = await getattr(flow, method)(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/icloud3/config_flow.py", line 1974, in async_step_update_apple_acct
self._update_conf_apple_accounts(self.aa_idx, user_input)
File "/config/custom_components/icloud3/config_flow.py", line 2055, in _update_conf_apple_accounts
if Gb.conf_apple_accounts[0][CONF_USERNAME] == '':
~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

@sammy-mm
Copy link
Author

sammy-mm commented Nov 8, 2024

After saving everything again I got this:
Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.icloud3
Quelle: custom_components/icloud3/support/pyicloud_ic3.py:827
Integration: iCloud3 v3 (Dokumentation, Probleme)
Erstmals aufgetreten: 05:57:28 (3 Vorkommnisse)
Zuletzt protokolliert: 06:12:55

sam********, Authentication Failed, Python SRP Library Credentials Error. The Python module that creates the Secure Remote Password hash key has calculated an incorrect value for a valid Username/Password. Try changing the Password to see if the Apple Acct can be logged into. ErrorCode-401
Traceback (most recent call last):
File "/config/custom_components/icloud3/support/pyicloud_ic3.py", line 655, in init
self.authenticate()
File "/config/custom_components/icloud3/support/pyicloud_ic3.py", line 827, in authenticate
raise PyiCloudFailedLoginException(err_msg)
custom_components.icloud3.support.pyicloud_ic3.PyiCloudFailedLoginException: sam********, Authentication Failed, Python SRP Library Credentials Error. The Python module that creates the Secure Remote Password hash key has calculated an incorrect value for a valid Username/Password. Try changing the Password to see if the Apple Acct can be logged into. ErrorCode-401

@ahentsch
Copy link

ahentsch commented Nov 8, 2024

Same issue, same message but user & PW correct
—- Update: Changing the Password has solved the issue like you suggested

@gcobb321
Copy link
Owner

gcobb321 commented Nov 8, 2024

@ahentsch
See my note here

@gcobb321
Copy link
Owner

gcobb321 commented Nov 8, 2024

@sammy-mm
I just uploaded v3.1.2 to HACS which fixes this error. It was caused by no Apple accounts being set up and the configuration file had an empty one in the data fields for the Apple account username/password.

File "/config/custom_components/icloud3/config_flow.py", line 2055, in _update_conf_apple_accounts
if Gb.conf_apple_accounts[0][CONF_USERNAME] == '':
~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

@sammy-mm
Copy link
Author

sammy-mm commented Nov 9, 2024

@gcobb321
Thank you so much! First, it did not work completly. Still got the SRP error. Chenged my Apple Account password and now I´m able to log in!!! :-)
But now I got an "unkown error" when try to setup my devices. No errors in the HA logging.

@gcobb321
Copy link
Owner

gcobb321 commented Nov 9, 2024

@sammy-mm
Go to HA settings > System > Logs and click on anything related to iCloud3 and. It will display the error info. Post that here and I’ll see what it’s going on.

Did v3.1.1 work ok?
In the iCloud3 Devices screen, click Tools - RReset Data Sources, Delete Devices. Then select Reset All Device Data Sources. This will clear the Apple Account and Mobile App selection for all devices. Then see if you can display each one and reject the Apple acct and Mobile App.

I am going away go 3-weeks on Sunday so I would like to fix this as soon as possible.

@sammy-mm
Copy link
Author

sammy-mm commented Nov 9, 2024

@gcobb321
Thanks for helping!

Got my errors also with 3.1.1. Now I´m on 3.1.2.
The "unknown error" rises when I try to enter the iCloud3 Devices screen, so can´t change anything there.
Restarting the integration brings this:

Error setting up entry iCloud3 for device_tracker
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 635, in __async_setup_with_context
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/device_tracker/config_entry.py", line 56, in async_setup_entry
return await component.async_setup_entry(entry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 186, in async_setup_entry
raise ValueError(
ValueError: Config entry iCloud3 (01JC2DG7Q81307EXNZ46WA7KJ2) for icloud3.device_tracker has already been setup!

Try enter the Device screen comes with that:

Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 559, in _handle
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
return await func(self, request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 285, in post
return await super().post(request, flow_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
return await method(view, request, data, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
result = await self._flow_mgr.async_configure(flow_id, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in async_configure
result = await self._async_configure(flow_id, user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 414, in _async_configure
result = await self._async_handle_step(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 517, in _async_handle_step
result: _FlowResultT = await getattr(flow, method)(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/icloud3/config_flow.py", line 532, in async_step_menu_0
return await self.async_step_menu(user_input, errors)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/icloud3/config_flow.py", line 610, in async_step_menu
return await self.async_step_device_list()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/icloud3/config_flow.py", line 2740, in async_step_device_list
await self._build_mobapp_entity_selection_list()
File "/config/custom_components/icloud3/config_flow.py", line 4001, in _build_mobapp_entity_selection_list
Device = Gb.Devices_by_devicename[devicename]
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'iphone_sam'

@gcobb321
Copy link
Owner

gcobb321 commented Nov 9, 2024

Unzip patch-config_flow.zip into the icloud3 directory and restart HA.
patch-config_flow.zip

It is trying to get the name of 'iphone_sam' from a mobapp_devicename. Is this a valid iCloud3 device name?

@sammy-mm
Copy link
Author

sammy-mm commented Nov 9, 2024

Gary, seems that that does the trick!
Yes that was the name of the device when I was configured for the first time long time ago in iCloud3. ;-)
Thanks again. Now I configured the first device again and everything seems to work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants