robinostlund / homeassistant-volkswagencarnet

Volkswagen Carnet Component for home assistant
GNU General Public License v3.0
304 stars 60 forks source link

[BUG] 4.5.1-beta4 - Missing entities (Battery SoC formost) #553

Closed enoch85 closed 5 months ago

enoch85 commented 5 months ago

Before you post a new issue - you must first check the following (and check the boxes with an "X" below)

Related to https://github.com/robinostlund/volkswagencarnet/pull/239

Environment

Describe the bug

Been running fine since 4.5.0, and tried updating to 4.5.1-beta2 without any issues as well. In the middle of everything my subscription was canceled (renewed now together with VW customer service) - so I deleted the car from the mobile app, deleted the app, removed the integration from HAOS, and reinstalled everything from scratch.

Steps to Reproduce

Not sure. It worked, and now it doesn't work anymore, even when reverting to 4.5.0. The logs below are from 4.5.1-beta4 though.

Expected behavior

Around 11 entities are missing, battery SoC being the most crucial.

Screenshots

See here: https://github.com/robinostlund/homeassistant-volkswagencarnet/pull/552#issuecomment-1904435533

Traceback/Error logs

 Logger: homeassistant.helpers.service
Source: helpers/service.py:246
First occurred: 09:29:56 (2 occurrences)
Last logged: 09:59:07
Referenced entities switch.ev_smart_charging_volkswagen_ev_connected are missing or not currently available

 Logger: volkswagencarnet.vw_connection
Source: runner.py:188
First occurred: January 22, 2024 at 19:09:15 (180 occurrences)
Last logged: 09:29:23

    Could not fetch vehicle data, error: Cannot connect to host emea.bff.cariad.digital:443 ssl:default [Try again]
    Could not fetch parkingposition, error: Cannot connect to host emea.bff.cariad.digital:443 ssl:default [Try again]
    Could not fetch last trip data, error: Cannot connect to host emea.bff.cariad.digital:443 ssl:default [Try again]
    Could not fetch last trip data, server response: {'status_code': 204}
    Could not fetch parkingposition, HTTP status code: 502

