robinostlund / homeassistant-volkswagencarnet

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

[BUG] API errors #621

Closed eeli12 closed 1 month ago

eeli12 commented 1 month ago

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

Environment

Describe the bug

APIs stays up only about 10 mins then goes to error for 50 mins. When error occures and trying to turn on eg. window heater it displays this error: ''Failed to call service switch/turn_on. Unknown error during setWindowHeater''. Also, if I need restart homeassistant Weconnect goes unavailable and need to reinstall it from HACS and reboot to get it configured again. Otherwise it wont let me configure and displays "Could not login to Volkswagen We Connect, please check your credentials and verify that the service is working" ## Steps to Reproduce

Expected behavior

Screenshots

image image

Traceback/Error logs

```Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/commands.py:239 integration: Home Assistant WebSocket API (documentation, issues) First occurred: 15:49:40 (1 occurrences) Last logged: 15:49:40 [547194170432] Unknown error during setWindowHeater Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_connection.py", line 766, in setWindowHeater response_raw = await self.post( ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_connection.py", line 492, in post return await self._request(METH_POST, url, return_raw=return_raw, **data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_connection.py", line 459, in _request raise error from None File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_connection.py", line 403, in _request async with self._session.request( File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1197, in __aenter__ self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 581, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 544, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 944, in _create_connection _, proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1209, in _create_direct_connection raise ClientConnectorError(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host emea.bff.cariad.digital:443 ssl:default [Name has no usable address] The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 971, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1043, in _handle_entity_call result = await task ^^^^^^^^^^ File "/config/custom_components/volkswagencarnet/switch.py", line 70, in async_turn_on await self.instrument.turn_on() File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_dashboard.py", line 865, in turn_on await self.vehicle.set_window_heating("start") File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_vehicle.py", line 419, in set_window_heating response = await self._connection.setWindowHeater(self.vin, (action == "start")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/volkswagencarnet/vw_connection.py", line 771, in setWindowHeater raise Exception("Unknown error during setWindowHeater") from e Exception: Unknown error during setWindowHeatertxt ``` ## Debug information - all JSON responses from logfile

Additional context

Note

Issues lacking sufficient details or context may be subject to closure without prior notice. Detailed bug reports are essential for effective issue resolution. Thank you for your cooperation.

stickpin commented 1 month ago

@eeli12 according to logs, your home assistant instance is not able to connect to Volkswagen.

see this line: Cannot connect to host emea.bff.cariad.digital:443 ssl:default [Name has no usable address]

Seems to be an issue in your setup/network, I cannot do much on my end.

eeli12 commented 1 month ago

@stickpin Ah, thats what I was afraid of because couldnt find any other topic about this problem. Need to try to solve this on my end. Thank you!

enoch85 commented 1 month ago

@eeli12 Did you manage to solve it?

eeli12 commented 1 month ago

@enoch85 No. Tried everything. Reinstalled integration multiple times, changed DNS settings on router, locked out and in on VW app, VW de and multiple other VW sites. Accepted terms and conditions if one appeared. Also contacted VW customer support and they did not wan't to do anything. I still get this error message for 45-50 minutes in hour: "Cannot connect to host emea.bff.cariad.digital:443 ssl:default [None]" Dont know what I could try anymore. Maybe reinstall HACS.

Any tips? :D

enoch85 commented 1 month ago

I was asking because I'm seeing the same behavior lately. Not only this app, but others as well. My best guess is that HAOS changed in some way, and that the apps don't keep up. But I'm no expert. :/

I'm on 5.0.0-b1 btw.

eeli12 commented 1 month ago

@enoch85 Okay, im on 5.0.0-b1 also. Is it same with you? about 10mins up and 50mins down? Its strange that there is that pattern so its kind of working but not really.

enoch85 commented 1 month ago

@enoch85 Okay, im on 5.0.0-b1 also. Is it same with you? about 10mins up and 50mins down? Its strange that there is that pattern so its kind of working but not really.

I haven't had the time to investigate, but since it happens to more apps than just this (I also have a Tesla) I'm not sure it's this apps fault... Maybe you could try to downgrade to 4.6.3 and post the results here?

eeli12 commented 1 month ago

@enoch85 Downgraded but didn't help.

enoch85 commented 1 month ago

@eeli12 Thanks for trying!

stickpin commented 1 month ago

A little googling will lead you to this thread: https://community.home-assistant.io/t/suddenly-hass-cannot-connect-to-internet-ressources-dns-issue/239313/9

It's not an integration issue. Something wrong with the DNS on the HA level. Try to run this for Cloudflare DNS servers:

ha dns options --servers dns://1.1.1.1
ha dns restart

or if you trust Google 🤪:

ha dns options --servers dns://8.8.8.8
ha dns restart
enoch85 commented 1 month ago

Thanks, will try!

eeli12 commented 1 month ago

@stickpin Thank you!! So far it is working. I dont even know how many hours i have trying to get this to work and the solution was that simple and easy. Was going to factory reset my router.....

enoch85 commented 1 month ago

Hmm, my issue is something else. image