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

[icloud3] 'NoneType' object has no attribute 'model' #4

Closed
poudenes opened this issue Dec 18, 2022 · 5 comments
Closed

[icloud3] 'NoneType' object has no attribute 'model' #4

poudenes opened this issue Dec 18, 2022 · 5 comments

Comments

@poudenes
Copy link

I see those error lines in HA log.

Home Assistant 2022.12.7
Supervisor 2022.11.2
Operating System 9.4
Frontend 20221213.1 - latest

2022-12-18 10:30:30.295 ERROR (MainThread) [icloud3] 'NoneType' object has no attribute 'model'
Traceback (most recent call last):
  File "/config/custom_components/icloud3/helpers/entity_io.py", line 137, in get_entity_registry_data
    raw_model = device_reg_data.model
AttributeError: 'NoneType' object has no attribute 'model'
2022-12-18 10:30:30.297 ERROR (MainThread) [icloud3] 'NoneType' object has no attribute 'model'
Traceback (most recent call last):
  File "/config/custom_components/icloud3/helpers/entity_io.py", line 137, in get_entity_registry_data
    raw_model = device_reg_data.model
AttributeError: 'NoneType' object has no attribute 'model'
2022-12-18 10:30:30.300 ERROR (MainThread) [icloud3] 'NoneType' object has no attribute 'model'
Traceback (most recent call last):
  File "/config/custom_components/icloud3/helpers/entity_io.py", line 137, in get_entity_registry_data
    raw_model = device_reg_data.model
AttributeError: 'NoneType' object has no attribute 'model'
2022-12-18 10:30:30.302 ERROR (MainThread) [icloud3] 'NoneType' object has no attribute 'model'
Traceback (most recent call last):
  File "/config/custom_components/icloud3/helpers/entity_io.py", line 137, in get_entity_registry_data
    raw_model = device_reg_data.model
AttributeError: 'NoneType' object has no attribute 'model'
2022-12-18 10:30:30.305 ERROR (MainThread) [icloud3] 'NoneType' object has no attribute 'model'
Traceback (most recent call last):
  File "/config/custom_components/icloud3/helpers/entity_io.py", line 137, in get_entity_registry_data
    raw_model = device_reg_data.model
AttributeError: 'NoneType' object has no attribute 'model'
2022-12-18 10:30:30.307 ERROR (MainThread) [icloud3] 'NoneType' object has no attribute 'model'
Traceback (most recent call last):
  File "/config/custom_components/icloud3/helpers/entity_io.py", line 137, in get_entity_registry_data
    raw_model = device_reg_data.model
AttributeError: 'NoneType' object has no attribute 'model'
2022-12-18 10:30:30.309 ERROR (MainThread) [icloud3] 'NoneType' object has no attribute 'model'
Traceback (most recent call last):
  File "/config/custom_components/icloud3/helpers/entity_io.py", line 137, in get_entity_registry_data
    raw_model = device_reg_data.model
AttributeError: 'NoneType' object has no attribute 'model'
2022-12-18 10:30:30.312 ERROR (MainThread) [icloud3] 'NoneType' object has no attribute 'model'
Traceback (most recent call last):
  File "/config/custom_components/icloud3/helpers/entity_io.py", line 137, in get_entity_registry_data
    raw_model = device_reg_data.model
AttributeError: 'NoneType' object has no attribute 'model'
2022-12-18 10:30:30.315 ERROR (MainThread) [icloud3] 'NoneType' object has no attribute 'model'
Traceback (most recent call last):
  File "/config/custom_components/icloud3/helpers/entity_io.py", line 137, in get_entity_registry_data
    raw_model = device_reg_data.model
AttributeError: 'NoneType' object has no attribute 'model'
2022-12-18 10:30:30.316 ERROR (MainThread) [icloud3] 'NoneType' object has no attribute 'model'
Traceback (most recent call last):
  File "/config/custom_components/icloud3/helpers/entity_io.py", line 137, in get_entity_registry_data
    raw_model = device_reg_data.model
