bretterer / home-assistant-rivian

Rivian (Unofficial) Integration for Home Assistant
Apache License 2.0
125 stars 20 forks source link

Unable to load / install Rivian 1.0.0 integration on HA 2024.2.0b2 due to dependency conflicts #146

Closed linuxkidd closed 9 months ago

linuxkidd commented 10 months ago

Attempts to load an already existing Rivian config, or re-add the Rivian integration results in the following error in the Home Assistant logs:

2024-02-02 10:10:50.216 ERROR (SyncWorker_29) [homeassistant.util.package] Unable to install package rivian-python-client[ble]==1.1.1: ERROR: Cannot install rivian-python-client because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
2024-02-02 10:10:53.531 ERROR (SyncWorker_29) [homeassistant.util.package] Unable to install package rivian-python-client[ble]==1.1.1: ERROR: Cannot install rivian-python-client because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
2024-02-02 10:10:56.065 ERROR (SyncWorker_29) [homeassistant.util.package] Unable to install package rivian-python-client[ble]==1.1.1: ERROR: Cannot install rivian-python-client because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
2024-02-02 10:10:56.066 ERROR (MainThread) [aiohttp.server] 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 153, in post
    return await super().post(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 71, in post
    result = await self._flow_mgr.async_init(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 945, in async_init
    flow, result = await task
                   ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 963, in _async_init
    flow = await self.async_create_flow(handler, context=context, data=data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1074, in async_create_flow
    handler = await _async_get_flow_handler(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2266, in _async_get_flow_handler
    await _load_integration(hass, domain, hass_config)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2242, in _load_integration
    await async_process_deps_reqs(hass, hass_config, integration)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 467, in async_process_deps_reqs
    await requirements.async_get_integration_with_requirements(
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 52, in async_get_integration_with_requirements
    return await manager.async_get_integration_with_requirements(domain)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 175, in async_get_integration_with_requirements
    await self._async_process_integration(integration, done)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 190, in _async_process_integration
    await self.async_process_requirements(
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 255, in async_process_requirements
    await self._async_process_requirements(name, missing)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 293, in _async_process_requirements
    raise RequirementsNotFound(name, list(failures))
homeassistant.requirements.RequirementsNotFound: Requirements for rivian not found: ['rivian-python-client[ble]==1.1.1'].

I'm guessing this is due to the 2024.2 release moving to Python 3.12.

krazos commented 10 months ago

Same here; I hadn't gotten around to creating an issue.

It looks like a dependency conflict with the cryptography package.

rivian-python-client appears to require cryptography = "^41.0.1" whereas Core now requires cryptography==42.0.1 (will be cryptography==42.0.2 in the next version of the beta).

natekspencer commented 10 months ago

Thanks, we'll get this taken care of!

krazos commented 10 months ago

I'm sure you guys are already on it, but I thought I mention the issues I'm seeing after manually updating the rivian-python-client package to newly released v1.1.2.

The dependency conflicts appear to have been resolved, but the integration still fails to load, and I am seeing the following errors in the log:

Logger: homeassistant
Source: custom_components/rivian/coordinator.py:65
Integration: Rivian (Unofficial) (documentation, issues)
First occurred: 6:11:34 PM (3 occurrences)
Last logged: 6:11:59 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/rivian/ws_monitor.py", line 148, in _receiver
    self._subscriptions[_id][0](data)
  File "/config/custom_components/rivian/coordinator.py", line 281, in _process_new_data
    vehicle_info = self._build_vehicle_info_dict(pdata.get(self.key, {}))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/rivian/coordinator.py", line 303, in _build_vehicle_info_dict
    self.charging_coordinator.adjust_update_interval(
  File "/config/custom_components/rivian/coordinator.py", line 139, in adjust_update_interval
    self._set_update_interval(
  File "/config/custom_components/rivian/coordinator.py", line 65, in _set_update_interval
    refresh = self.update_interval and self.update_interval.seconds > seconds
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'seconds'
Logger: custom_components.rivian.coordinator
Source: helpers/update_coordinator.py:313
Integration: Rivian (Unofficial) (documentation, issues)
First occurred: 6:11:34 PM (3 occurrences)
Last logged: 6:11:59 PM

Unexpected error fetching rivian data: 'int' object has no attribute 'seconds'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 313, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/rivian/coordinator.py", line 259, in _async_update_data
    return self._build_vehicle_info_dict(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/rivian/coordinator.py", line 303, in _build_vehicle_info_dict
    self.charging_coordinator.adjust_update_interval(
  File "/config/custom_components/rivian/coordinator.py", line 139, in adjust_update_interval
    self._set_update_interval(
  File "/config/custom_components/rivian/coordinator.py", line 65, in _set_update_interval
    refresh = self.update_interval and self.update_interval.seconds > seconds
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'seconds'
natekspencer commented 10 months ago

@krazos I've got two PRs ready to address this. A recent change in HA introduced a private field that we were previously using in our own code, so had to change this

natekspencer commented 9 months ago

@linuxkidd / @krazos 1.0.1 has been released to resolve these issues

linuxkidd commented 9 months ago

Thanks @natekspencer ... I can confirm I was able to re-setup the Rivian integration with the 1.0.1 release! Closing the ticket. :)