ReneNulschDE / mbapi2020

Custom Component to integrate MercedesME devices into Home-Assistant
Other
169 stars 32 forks source link

ClientError http 418, message="I'm a teapot" #159

Closed geertmeersman closed 10 months ago

geertmeersman commented 10 months ago

Hi Rene,

I can't seem to log in anymore and am receiving a http 418 error. The mobile app still seems to work fine.

2023-12-14 10:04:04.868 INFO (MainThread) [custom_components.mbapi2020.oauth] Start request PIN xxxxxxxx@xxxxxx.com
2023-12-14 10:04:04.998 ERROR (MainThread) [custom_components.mbapi2020.oauth] ClientError requesting data from https://bff.emea-prod.mobilesdk.mercedes-benz.com/v1/login: 418, message="I'm a teapot", url=URL('https://bff.emea-prod.mobilesdk.mercedes-benz.com/v1/login')
2023-12-14 10:04:04.998 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/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 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, 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/auth.py", line 233, 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 63, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 177, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 293, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 389, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mbapi2020/config_flow.py", line 70, in async_step_user
    await client.oauth.request_pin(user_input[CONF_USERNAME], nonce)
  File "/config/custom_components/mbapi2020/oauth.py", line 65, in request_pin
    return await self._async_request("post", url, data=data, headers=headers)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mbapi2020/oauth.py", line 225, in _async_request
    raise err
  File "/config/custom_components/mbapi2020/oauth.py", line 221, in _async_request
    resp.raise_for_status()
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1059, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 418, message="I'm a teapot", url=URL('https://bff.emea-prod.mobilesdk.mercedes-benz.com/v1/login')
harlonjo commented 10 months ago

Mine is not working too

steuerlexi commented 10 months ago

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht Mine as well

Logger: custom_components.mbapi2020 Source: custom_components/mbapi2020/init.py:311 Integration: MercedesME 2020 (documentation, issues) First occurred: 10:18:46 (10 occurrences) Last logged: 10:26:46

Can't connect to MB APIs; Retrying in background

ReneNulschDE commented 10 months ago

Hi, I see this too. Looks like MB changed something in their backends. Let me check.

ReneNulschDE commented 10 months ago

Master branch code should work again for Europe. Make sure you open the mobile app and agree to the new data protection rules.

I'll try to test the other regions and publish a new version soon.

SuperMasterPhoenix commented 10 months ago

Works again for EU using master branch. Thank you for this quick fix!

ReneNulschDE commented 10 months ago

Non EU endpoints are fixed too.

kilian-f-za commented 10 months ago

Hello, where can I confirm the new data protection rules? I also have no connection and then I deleted the integration and added it again. Now when I enter the email address it says "Unknown Error occured" and in the logs it says "I'm a teapot".

steuerlexi commented 10 months ago

Hello, where can I confirm the new data protection rules? I also have no connection and then I deleted the integration and added it again. Now when I enter the email address it says "Unknown Error occured" and in the logs it says "I'm a teapot".

i did exactly the same and have now the "Unknown Error occured". I confirmed the new data protection rules in the Mercedes ME APP on my android. But it fixed nothing.

ReneNulschDE commented 10 months ago

Please read my comments. You have to update the code based on the latest master branch or wait for the release. I'm just typing the release notes...

kilian-f-za commented 10 months ago

Thank you. New version is there and works. Thanks for the quick support.

ReneNulschDE commented 10 months ago

Solved with v0.9.8