AttributeError: 'NoneType' object has no attribute 'model'
2022-12-18 10:30:30.539 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/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 60, 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 81, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 241, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, 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 281, in async_configure
    result = await self._async_handle_step(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 368, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/icloud3/config_flow.py", line 556, in async_step_menu
    return await self.async_step_device_list()
  File "/config/custom_components/icloud3/config_flow.py", line 1512, in async_step_device_list
    self._build_device_form_selection_lists()
  File "/config/custom_components/icloud3/config_flow.py", line 1998, in _build_device_form_selection_lists
    self._build_opt_famshr_devices_list()
  File "/config/custom_components/icloud3/config_flow.py", line 2012, in _build_opt_famshr_devices_list
    devices_desc = start_ic3.get_famshr_devices(self.PyiCloud)
  File "/config/custom_components/icloud3/support/start_ic3.py", line 1315, in get_famshr_devices
    Gb.PyiCloud.FindMyFriends.refresh_client()
AttributeError: 'NoneType' object has no attribute 'refresh_client'
@poudenes
Copy link
Author

Removed integration. Restart HA and I see this error:

2022-12-18 11:02:55.137 ERROR (MainThread) [icloud3] 'NoneType' object has no attribute 'model'
Traceback (most recent call last):
  File "/config/custom_components/icloud3/helpers/entity_io.py", line 137, in get_entity_registry_data
    raw_model = device_reg_data.model
AttributeError: 'NoneType' object has no attribute 'model'

Then I add the integration again. Select where I want my devices (2 iPhones and 1 iCloud itself) then I see this error:

2022-12-18 11:02:55.517 ERROR (MainThread) [icloud3] Blocking calls must be done in the executor or a separate thread; Use `await hass.async_add_executor_job()`; at custom_components/icloud3/support/pyicloud_ic3.py, line 151: response = Session.request(self, method, url, **kwargs)
Traceback (most recent call last):
  File "/config/custom_components/icloud3/support/pyicloud_ic3.py", line 151, in request
    response = Session.request(self, method, url, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 398, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 239, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "/usr/local/lib/python3.10/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.10/http/client.py", line 1293, in _send_request
    self.putrequest(method, url, **skips)
  File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 219, in putrequest
    return _HTTPConnection.putrequest(self, method, url, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 180, in protected_loop_func
    check_loop(func, strict=strict)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 168, in check_loop
    raise RuntimeError(
RuntimeError: Blocking calls must be done in the executor or a separate thread; Use `await hass.async_add_executor_job()`; at custom_components/icloud3/support/pyicloud_ic3.py, line 151: response = Session.request(self, method, url, **kwargs)
2022-12-18 11:02:55.521 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/config/custom_components/icloud3/support/pyicloud_ic3.py", line 151, in request
    response = Session.request(self, method, url, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 398, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 239, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "/usr/local/lib/python3.10/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.10/http/client.py", line 1293, in _send_request
    self.putrequest(method, url, **skips)
  File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 219, in putrequest
    return _HTTPConnection.putrequest(self, method, url, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 180, in protected_loop_func
    check_loop(func, strict=strict)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 168, in check_loop
    raise RuntimeError(
RuntimeError: Blocking calls must be done in the executor or a separate thread; Use `await hass.async_add_executor_job()`; at custom_components/icloud3/support/pyicloud_ic3.py, line 151: response = Session.request(self, method, url, **kwargs)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/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 60, 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 81, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 241, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, 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 281, in async_configure
    result = await self._async_handle_step(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 368, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/icloud3/config_flow.py", line 556, in async_step_menu
    return await self.async_step_device_list()
  File "/config/custom_components/icloud3/config_flow.py", line 1512, in async_step_device_list
    self._build_device_form_selection_lists()
  File "/config/custom_components/icloud3/config_flow.py", line 1998, in _build_device_form_selection_lists
    self._build_opt_famshr_devices_list()
  File "/config/custom_components/icloud3/config_flow.py", line 2012, in _build_opt_famshr_devices_list
    devices_desc = start_ic3.get_famshr_devices(self.PyiCloud)
  File "/config/custom_components/icloud3/support/start_ic3.py", line 1315, in get_famshr_devices
    Gb.PyiCloud.FindMyFriends.refresh_client()
  File "/config/custom_components/icloud3/support/pyicloud_ic3.py", line 1161, in refresh_client
    response = self.Session.post(self._friend_endpoint, data=mock_payload, params=params)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 635, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
  File "/config/custom_components/icloud3/support/pyicloud_ic3.py", line 156, in request
    self._raise_error(-2, "Failed to establish a new connection")
  File "/config/custom_components/icloud3/support/pyicloud_ic3.py", line 272, in _raise_error
    raise api_error
custom_components.icloud3.support.pyicloud_ic3.PyiCloudAPIResponseException: Failed to establish a new connection (Status Code -2)

@gcobb321
Copy link
Owner

gcobb321 commented Dec 18, 2022

  1. The ‘model’ error (entity_io:137) can be ignored. It is just trying to get the device model from the HA registry and will default to ‘Unknown’ if not available.
  2. I thought I had fixed the ‘Blocking…’ error. If you get it again, restart HA and see if it continues. Was this generated when you were starting HA or when configuring the devices?

@gcobb321
Copy link
Owner

I have 2 updates that might fix these issues. Send me your email address and Ill send them in a few hours. Use [email protected]. If they work, I’ll update the beta files.

Thanks.

@poudenes
Copy link
Author

  • The ‘model’ error (entity_io:137) can be ignored. It is just trying to get the device model from the HA registry and will default to ‘Unknown’ if not available.
  • I thought I had fixed the ‘Blocking…’ error. If you get it again, restart HA and see if it continues. Was this generated when you were starting HA or when configuring the devices?

This error will seen lots of times in the log... its almost flood the log....

@gcobb321
Copy link
Owner

Beta 2 has been posted. You will find it here

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