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

Unable to add family devices - unknown error #441

Open
phil-uniav opened this issue Mar 12, 2025 · 5 comments
Open

Unable to add family devices - unknown error #441

phil-uniav opened this issue Mar 12, 2025 · 5 comments

Comments

@phil-uniav
Copy link

Whenever i try to add a family device in to the system i receive an unknown error.
I have tried two different devices, i get the same error each time.

here is the log

Logger: aiohttp.server
Source: /usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py:451
First occurred: 07:58:15 (1 occurrences)
Last logged: 07:58:15

Error handling request from 10.3.0.177
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py", line 480, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/aiohttp/web_app.py", line 569, in _handle
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/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 295, 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 121, in post
result = await self._flow_mgr.async_configure(flow_id, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 340, in async_configure
result = await self._async_configure(flow_id, user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 387, in _async_configure
result = await self._async_handle_step(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
flow, cur_step["step_id"], user_input
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 490, in _async_handle_step
result: _FlowResultT = await getattr(flow, method)(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/icloud3/config_flow.py", line 3123, in async_step_add_device
user_input = self._set_other_device_field_values(user_input)
File "/config/custom_components/icloud3/config_flow.py", line 3178, in _set_other_device_field_values
device_type = DEVICE_TYPE_FNAMES[model].lower()
^^^^^
UnboundLocalError: cannot access local variable 'model' where it is not associated with a value

@gcobb321
Copy link
Owner

The code looks like it first tries to get the device type from the iCloud device info and, if that is not a known device type (IPHONE, IPAD, WATCH, AIRPODS, MAC, IPOD, ICLOUD), tries to get it from the mobile app. And that is generating the error.

What is the type of device you are using?
Have you specified it on the Configure > iCloud3 Devices screen, then Select for the Update Device screen?
The device type is just an information field and not really used for tracking. Try setting it to iPhone and see if that works

@phil-uniav
Copy link
Author

phil-uniav commented Mar 12, 2025 via email

@phil-uniav
Copy link
Author

i see what you mean now, edit the already connected device?!. it was already set to iphone, i changed to other, tested - not working, then set it back to iphone - not working.

@gcobb321
Copy link
Owner

gcobb321 commented Mar 12, 2025

I am actually in Nairobi, Kenya on a safari but have looked at the code.

Edit the icloud3/config_flow.py file. The following code starts at line 3158.

From:

        # Get device_type from iCloud device info
        device_type = ''
        if user_input[CONF_FAMSHR_DEVICENAME] != 'None': 

To:

        # Get device_type from iCloud device info
        device_type = ''
        model = 'iphone'
        if user_input[CONF_FAMSHR_DEVICENAME] != 'None': 

You adding the model = ‘iphone’ after device_type = ‘’ at line 3160.

Make sure the model lines up with device_type.
Save the file and restart HA.

@phil-uniav
Copy link
Author

perfect, thank you

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

2 participants