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

Car is constantly disconnected after last update #219

Closed
dylan09 opened this issue Apr 4, 2024 · 4 comments
Closed

Car is constantly disconnected after last update #219

dylan09 opened this issue Apr 4, 2024 · 4 comments

Comments

@dylan09
Copy link

dylan09 commented Apr 4, 2024

The problem

After the last update my integration is very unstable. After a while the integration didn't update the car information anymore.
I manually had to reload the integration to get the entities updated.

After I did the reload 2 or 3 times the integration, the integration could not be reloaded. It says "successfully reloaded". But all entities are unavailable and the log file shows a lot of errors regarding unloading the entities.

What version of MBAPI2020 do use?

v0.12.0

What was the last working version of MBAPI2020?

No response

What type of installation are you running?

Home Assistant OS

Diagnostics information

config_entry-mbapi2020-084ed6f346d885ea6dab8ea97902f8b7.json

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-04-04 21:50:39.157 INFO (MainThread) [custom_components.mbapi2020.oauth] Start async_refresh_access_token() with refresh_token
2024-04-04 21:50:39.157 INFO (MainThread) [custom_components.mbapi2020.oauth] Auth token refresh preflight request 1
2024-04-04 21:50:40.577 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:50:40.705 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:50:44.732 INFO (MainThread) [custom_components.mbapi2020.coordinator] Car Load complete - start sensor creation
2024-04-04 21:50:44.735 INFO (MainThread) [homeassistant.components.sensor] Setting up mbapi2020.sensor
2024-04-04 21:50:44.752 INFO (MainThread) [homeassistant.components.lock] Setting up mbapi2020.lock
2024-04-04 21:50:44.756 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up mbapi2020.binary_sensor
2024-04-04 21:50:44.772 INFO (MainThread) [homeassistant.components.button] Setting up mbapi2020.button
2024-04-04 21:50:44.778 INFO (MainThread) [homeassistant.components.device_tracker] Setting up mbapi2020.device_tracker
2024-04-04 21:50:44.787 INFO (MainThread) [homeassistant.components.switch] Setting up mbapi2020.switch
2024-04-04 21:51:14.857 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 21:51:14.857 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:51:14.963 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:51:45.081 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 21:51:45.081 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:51:45.181 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:52:38.012 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 21:52:38.013 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:52:38.115 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:53:08.233 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 21:53:08.234 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:53:08.333 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:53:38.461 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 21:53:38.461 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:53:38.598 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:54:37.142 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 21:54:37.143 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:54:37.258 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:55:07.376 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 21:55:07.376 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:55:07.484 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:55:37.593 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 21:55:37.593 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:55:37.714 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:56:37.222 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 21:56:37.223 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:56:37.369 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:57:07.480 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 21:57:07.480 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:57:07.602 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:57:37.710 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 21:57:37.711 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:57:37.825 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:58:36.529 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 21:58:36.529 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:58:36.654 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:58:41.606 INFO (MainThread) [homeassistant.components.automation.gasverbrauch_zahlen] Gasverbrauch zählen: Running automation actions
2024-04-04 21:58:41.606 INFO (MainThread) [homeassistant.components.automation.gasverbrauch_zahlen] Gasverbrauch zählen: Executing step call service
2024-04-04 21:59:06.781 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 21:59:06.781 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:59:06.884 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:59:36.990 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 21:59:36.993 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 21:59:37.138 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 22:00:36.442 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 22:00:36.443 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 22:00:36.535 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 22:01:06.668 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 22:01:06.668 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 22:01:06.777 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 22:01:36.886 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 22:01:36.888 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 22:01:36.982 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 22:02:36.511 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 22:02:36.511 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 22:02:36.636 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 22:03:06.740 INFO (MainThread) [custom_components.mbapi2020.websocket] websocket connection is closing
2024-04-04 22:03:06.740 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws
2024-04-04 22:03:06.848 ERROR (MainThread) [custom_components.mbapi2020.websocket] Other error 429, message='Invalid response status', url=URL('wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws')
2024-04-04 22:03:06.849 ERROR (MainThread) [custom_components.mbapi2020.client] Error with the websocket connection:
2024-04-04 22:03:06.849 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/mbapi2020/websocket.py", line 169, in _start_websocket_handler
    await self._websocket_handler(session)
  File "/config/custom_components/mbapi2020/websocket.py", line 186, in _websocket_handler
    self._connection = await session.ws_connect(websocket_url, headers=headers, proxy=SYSTEM_PROXY)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 848, in _ws_connect
    raise WSServerHandshakeError(
aiohttp.client_exceptions.WSServerHandshakeError: 429, message='Invalid response status', url=URL('wss://websocket.emea-prod.mobilesdk.mercedes-benz.com/v2/ws')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/mbapi2020/client.py", line 221, in attempt_connect
    await self.websocket.async_connect(on_data)
  File "/config/custom_components/mbapi2020/websocket.py", line 114, in async_connect
    await asyncio.gather(queue_task, websocket_task)
  File "/config/custom_components/mbapi2020/websocket.py", line 178, in _start_websocket_handler
    raise WebsocketError from error
custom_components.mbapi2020.errors.WebsocketError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/mbapi2020/coordinator.py", line 68, in ws_connect
    await self.client.attempt_connect(self.on_dataload_complete)
  File "/config/custom_components/mbapi2020/client.py", line 224, in attempt_connect
    async_call_later(
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1550, in async_call_later
    else HassJob(action, f"call_later {delay}")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 305, in __init__
    self.job_type = job_type or _get_hassjob_callable_job_type(target)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 338, in _get_hassjob_callable_job_type
    raise ValueError("Coroutine not allowed to be passed to HassJob")
ValueError: Coroutine not allowed to be passed to HassJob
2024-04-04 22:03:06.864 WARNING (MainThread) [py.warnings] /usr/local/lib/python3.12/asyncio/base_events.py:1989: RuntimeWarning: coroutine 'Websocket.async_connect' was never awaited
  handle = None  # Needed to break cycles when an exception occurs.

Additional information

What I have found under System->Repair->System Information is that the integration says there are 2 connected cars.
I only have one car connected to my MercedesMe account?

@ReneNulschDE
Copy link
Owner

ReneNulschDE commented Apr 4, 2024

MB changed the infrastructure this morning. Please check this post (the other bug "Coroutine not allowed to be passed to HassJob" is fixed in this beta too)

@dylan09
Copy link
Author

dylan09 commented Apr 4, 2024 via email

@Thomas55555
Copy link
Contributor

The beta version works for me.

@dylan09
Copy link
Author

dylan09 commented Apr 7, 2024

Beta seems to have fixed the issue. Thanks a lot.

@dylan09 dylan09 closed this as completed Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants