skodaconnect / homeassistant-skodaconnect

Skoda Connect - A home assistant plugin to add integration with your car
Apache License 2.0
233 stars 27 forks source link

Preheater service fails #206

Closed NickSutton closed 11 months ago

NickSutton commented 1 year ago

I get this error when trying to set the pre-heater timer for the Enyaq IV:


This error originated from a custom integration.

Logger: homeassistant.helpers.script.websocket_api_script
Source: custom_components/skodaconnect/__init__.py:282 
Integration: Skoda Connect (documentation, issues) 
First occurred: 14:10:52 (1 occurrences) 
Last logged: 14:10:52

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: Could not find associated coordinator for given vehicle
Traceback (most recent call last):
  File "/config/custom_components/skodaconnect/__init__.py", line 280, in get_car
    dev_coordinator = hass.data[DOMAIN][conf_entry]['data'].coordinator
                      ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: '1379863f3a9e6a1bb696ebbbf92c5e70'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 703, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 665, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/skodaconnect/__init__.py", line 412, in set_pheater_duration
    car = await get_car(service_call)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/skodaconnect/__init__.py", line 282, in get_car
    raise SkodaConfigException('Could not find associated coordinator for given vehicle')
skodaconnect.exceptions.SkodaConfigException: Could not find associated coordinator for given vehicle
dvx76 commented 1 year ago

Do you have other errors similar to this one for skodaconnect entities? It looks like somehow you've got orphaned entities (maybe from a previous installation of the integration?). Not sure how it gets into this state.

In your homeassitant config directory you'll have a .storage/core.entity_registry where you'll find all entities from the integration (search for Skoda). At least some will have "config_entry_id": "1379863f3a9e6a1bb696ebbbf92c5e70".

That config_entry_id is being looked up in .storage/core.config_entries and not found (that's the KeyError). Presumably in that file you do have a section (with a different entry_id) with the config of the integration. Look for "domain": "skodaconnect".

NickSutton commented 1 year ago

Hi, no .storage folder in my config directory :-(

srkoster commented 1 year ago

Faced the same issue.

I've looked into my config/.storage/core.entity_reigstry (using the Advanced SSH & Web Terminal add-on as the directory wasn't visible using the Studio Code Server add-on) and have found the key. It was a helper entity, based on one of the Skoda Connect entities. I've removed it for now and the error disappeared.

github-actions[bot] commented 11 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.