Logger: homeassistant
Source: custom_components/volkswagencarnet/__init__.py:271
Integration: Volkswagen We Connect ([documentation](https://github.com/robinostlund/homeassistant-volkswagencarnet), [issues](https://github.com/robinostlund/homeassistant-volkswagencarnet/issues))
First occurred: 07:57:59 (1 occurrences)
Last logged: 07:57:59
Error doing job: Task exception was never retrieved

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 243, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 399, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 182, in async_update_listeners
    update_callback()
  File "/config/custom_components/volkswagencarnet/__init__.py", line 318, in async_write_ha_state
    backend_refresh_time = self.instrument.last_refresh
                           ^^^^^^^^^^^^^^^
  File "/config/custom_components/volkswagencarnet/__init__.py", line 381, in instrument
    return self.data.instrument(self.vin, self.component, self.attribute)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/volkswagencarnet/__init__.py", line 271, in instrument
    raise ValueError(f"Instrument not found; component: {component}, attribute: {attr}")
ValueError: Instrument not found; component: sensor, attribute: climatisation_target_temperature

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:368
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: January 22, 2024 at 19:09:20 (3 occurrences)
Last logged: 07:17:22
Error while setting up volkswagencarnet platform for sensor

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 672, in _async_add_entity
    original_icon=entity.icon,
                  ^^^^^^^^^^^
  File "/config/custom_components/volkswagencarnet/__init__.py", line 387, in icon
    return icon_for_battery_level(battery_level=self.instrument.state, charging=self.vehicle.charging)
                                                                                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_vehicle.py", line 749, in charging
    cstate = find_path(self.attrs, f"{Services.CHARGING}.chargingStatus.value.chargingState")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_utilities.py", line 97, in find_path
    return find_path(src[path[0]], path[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_utilities.py", line 97, in find_path
    return find_path(src[path[0]], path[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_utilities.py", line 97, in find_path
    return find_path(src[path[0]], path[1:])
                     ~~~^^^^^^^^^
KeyError: 'value'

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:507
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: January 22, 2024 at 19:09:20 (3 occurrences)
Last logged: 07:17:22
Error adding entities for domain sensor with platform volkswagencarnet

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 672, in _async_add_entity
    original_icon=entity.icon,
                  ^^^^^^^^^^^
  File "/config/custom_components/volkswagencarnet/__init__.py", line 387, in icon
    return icon_for_battery_level(battery_level=self.instrument.state, charging=self.vehicle.charging)
                                                                                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_vehicle.py", line 749, in charging
    cstate = find_path(self.attrs, f"{Services.CHARGING}.chargingStatus.value.chargingState")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_utilities.py", line 97, in find_path
    return find_path(src[path[0]], path[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_utilities.py", line 97, in find_path
    return find_path(src[path[0]], path[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_utilities.py", line 97, in find_path
    return find_path(src[path[0]], path[1:])
                     ~~~^^^^^^^^^
KeyError: 'value'

Debug information - all JSON responses from logfile

2024-01-22 19:09:15.499 WARNING (MainThread) [volkswagencarnet.vw_connection] Could not fetch last trip data, server response: {'status_code': 204}
2024-01-22 19:09:16.005 WARNING (MainThread) [volkswagencarnet.vw_connection] Could not fetch last trip data, server response: {'status_code': 204}
2024-01-22 19:09:20.454 DEBUG (MainThread) [custom_components.volkswagencarnet] Updating data from volkswagen WeConnect
2024-01-22 19:09:20.454 DEBUG (MainThread) [custom_components.volkswagencarnet] Finished fetching volkswagencarnet data in 4.955 seconds (success: True)
2024-01-22 19:09:20.455 DEBUG (MainThread) [custom_components.volkswagencarnet] Async update finished for WVWXXXXXXXXXXX (volkswagencarnet). Next update in 0:05:00.
2024-01-22 19:09:20.465 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of request_results
2024-01-22 19:09:20.465 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of last_data_refresh
2024-01-22 19:09:20.466 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of api_parkingposition_status
2024-01-22 19:09:20.466 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of service_inspection
2024-01-22 19:09:20.467 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of api_vehicles_status
2024-01-22 19:09:20.467 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of charge_max_ampere
2024-01-22 19:09:20.468 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of api_selectivestatus_status
2024-01-22 19:09:20.468 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of distance
2024-01-22 19:09:20.469 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of electric_range
2024-01-22 19:09:20.469 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of last_connected
2024-01-22 19:09:20.469 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of api_trips_status
2024-01-22 19:09:20.470 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of requests_remaining
2024-01-22 19:09:20.470 DEBUG (MainThread) [custom_components.volkswagencarnet] Restoring requests remaining to '-1'
2024-01-22 19:09:20.470 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of requests_remaining
2024-01-22 19:09:20.471 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of climatisation_target_temperature
2024-01-22 19:09:20.471 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of service_inspection_distance
2024-01-22 19:09:20.472 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of api_capabilities_status
2024-01-22 19:09:20.472 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of parking_time
2024-01-22 19:09:20.473 DEBUG (MainThread) [custom_components.volkswagencarnet.sensor] Getting state of api_token_status
2024-01-22 19:09:20.473 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform volkswagencarnet
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 672, in _async_add_entity
    original_icon=entity.icon,
                  ^^^^^^^^^^^
  File "/config/custom_components/volkswagencarnet/__init__.py", line 387, in icon
    return icon_for_battery_level(battery_level=self.instrument.state, charging=self.vehicle.charging)
                                                                                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_vehicle.py", line 749, in charging
    cstate = find_path(self.attrs, f"{Services.CHARGING}.chargingStatus.value.chargingState")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_utilities.py", line 97, in find_path
    return find_path(src[path[0]], path[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_utilities.py", line 97, in find_path
    return find_path(src[path[0]], path[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_utilities.py", line 97, in find_path
    return find_path(src[path[0]], path[1:])
                     ~~~^^^^^^^^^
KeyError: 'value'
2024-01-22 19:09:20.481 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up volkswagencarnet platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 672, in _async_add_entity
    original_icon=entity.icon,
                  ^^^^^^^^^^^
  File "/config/custom_components/volkswagencarnet/__init__.py", line 387, in icon
    return icon_for_battery_level(battery_level=self.instrument.state, charging=self.vehicle.charging)
                                                                                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_vehicle.py", line 749, in charging
    cstate = find_path(self.attrs, f"{Services.CHARGING}.chargingStatus.value.chargingState")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_utilities.py", line 97, in find_path
    return find_path(src[path[0]], path[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_utilities.py", line 97, in find_path
    return find_path(src[path[0]], path[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/volkswagencarnet/vw_utilities.py", line 97, in find_path
    return find_path(src[path[0]], path[1:])
                     ~~~^^^^^^^^^
KeyError: 'value'
2024-01-22 19:09:20.485 DEBUG (MainThread) [custom_components.volkswagencarnet.binary_sensor] Getting state of hood_closed
2024-01-22 19:09:20.485 DEBUG (MainThread) [custom_components.volkswagencarnet.binary_sensor] Getting state of parking_light
2024-01-22 19:09:20.486 DEBUG (MainThread) [custom_components.volkswagencarnet.binary_sensor] Getting state of trunk_closed
2024-01-22 19:09:20.486 DEBUG (MainThread) [custom_components.volkswagencarnet.binary_sensor] Getting state of request_in_progress
2024-01-22 19:09:20.487 DEBUG (MainThread) [custom_components.volkswagencarnet.binary_sensor] Getting state of door_locked_sensor
2024-01-22 19:09:20.487 DEBUG (MainThread) [custom_components.volkswagencarnet.binary_sensor] Getting state of door_closed_left_front
2024-01-22 19:09:20.487 DEBUG (MainThread) [custom_components.volkswagencarnet.binary_sensor] Getting state of door_closed_right_back
2024-01-22 19:09:20.488 DEBUG (MainThread) [custom_components.volkswagencarnet.binary_sensor] Getting state of trunk_locked_sensor
2024-01-22 19:09:20.488 DEBUG (MainThread) [custom_components.volkswagencarnet.binary_sensor] Getting state of vehicle_moving
2024-01-22 19:09:20.489 DEBUG (MainThread) [custom_components.volkswagencarnet.binary_sensor] Getting state of door_closed_right_front
2024-01-22 19:09:20.489 DEBUG (MainThread) [custom_components.volkswagencarnet.binary_sensor] Getting state of door_closed_left_back
2024-01-22 19:09:20.490 DEBUG (MainThread) [custom_components.volkswagencarnet.switch] Getting state of electric_climatisation
2024-01-22 19:09:20.490 DEBUG (MainThread) [custom_components.volkswagencarnet.switch] Getting state of window_heater
2024-01-22 19:09:20.490 DEBUG (MainThread) [custom_components.volkswagencarnet.switch] Getting state of auxiliary_climatisation
2024-01-22 19:09:20.490 DEBUG (MainThread) [custom_components.volkswagencarnet.switch] Getting state of climatisation_without_external_power
2024-01-22 19:09:20.491 DEBUG (MainThread) [custom_components.volkswagencarnet.switch] Getting state of refresh_data

Additional context

enoch85 commented 5 months ago

Maybe it's due to that wrong servers are used?

image

enoch85 commented 5 months ago

cc @stickpin @oliverrahner

enoch85 commented 5 months ago

Hmm, just because I posted this it now started to work again... Probably some lag in the e-sim update.

Keeping open just for the logs, feel free to close.

stickpin commented 5 months ago

Hi @enoch85,

It's becoming "funny". :) I told you at least 2 times in different threads, that there's something specific to your account/vehicle and proposed the help. However because this issue is specific to your account, none of us will be able to help you without having actual access to your account. We cannot help you based on the logs that you sharing, we need API responses.

Best Regards! FYI @oliverrahner

enoch85 commented 5 months ago

Sorry @stickpin. I was too stressed about this. 🙈