home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.07k stars 29.73k forks source link

BMW ConnectedDrive - MyBMW API error: HTTPStatusError: invalid_request #92550

Closed NielsDigitalLink closed 1 year ago

NielsDigitalLink commented 1 year ago

The problem

BMW ConnectedDrive does not seem to be able to connect anymore. In the logs I see the following error: "MyBMW API error: HTTPStatusError: invalid_request" and after that I see an error "Unexpected error fetching bmw_connected_drive-xxxxxxxxxxxxx@gmail.com data: 'targetPressure'". The official app (v3.1.1) still works. I already completely uninstalled and re-installed the component, but that didn't help.

I see there is a newer version of bimmer_connected with some changes for the API. Will this solve the issue? Can the version in HA core be bumped to the newest version of bimmer_connected?

What version of Home Assistant Core has the issue?

2023.5.0

What was the last working version of Home Assistant Core?

2023.4.6

What type of installation are you running?

Home Assistant OS

Integration causing the issue

BMW Connected Drive

Link to integration documentation on our website

https://www.home-assistant.io/integrations/bmw_connected_drive/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

**First error**
Logger: bimmer_connected.api.authentication
Source: components/bmw_connected_drive/coordinator.py:58
First occurred: 22:01:30 (5 occurrences)
Last logged: 22:05:00

MyBMW API error: HTTPStatusError: invalid_request - The request is missing a required parameter, includes an unsupported parameter value (other than grant type), repeats a parameter, includes multiple credentials, utilizes more than one mechanism for authenticating the client, or is otherwise malformed

**Second error**
Logger: homeassistant.components.bmw_connected_drive.coordinator
Source: components/bmw_connected_drive/coordinator.py:58
Integration: BMW Connected Drive (documentation, issues)
First occurred: 22:01:38 (5 occurrences)
Last logged: 22:05:03

Unexpected error fetching bmw_connected_drive-xxxxxxxxxxxx@gmail.com data: 'targetPressure'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/coordinator.py", line 58, in _async_update_data
    await self.account.get_vehicles()
  File "/usr/local/lib/python3.10/site-packages/bimmer_connected/account.py", line 132, in get_vehicles
    self.add_vehicle(vehicle.data, vehicle_state, charging_settings, fetched_at)
  File "/usr/local/lib/python3.10/site-packages/bimmer_connected/account.py", line 147, in add_vehicle
    existing_vehicle.update_state(vehicle_base, vehicle_state, charging_settings, fetched_at)
  File "/usr/local/lib/python3.10/site-packages/bimmer_connected/vehicle/vehicle.py", line 119, in update_state
    setattr(self, vehicle_attribute, cls.from_vehicle_data(vehicle_data))
  File "/usr/local/lib/python3.10/site-packages/bimmer_connected/models.py", line 37, in from_vehicle_data
    parsed = cls._parse_vehicle_data(vehicle_data) or {}
  File "/usr/local/lib/python3.10/site-packages/bimmer_connected/vehicle/tires.py", line 53, in _parse_vehicle_data
    retval["front_left"] = TireState(**vehicle_data[ATTR_STATE]["tireState"]["frontLeft"])
  File "/usr/local/lib/python3.10/site-packages/bimmer_connected/vehicle/tires.py", line 16, in __init__
    self.target_pressure: int = status["targetPressure"]
KeyError: 'targetPressure'

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @gerard33, @rikroe, mind taking a look at this issue as it has been labeled with an integration (bmw_connected_drive) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `bmw_connected_drive` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign bmw_connected_drive` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


bmw_connected_drive documentation bmw_connected_drive source (message by IssueLinks)

rikroe commented 1 year ago

Please provide a full diagnostic entry for the integration (settings > devices and services > 3 dot menu for bmw).

It seems that not all information we were expecting is available on your car. With the diagnostic information we should be able to fix that quickly.

peterossege commented 1 year ago

I have the same issue. The logfile contains infos about tire presure. It seems to be new. My logs:


2023-05-05 07:35:43.025 DEBUG (MainThread) [bimmer_connected.account] Getting vehicle list 2023-05-05 07:35:43.025 DEBUG (MainThread) [bimmer_connected.account] Getting vehicle list 2023-05-05 07:35:43.241 DEBUG (MainThread) [bimmer_connected.api.authentication] Authenticating with refresh token for North America & Rest of World. 2023-05-05 07:35:43.828 ERROR (MainThread) [bimmer_connected.api.authentication] MyBMW API error: HTTPStatusError: invalid_request - The request is missing a required parameter, includes an unsupported parameter value (other than grant type), repeats a parameter, includes multiple credentials, utilizes more than one mechanism for authenticating the client, or is otherwise malformed 2023-05-05 07:35:43.833 DEBUG (MainThread) [bimmer_connected.api.authentication] Unable to get access token using refresh token, falling back to username/password. 2023-05-05 07:35:43.927 DEBUG (MainThread) [bimmer_connected.api.authentication] Authenticating with MyBMW flow for North America & Rest of World. 2023-05-05 07:35:46.364 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Unexpected error fetching bmw_connected_drive-my.mail@adress.com data: 'targetPressure' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/coordinator.py", line 58, in _async_update_data await self.account.get_vehicles() File "/usr/local/lib/python3.10/site-packages/bimmer_connected/account.py", line 132, in get_vehicles self.add_vehicle(vehicle.data, vehicle_state, charging_settings, fetched_at) File "/usr/local/lib/python3.10/site-packages/bimmer_connected/account.py", line 147, in add_vehicle existing_vehicle.update_state(vehicle_base, vehicle_state, charging_settings, fetched_at) File "/usr/local/lib/python3.10/site-packages/bimmer_connected/vehicle/vehicle.py", line 119, in update_state setattr(self, vehicle_attribute, cls.from_vehicle_data(vehicle_data)) File "/usr/local/lib/python3.10/site-packages/bimmer_connected/models.py", line 37, in from_vehicle_data parsed = cls._parse_vehicle_data(vehicle_data) or {} File "/usr/local/lib/python3.10/site-packages/bimmer_connected/vehicle/tires.py", line 53, in _parse_vehicle_data retval["front_left"] = TireState(vehicle_data[ATTR_STATE]["tireState"]["frontLeft"]) File "/usr/local/lib/python3.10/site-packages/bimmer_connected/vehicle/tires.py", line 16, in init self.target_pressure: int = status["targetPressure"] KeyError: 'targetPressure' 2023-05-05 07:35:46.368 DEBUG (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Finished fetching bmw_connected_drive-my.mail@adress.com data in 3.344 seconds (success: False) 2023-05-05 07:36:06.609 DEBUG (MainThread) [bimmer_connected.account] Getting vehicle list 2023-05-05 07:36:06.610 DEBUG (MainThread) [bimmer_connected.account] Getting vehicle list 2023-05-05 07:36:06.802 DEBUG (MainThread) [bimmer_connected.api.authentication] Authenticating with refresh token for North America & Rest of World. 2023-05-05 07:36:07.175 ERROR (MainThread) [bimmer_connected.api.authentication] MyBMW API error: HTTPStatusError: invalid_request - The request is missing a required parameter, includes an unsupported parameter value (other than grant type), repeats a parameter, includes multiple credentials, utilizes more than one mechanism for authenticating the client, or is otherwise malformed 2023-05-05 07:36:07.181 DEBUG (MainThread) [bimmer_connected.api.authentication] Unable to get access token using refresh token, falling back to username/password. 2023-05-05 07:36:07.275 DEBUG (MainThread) [bimmer_connected.api.authentication] Authenticating with MyBMW flow for North America & Rest of World. 2023-05-05 07:36:09.988 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Unexpected error fetching bmw_connected_drive-my.mail@adress.com data: 'targetPressure' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/coordinator.py", line 58, in _async_update_data await self.account.get_vehicles() File "/usr/local/lib/python3.10/site-packages/bimmer_connected/account.py", line 132, in get_vehicles self.add_vehicle(vehicle.data, vehicle_state, charging_settings, fetched_at) File "/usr/local/lib/python3.10/site-packages/bimmer_connected/account.py", line 147, in add_vehicle existing_vehicle.update_state(vehicle_base, vehicle_state, charging_settings, fetched_at) File "/usr/local/lib/python3.10/site-packages/bimmer_connected/vehicle/vehicle.py", line 119, in update_state setattr(self, vehicle_attribute, cls.from_vehicle_data(vehicle_data)) File "/usr/local/lib/python3.10/site-packages/bimmer_connected/models.py", line 37, in from_vehicle_data parsed = cls._parse_vehicle_data(vehicle_data) or {} File "/usr/local/lib/python3.10/site-packages/bimmer_connected/vehicle/tires.py", line 53, in _parse_vehicle_data retval["front_left"] = TireState(vehicle_data[ATTR_STATE]["tireState"]["frontLeft"]) File "/usr/local/lib/python3.10/site-packages/bimmer_connected/vehicle/tires.py", line 16, in init self.target_pressure: int = status["targetPressure"] KeyError: 'targetPressure' 2023-05-05 07:36:09.992 DEBUG (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Finished fetching bmw_connected_drive-my.mail@adress.com data in 3.383 seconds (success: False) 2023-05-05 07:36:50.327 DEBUG (MainThread) [bimmer_connected.account] Getting vehicle list 2023-05-05 07:36:50.328 DEBUG (MainThread) [bimmer_connected.account] Getting vehicle list 2023-05-05 07:36:50.518 DEBUG (MainThread) [bimmer_connected.api.authentication] Authenticating with refresh token for North America & Rest of World. 2023-05-05 07:36:51.021 ERROR (MainThread) [bimmer_connected.api.authentication] MyBMW API error: HTTPStatusError: invalid_request - The request is missing a required parameter, includes an unsupported parameter value (other than grant type), repeats a parameter, includes multiple credentials, utilizes more than one mechanism for authenticating the client, or is otherwise malformed 2023-05-05 07:36:51.034 DEBUG (MainThread) [bimmer_connected.api.authentication] Unable to get access token using refresh token, falling back to username/password. 2023-05-05 07:36:51.132 DEBUG (MainThread) [bimmer_connected.api.authentication] Authenticating with MyBMW flow for North America & Rest of World. 2023-05-05 07:36:56.593 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Unexpected error fetching bmw_connected_drive-my.mail@adress.com data: 'targetPressure' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/coordinator.py", line 58, in _async_update_data await self.account.get_vehicles() File "/usr/local/lib/python3.10/site-packages/bimmer_connected/account.py", line 132, in get_vehicles self.add_vehicle(vehicle.data, vehicle_state, charging_settings, fetched_at) File "/usr/local/lib/python3.10/site-packages/bimmer_connected/account.py", line 147, in add_vehicle existing_vehicle.update_state(vehicle_base, vehicle_state, charging_settings, fetched_at) File "/usr/local/lib/python3.10/site-packages/bimmer_connected/vehicle/vehicle.py", line 119, in update_state setattr(self, vehicle_attribute, cls.from_vehicle_data(vehicle_data)) File "/usr/local/lib/python3.10/site-packages/bimmer_connected/models.py", line 37, in from_vehicle_data parsed = cls._parse_vehicle_data(vehicle_data) or {} File "/usr/local/lib/python3.10/site-packages/bimmer_connected/vehicle/tires.py", line 53, in _parse_vehicle_data retval["front_left"] = TireState(**vehicle_data[ATTR_STATE]["tireState"]["frontLeft"]) File "/usr/local/lib/python3.10/site-packages/bimmer_connected/vehicle/tires.py", line 16, in init self.target_pressure: int = status["targetPressure"] KeyError: 'targetPressure' 2023-05-05 07:36:56.598 DEBUG (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Finished fetching bmw_connected_drive-my.mail@adress.com data in 6.271 seconds (success: False)

peterossege commented 1 year ago

image

sebadv commented 1 year ago

Same here

slashback100 commented 1 year ago

Same problem, with 2023.5.1

NielsDigitalLink commented 1 year ago

I have the same logging as @peterossege.

I also have the fingerprint, maybe this can help debugging.

DEBUG:asyncio:Using selector: EpollSelector
DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:httpx:load_ssl_context verify=True cert=None trust_env=True http2=False
DEBUG:httpx:load_verify_locations cafile='/etc/ssl/certs/ca-certificates.crt'
DEBUG:httpx:load_ssl_context verify=True cert=None trust_env=True http2=False
DEBUG:httpx:load_verify_locations cafile='/etc/ssl/certs/ca-certificates.crt'
DEBUG:bimmer_connected.api.authentication:Authenticating with MyBMW flow for North America & Rest of World.
DEBUG:httpcore:connection.connect_tcp.started host='cocoapi.bmwgroup.com' port=443 local_address=None timeout=30.0
DEBUG:httpcore:connection.connect_tcp.complete return_value=<httpcore.backends.asyncio.AsyncIOStream object at 0x7f1f8ab2de70>
DEBUG:httpcore:connection.start_tls.started ssl_context=<ssl.SSLContext object at 0x7f1f8abfff40> server_hostname='cocoapi.bmwgroup.com' timeout=30.0
DEBUG:httpcore:connection.start_tls.complete return_value=<httpcore.backends.asyncio.AsyncIOStream object at 0x7f1f8ac584f0>
DEBUG:httpcore:http11.send_request_headers.started request=<Request [b'GET']>
DEBUG:httpcore:http11.send_request_headers.complete
DEBUG:httpcore:http11.send_request_body.started request=<Request [b'GET']>
DEBUG:httpcore:http11.send_request_body.complete
DEBUG:httpcore:http11.receive_response_headers.started request=<Request [b'GET']>
DEBUG:httpcore:http11.receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Content-Length', b'580'), (b'Content-Type', b'application/json; charset=utf-8'), (b'x-correlation-id', b'c482021e-463d-41c8-aea2-886e90d16103'), (b'x-cluster-mock-used', b'false'), (b'Strict-Transport-Security', b'max-age=31536000; includeSubDomains'), (b'X-Content-Type-Options', b'nosniff'), (b'Content-Security-Policy', b"default-src 'self'"), (b'Request-Context', b'appId=cid-v1:24f34ad2-7e62-4399-93db-3071c599c619'), (b'Date', b'Fri, 05 May 2023 09:11:04 GMT')])
DEBUG:httpx:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-ucs/v1/presentation/oauth/config "HTTP/1.1 200 OK"
DEBUG:httpcore:http11.receive_response_body.started request=<Request [b'GET']>
DEBUG:httpcore:http11.receive_response_body.complete
DEBUG:httpcore:http11.response_closed.started
DEBUG:httpcore:http11.response_closed.complete
DEBUG:httpcore:connection.connect_tcp.started host='customer.bmwgroup.com' port=443 local_address=None timeout=30.0
DEBUG:httpcore:connection.connect_tcp.complete return_value=<httpcore.backends.asyncio.AsyncIOStream object at 0x7f1f8ab67220>
DEBUG:httpcore:connection.start_tls.started ssl_context=<ssl.SSLContext object at 0x7f1f8abfff40> server_hostname='customer.bmwgroup.com' timeout=30.0
DEBUG:httpcore:connection.start_tls.complete return_value=<httpcore.backends.asyncio.AsyncIOStream object at 0x7f1f8ab671f0>
DEBUG:httpcore:http11.send_request_headers.started request=<Request [b'POST']>
DEBUG:httpcore:http11.send_request_headers.complete
DEBUG:httpcore:http11.send_request_body.started request=<Request [b'POST']>
DEBUG:httpcore:http11.send_request_body.complete
DEBUG:httpcore:http11.receive_response_headers.started request=<Request [b'POST']>
DEBUG:httpcore:http11.receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Date', b'Fri, 05 May 2023 09:11:05 GMT'), (b'Content-Type', b'application/json'), (b'Content-Length', b'411'), (b'Connection', b'keep-alive'), (b'x-frame-options', b'SAMEORIGIN'), (b'x-content-type-options', b'nosniff'), (b'cache-control', b'private'), (b'cache-control', b'no-cache, no-store, must-revalidate'), (b'set-cookie', b'GCDMSSO=K9WCpexRH2NOydlGCwQCIE622xQ.*AAJTSQACMDIAAlNLABxLNkFxU3lzLzdkSWUwYVMrK2pYc2pkbWRnSkE9AAR0eXBlAANDVFMAAlMxAAIwMQ..*; Path=/; Domain=customer.bmwgroup.com; Secure; HttpOnly; SameSite=lax'), (b'expires', b'0'), (b'pragma', b'no-cache'), (b'x-c2b-pwpolicyconform', b'true'), (b'Strict-Transport-Security', b'max-age=15724800; includeSubDomains'), (b'Access-Control-Allow-Origin', b''), (b'Access-Control-Allow-Headers', b'Authorization, Origin, X-c2b-Authorization, X-c2b-mTAN, X-Requested-With, X-c2b-Sender-Id, X-c2b-External-Id, Content-Type, Accept, Cache-Control, KeyId, x-dtc'), (b'Access-Control-Max-Age', b'3628800'), (b'Access-Control-Allow-Credentials', b'true'), (b'Access-Control-Allow-Methods', b'POST, GET, OPTIONS, PUT, DELETE, HEAD'), (b'Referrer-Policy', b'strict-origin'), (b'x-c2b-request-id', b'rrt-4680027111680345557-b-geu3-15680-29532168-1')])
DEBUG:httpx:HTTP Request: POST https://customer.bmwgroup.com/gcdm/oauth/authenticate "HTTP/1.1 200 OK"
DEBUG:httpcore:http11.receive_response_body.started request=<Request [b'POST']>
DEBUG:httpcore:http11.receive_response_body.complete
DEBUG:httpcore:http11.response_closed.started
DEBUG:httpcore:http11.response_closed.complete
DEBUG:httpcore:http11.send_request_headers.started request=<Request [b'POST']>
DEBUG:httpcore:http11.send_request_headers.complete
DEBUG:httpcore:http11.send_request_body.started request=<Request [b'POST']>
DEBUG:httpcore:http11.send_request_body.complete
DEBUG:httpcore:http11.receive_response_headers.started request=<Request [b'POST']>
DEBUG:httpcore:http11.receive_response_headers.complete return_value=(b'HTTP/1.1', 302, b'Found', [(b'Date', b'Fri, 05 May 2023 09:11:05 GMT'), (b'Content-Length', b'0'), (b'Connection', b'keep-alive'), (b'x-frame-options', b'SAMEORIGIN'), (b'x-content-type-options', b'nosniff'), (b'cache-control', b'no-store'), (b'location', b'com.bmw.connected://oauth?code=nYomIdq6c57D4N0wnAOGEan8-cs&state=zLOhxo0kG68w3nmEvsxXaj&client_id=31c357a0-7a1d-4590-aa99-33b97244d048&nonce=login_nonce'), (b'pragma', b'no-cache'), (b'set-cookie', b'OAUTH_REQUEST_ATTRIBUTES=DELETED; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=/; Domain=customer.bmwgroup.com; Secure; HttpOnly; SameSite=lax'), (b'set-cookie', b'OAUTH_REQUEST_ATTRIBUTES=DELETED; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=/; Domain=prod-gcdm.eu-central-1.aws.cloud.bmw; Secure; HttpOnly; SameSite=lax'), (b'Strict-Transport-Security', b'max-age=15724800; includeSubDomains'), (b'Access-Control-Allow-Origin', b''), (b'Access-Control-Allow-Headers', b'Authorization, Origin, X-c2b-Authorization, X-c2b-mTAN, X-Requested-With, X-c2b-Sender-Id, X-c2b-External-Id, Content-Type, Accept, Cache-Control, KeyId, x-dtc'), (b'Access-Control-Max-Age', b'3628800'), (b'Access-Control-Allow-Credentials', b'true'), (b'Access-Control-Allow-Methods', b'POST, GET, OPTIONS, PUT, DELETE, HEAD'), (b'Referrer-Policy', b'strict-origin'), (b'x-c2b-request-id', b'rrt-4680027111680345557-b-geu3-15680-29532168-2')])
DEBUG:httpx:HTTP Request: POST https://customer.bmwgroup.com/gcdm/oauth/authenticate?interaction-id=26a68fc7-b507-4f21-aff0-fe4c7a6c77e0&client-version=android%28TQ2A.230405.003.B2%29%3Bbmw%3B3.3.1%2822418%29%3Brow "HTTP/1.1 302 Found"
DEBUG:httpcore:http11.receive_response_body.started request=<Request [b'POST']>
DEBUG:httpcore:http11.receive_response_body.complete
DEBUG:httpcore:http11.response_closed.started
DEBUG:httpcore:http11.response_closed.complete
DEBUG:httpcore:http11.send_request_headers.started request=<Request [b'POST']>
DEBUG:httpcore:http11.send_request_headers.complete
DEBUG:httpcore:http11.send_request_body.started request=<Request [b'POST']>
DEBUG:httpcore:http11.send_request_body.complete
DEBUG:httpcore:http11.receive_response_headers.started request=<Request [b'POST']>
DEBUG:httpcore:http11.receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Date', b'Fri, 05 May 2023 09:11:05 GMT'), (b'Content-Type', b'application/json'), (b'Content-Length', b'1971'), (b'Connection', b'keep-alive'), (b'Cache-Control', b'no-cache,no-store'), (b'Pragma', b'no-cache'), (b'Access-Control-Allow-Origin', b''), (b'Access-Control-Allow-Headers', b'Authorization, Origin, X-c2b-Authorization, X-c2b-mTAN, X-Requested-With, X-c2b-Sender-Id, X-c2b-External-Id, Content-Type, Accept, Cache-Control, KeyId, x-dtc'), (b'Access-Control-Max-Age', b'3628800'), (b'Access-Control-Allow-Credentials', b'true'), (b'Access-Control-Allow-Methods', b'POST, GET, OPTIONS, PUT, DELETE, HEAD'), (b'Referrer-Policy', b'strict-origin'), (b'x-c2b-request-id', b'rrt-4680027111680345557-b-geu3-15680-29532168-3')])
DEBUG:httpx:HTTP Request: POST https://customer.bmwgroup.com/gcdm/oauth/token "HTTP/1.1 200 OK"
DEBUG:httpcore:http11.receive_response_body.started request=<Request [b'POST']>
DEBUG:httpcore:http11.receive_response_body.complete
DEBUG:httpcore:http11.response_closed.started
DEBUG:httpcore:http11.response_closed.complete
DEBUG:httpcore:connection.close.started
DEBUG:httpcore:connection.close.complete
DEBUG:httpcore:connection.close.started
DEBUG:httpcore:connection.close.complete
DEBUG:httpcore:connection.connect_tcp.started host='cocoapi.bmwgroup.com' port=443 local_address=None timeout=30.0
DEBUG:httpcore:connection.connect_tcp.complete return_value=<httpcore.backends.asyncio.AsyncIOStream object at 0x7f1f8abd6a40>
DEBUG:httpcore:connection.start_tls.started ssl_context=<ssl.SSLContext object at 0x7f1f8abffe40> server_hostname='cocoapi.bmwgroup.com' timeout=30.0
DEBUG:httpcore:connection.start_tls.complete return_value=<httpcore.backends.asyncio.AsyncIOStream object at 0x7f1f8ac59390>
DEBUG:httpcore:http11.send_request_headers.started request=<Request [b'GET']>
DEBUG:httpcore:http11.send_request_headers.complete
DEBUG:httpcore:http11.send_request_body.started request=<Request [b'GET']>
DEBUG:httpcore:http11.send_request_body.complete
DEBUG:httpcore:http11.receive_response_headers.started request=<Request [b'GET']>
DEBUG:httpcore:http11.receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Content-Length', b'896'), (b'Content-Type', b'application/json; charset=utf-8'), (b'x-cluster-mock-used', b'false'), (b'x-correlation-id', b'7c3f082a-bad6-435d-9c11-8677b8270a67'), (b'Strict-Transport-Security', b'max-age=31536000; includeSubDomains'), (b'X-Content-Type-Options', b'nosniff'), (b'Content-Security-Policy', b"default-src 'self'"), (b'Request-Context', b'appId=cid-v1:24f34ad2-7e62-4399-93db-3071c599c619'), (b'Date', b'Fri, 05 May 2023 09:11:06 GMT')])
DEBUG:httpx:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles "HTTP/1.1 200 OK"
DEBUG:httpcore:http11.receive_response_body.started request=<Request [b'GET']>
DEBUG:httpcore:http11.receive_response_body.complete
DEBUG:httpcore:http11.response_closed.started
DEBUG:httpcore:http11.response_closed.complete
DEBUG:httpcore:http11.send_request_headers.started request=<Request [b'GET']>
DEBUG:httpcore:http11.send_request_headers.complete
DEBUG:httpcore:http11.send_request_body.started request=<Request [b'GET']>
DEBUG:httpcore:http11.send_request_body.complete
DEBUG:httpcore:http11.receive_response_headers.started request=<Request [b'GET']>
DEBUG:httpcore:http11.receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Content-Length', b'2'), (b'Content-Type', b'application/json; charset=utf-8'), (b'x-cluster-mock-used', b'false'), (b'x-correlation-id', b'469e018a-e07f-40aa-ac1d-dc1797f69060'), (b'Strict-Transport-Security', b'max-age=31536000; includeSubDomains'), (b'X-Content-Type-Options', b'nosniff'), (b'Content-Security-Policy', b"default-src 'self'"), (b'Request-Context', b'appId=cid-v1:24f34ad2-7e62-4399-93db-3071c599c619'), (b'Date', b'Fri, 05 May 2023 09:11:06 GMT')])
DEBUG:httpx:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles "HTTP/1.1 200 OK"
DEBUG:httpcore:http11.receive_response_body.started request=<Request [b'GET']>
DEBUG:httpcore:http11.receive_response_body.complete
DEBUG:httpcore:http11.response_closed.started
DEBUG:httpcore:http11.response_closed.complete
DEBUG:httpcore:connection.close.started
DEBUG:httpcore:connection.close.complete
DEBUG:httpx:load_ssl_context verify=True cert=None trust_env=True http2=False
DEBUG:httpx:load_verify_locations cafile='/etc/ssl/certs/ca-certificates.crt'
DEBUG:httpcore:connection.connect_tcp.started host='cocoapi.bmwgroup.com' port=443 local_address=None timeout=30.0
DEBUG:httpcore:connection.connect_tcp.complete return_value=<httpcore.backends.asyncio.AsyncIOStream object at 0x7f1f8abd6110>
DEBUG:httpcore:connection.start_tls.started ssl_context=<ssl.SSLContext object at 0x7f1f8ab33040> server_hostname='cocoapi.bmwgroup.com' timeout=30.0
DEBUG:httpcore:connection.start_tls.complete return_value=<httpcore.backends.asyncio.AsyncIOStream object at 0x7f1f8abd6560>
DEBUG:httpcore:http11.send_request_headers.started request=<Request [b'GET']>
DEBUG:httpcore:http11.send_request_headers.complete
DEBUG:httpcore:http11.send_request_body.started request=<Request [b'GET']>
DEBUG:httpcore:http11.send_request_body.complete
DEBUG:httpcore:http11.receive_response_headers.started request=<Request [b'GET']>
DEBUG:httpcore:http11.receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Content-Length', b'4718'), (b'Content-Type', b'application/json; charset=utf-8'), (b'x-cluster-mock-used', b'false'), (b'x-correlation-id', b'88ebc23c-03e0-424b-aa30-6248f9345131'), (b'Strict-Transport-Security', b'max-age=31536000; includeSubDomains'), (b'X-Content-Type-Options', b'nosniff'), (b'Content-Security-Policy', b"default-src 'self'"), (b'Request-Context', b'appId=cid-v1:24f34ad2-7e62-4399-93db-3071c599c619'), (b'Date', b'Fri, 05 May 2023 09:11:07 GMT')])
DEBUG:httpx:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles/state?apptimezone=120.0&appDateTime=1683277865352 "HTTP/1.1 200 OK"
DEBUG:httpcore:http11.receive_response_body.started request=<Request [b'GET']>
DEBUG:httpcore:http11.receive_response_body.complete
DEBUG:httpcore:http11.response_closed.started
DEBUG:httpcore:http11.response_closed.complete
DEBUG:httpcore:http11.send_request_headers.started request=<Request [b'GET']>
DEBUG:httpcore:http11.send_request_headers.complete
DEBUG:httpcore:http11.send_request_body.started request=<Request [b'GET']>
DEBUG:httpcore:http11.send_request_body.complete
DEBUG:httpcore:http11.receive_response_headers.started request=<Request [b'GET']>
DEBUG:httpcore:http11.receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Transfer-Encoding', b'chunked'), (b'Content-Type', b'application/json; charset=utf-8'), (b'Content-Encoding', b'gzip'), (b'Vary', b'Accept-Encoding'), (b'Request-Context', b'appId=cid-v1:24f34ad2-7e62-4399-93db-3071c599c619'), (b'api-supported-versions', b'1.0,2.0'), (b'Strict-Transport-Security', b'max-age=31536000; includeSubDomains'), (b'X-Content-Type-Options', b'nosniff'), (b'Content-Security-Policy', b"default-src 'self'"), (b'Date', b'Fri, 05 May 2023 09:11:07 GMT')])
DEBUG:httpx:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-crccs/v2/vehicles?fields=charging-profile&has_charging_settings_capabilities=false "HTTP/1.1 200 OK"
DEBUG:httpcore:http11.receive_response_body.started request=<Request [b'GET']>
DEBUG:httpcore:http11.receive_response_body.complete
DEBUG:httpcore:http11.response_closed.started
DEBUG:httpcore:http11.response_closed.complete
DEBUG:httpcore:connection.close.started
DEBUG:httpcore:connection.close.complete
Traceback (most recent call last):
  File "/home/niels/.local/bin/./bimmerconnected", line 8, in <module>
    sys.exit(main())
  File "/home/niels/.local/lib/python3.10/site-packages/bimmer_connected/cli.py", line 356, in main
    loop.run_until_complete(args.func(args))
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/home/niels/.local/lib/python3.10/site-packages/bimmer_connected/cli.py", line 175, in fingerprint
    await account.get_vehicles()
  File "/home/niels/.local/lib/python3.10/site-packages/bimmer_connected/account.py", line 132, in get_vehicles
    self.add_vehicle(vehicle.data, vehicle_state, charging_settings, fetched_at)
  File "/home/niels/.local/lib/python3.10/site-packages/bimmer_connected/account.py", line 147, in add_vehicle
    existing_vehicle.update_state(vehicle_base, vehicle_state, charging_settings, fetched_at)
  File "/home/niels/.local/lib/python3.10/site-packages/bimmer_connected/vehicle/vehicle.py", line 119, in update_state
    setattr(self, vehicle_attribute, cls.from_vehicle_data(vehicle_data))
  File "/home/niels/.local/lib/python3.10/site-packages/bimmer_connected/models.py", line 37, in from_vehicle_data
    parsed = cls._parse_vehicle_data(vehicle_data) or {}
  File "/home/niels/.local/lib/python3.10/site-packages/bimmer_connected/vehicle/tires.py", line 53, in _parse_vehicle_data
    retval["front_left"] = TireState(**vehicle_data[ATTR_STATE]["tireState"]["frontLeft"])
  File "/home/niels/.local/lib/python3.10/site-packages/bimmer_connected/vehicle/tires.py", line 16, in __init__
    self.target_pressure: int = status["targetPressure"]
KeyError: 'targetPressure'
Oneshotblu commented 1 year ago

Good afternoon, same problem here, it is related to 2023.5 update as only minutes before all was working perfectly 2023-05-05 15_16_41-Impostazioni – Home Assistant – Mozilla Firefox Kind Regards

JohanKSE commented 1 year ago

Same issue here, started after updating to HA 2023.5

rikroe commented 1 year ago

If any of you is able to provide a fingerprint or a diagnostics json, that would be greatly appreciated!

NielsDigitalLink commented 1 year ago

If any of you is able to provide a fingerprint or a diagnostics json, that would be greatly appreciated!

The output from the "bimmerconnected fingerprint" command is already in my latest post (https://github.com/home-assistant/core/issues/92550#issuecomment-1535973473). Or do you expect something else?

rikroe commented 1 year ago

Or do you expect something else?

I would have expected a json files with the contents of the API requests. Usually stored in /home/bimmerconnected somewhere.

If those don't exist, there is also bug in our fingerprint logic.

slashback100 commented 1 year ago

I don't see the option in the integration menu to get the diagnostics file...

rikroe commented 1 year ago

Screenshot_20230505-201911

It's German, but the icons should be the same

NielsDigitalLink commented 1 year ago

Or do you expect something else?

I would have expected a json files with the contents of the API requests. Usually stored in /home/bimmerconnected somewhere.

If those don't exist, there is also bug in our fingerprint logic.

A folder in ~/vehicle_fingerprint is created with the date and time, but it is empty...

image

slashback100 commented 1 year ago

I don't have that option :

Screenshot 2023-05-05 at 20 20 53
NielsDigitalLink commented 1 year ago

The same as @slashback100, but now the first error (HTTPStatusError invalid_client) is displayed after enabling the integration again. I also don't have the option anymore too to download logs (before 2023.5.0 I am sure I had that possibility, and for other integrations it is available. I guess the integration can't load "far" enough to enable debug logging?).

image

EDIT: Sorry, got the integration re-installed with the wrong password, so that's why I got this error above. Now I got the same again as @slashback100

image

slashback100 commented 1 year ago

I fixed the problem by commenting the line self.target_pressure: int = status["targetPressure"] in tires.py

slashback100 commented 1 year ago

FYI I have the possibility to download the json log file after the workaround

rikroe commented 1 year ago

OK, thanks. I'll create a patch when back home. And then have a look to make diagnostics more resilient.

@slashback100 could you provide the JSON please? I think I know what's going on but like to double check.

slashback100 commented 1 year ago
   "fingerprint": [
      {
        "filename": "bmw-eadrax-vcs_v4_vehicles.json",
        "content": [
          {
            "vin": "**REDACTED**",
            "mappingInfo": {
              "isAssociated": true,
              "isLmmEnabled": false,
              "mappingStatus": "CONFIRMED",
              "isPrimaryUser": true
            },
            "appVehicleType": "CONNECTED",
            "attributes": {
              "lastFetched": "2023-05-05T18:38:29.137Z",
              "model": "420i",
              "year": 2021,
              "color": 4280233344,
              "brand": "BMW",
              "driveTrain": "COMBUSTION",
              "headUnitType": "MGU",
              "headUnitRaw": "HU_MGU",
              "hmiVersion": "ID7",
              "softwareVersionCurrent": {
                "puStep": {
                  "month": 11,
                  "year": 21
                },
                "iStep": 540,
                "seriesCluster": "S18A"
              },
              "softwareVersionExFactory": {
                "puStep": {
                  "month": 11,
                  "year": 21
                },
                "iStep": 528,
                "seriesCluster": "S18A"
              },
              "telematicsUnit": "ATM2",
              "bodyType": "G26",
              "countryOfOrigin": "BE",
              "driverGuideInfo": {
                "androidAppScheme": "com.bmwgroup.driversguide.row",
                "iosAppScheme": "bmwdriversguide:///open",
                "androidStoreUrl": "https://play.google.com/store/apps/details?id=com.bmwgroup.driversguide.row",
                "iosStoreUrl": "https://apps.apple.com/de/app/id714042749?mt=8"
              }
            }
          }
        ]
      },
      {
        "filename": "mini-eadrax-vcs_v4_vehicles.json",
        "content": []
      },
      {
        "filename": "bmw-eadrax-vcs_v4_vehicles_state_WBA0FINGERPRINT01.json",
        "content": {
          "state": {
            "isLeftSteering": true,
            "lastFetched": "2023-05-05T18:38:29.953Z",
            "lastUpdatedAt": "2023-05-05T18:13:46Z",
            "isLscSupported": true,
            "range": 395,
            "doorsState": {
              "combinedSecurityState": "UNLOCKED",
              "leftFront": "CLOSED",
              "leftRear": "CLOSED",
              "rightFront": "CLOSED",
              "rightRear": "CLOSED",
              "combinedState": "CLOSED",
              "hood": "CLOSED",
              "trunk": "CLOSED"
            },
            "windowsState": {
              "leftFront": "OPEN",
              "leftRear": "CLOSED",
              "rightFront": "CLOSED",
              "rightRear": "CLOSED",
              "combinedState": "OPEN"
            },
            "tireState": {
              "frontLeft": {
                "details": {
                  "identificationInProgress": false
                },
                "status": {
                  "currentPressure": 240
                }
              },
              "frontRight": {
                "details": {
                  "identificationInProgress": false
                },
                "status": {
                  "currentPressure": 240
                }
              },
              "rearLeft": {
                "details": {
                  "identificationInProgress": false
                },
                "status": {
                  "currentPressure": 250
                }
              },
              "rearRight": {
                "details": {
                  "identificationInProgress": false
                },
                "status": {
                  "currentPressure": 240
                }
              }
            },
            "location": {
              "coordinates": {
                "latitude": "**REDACTED**",
                "longitude": "**REDACTED**"
              },
              "address": {
                "formatted": "**REDACTED**"
              },
              "heading": "**REDACTED**"
            },
            "currentMileage": 61076,
            "climateControlState": {
              "activity": "INACTIVE"
            },
            "requiredServices": [
              {
                "dateTime": "2024-09-01T00:00:00.000Z",
                "mileage": 6000,
                "type": "OIL",
                "status": "OK",
                "description": "Next service due after the specified distance or date."
              },
              {
                "dateTime": "2024-09-01T00:00:00.000Z",
                "mileage": 6000,
                "type": "VEHICLE_CHECK",
                "status": "OK",
                "description": "Next visual inspection due by specified date or, if shown, when stated distance has been reached."
              },
              {
                "dateTime": "2024-11-01T00:00:00.000Z",
                "type": "BRAKE_FLUID",
                "status": "OK",
                "description": "Next service due by the specified date."
              },
              {
                "dateTime": "2062-12-01T00:00:00.000Z",
                "type": "EMISSION_CHECK",
                "status": "OK",
                "description": "Next state emissions inspection due by the specified date."
              }
            ],
            "checkControlMessages": [
              {
                "type": "TIRE_PRESSURE",
                "severity": "LOW"
              },
              {
                "type": "ENGINE_OIL",
                "severity": "LOW"
              }
            ],
            "combustionFuelLevel": {
              "remainingFuelPercent": 57,
              "remainingFuelLiters": 29,
              "range": 395
            },
            "driverPreferences": {
              "lscPrivacyMode": "OFF"
            },
            "climateTimers": [
              {
                "isWeeklyTimer": false,
                "timerAction": "DEACTIVATE",
                "timerWeekDays": [],
                "departureTime": {
                  "hour": 7,
                  "minute": 0
                }
              },
              {
                "isWeeklyTimer": true,
                "timerAction": "DEACTIVATE",
                "timerWeekDays": [
                  "MONDAY"
                ],
                "departureTime": {
                  "hour": 7,
                  "minute": 0
                }
              },
              {
                "isWeeklyTimer": true,
                "timerAction": "DEACTIVATE",
                "timerWeekDays": [
                  "MONDAY"
                ],
                "departureTime": {
                  "hour": 7,
                  "minute": 0
                }
              }
            ]
          },
          "capabilities": {
            "a4aType": "NOT_SUPPORTED",
            "climateNow": true,
            "isClimateTimerSupported": true,
            "climateTimerTrigger": "DEPARTURE_TIMER",
            "climateFunction": "VENTILATION",
            "horn": true,
            "isBmwChargingSupported": false,
            "isCarSharingSupported": false,
            "isChargeNowForBusinessSupported": false,
            "isChargingHistorySupported": false,
            "isChargingHospitalityEnabled": false,
            "isChargingLoudnessEnabled": false,
            "isChargingPlanSupported": false,
            "isChargingPowerLimitEnabled": false,
            "isChargingSettingsEnabled": false,
            "isChargingTargetSocEnabled": false,
            "isCustomerEsimSupported": false,
            "isDataPrivacyEnabled": false,
            "isDCSContractManagementSupported": false,
            "isEasyChargeEnabled": false,
            "isMiniChargingSupported": false,
            "isEvGoChargingSupported": false,
            "isRemoteHistoryDeletionSupported": false,
            "isRemoteEngineStartSupported": false,
            "isRemoteServicesActivationRequired": false,
            "isRemoteServicesBookingRequired": false,
            "isScanAndChargeSupported": false,
            "lastStateCallState": "ACTIVATED",
            "lights": true,
            "lock": true,
            "remoteSoftwareUpgrade": true,
            "sendPoi": true,
            "unlock": true,
            "vehicleFinder": true,
            "vehicleStateSource": "LAST_STATE_CALL",
            "isRemoteHistorySupported": true,
            "isWifiHotspotServiceSupported": true,
            "isNonLscFeatureEnabled": false,
            "isSustainabilitySupported": true,
            "isSustainabilityAccumulatedViewEnabled": true,
            "specialThemeSupport": [],
            "isRemoteParkingSupported": false,
            "remoteChargingCommands": {},
            "isClimateTimerWeeklyActive": true,
            "digitalKey": {
              "state": "ACTIVATED",
              "vehicleSoftwareUpgradeRequired": false,
              "bookedServicePackage": "SMACC_1_5",
              "readerGraphics": "000200000000"
            },
            "isPersonalPictureUploadSupported": false,
            "isPlugAndChargeSupported": false,
            "isOptimizedChargingSupported": false
          }
        }
      }
    ]
NielsDigitalLink commented 1 year ago

I can confirm that the temporary fix from @slashback100 works. It seems that the targetPressure is not available anymore in the JSON responses.

If others want to apply this temp fix:

rikroe commented 1 year ago

This will be fixed in 2023.5.3 as #92648 got merged.

Feridoun commented 1 year ago

I can confirm that the temporary fix from @slashback100 works. It seems that the targetPressure is not available anymore in the JSON responses.

If others want to apply this temp fix:

  • Install add-on Advanced SSH & Web Terminal, add it to the sidebar and open the add-on
  • Insert the command docker exec -it $(docker ps -f name=homeassistant -q) bash to go into the docker of HA
  • Now use vi to edit the file, so use the command vi ./usr/local/lib/python3.10/site-packages/bimmer_connected/vehicle/tires.py
  • Comment the 16th line by putting a # in front of the line
  • Restart HA

Thanks. The docker command doesn't work on my system 'command not found', and I can't find the tires.py file - there's no python3.10 folder under /usr/local/lib

ggranvik commented 1 year ago

Update: Disregard the text below. Got it to work by deleting and reinstalling the integration, which seems to be the only way to change the BMW login credentials. I noted that battery status entity has been renamed, but that is easy to fix in my cards.

I just updated Home Assistant to 2023.5.3, but the BMW integration still doesn't seem to work. And I have no idea how to get to this tires.py file. I use the Samba share addon, but can't find any python files. Running Home Assistant OS, no "Docker" or virtual machine stuff.

But if it is just the login that fails, do i have to delete and reinstall the integration to be able to enter the login details again?

JohanKSE commented 1 year ago

I updated yesterday and all seems to work fine, however I did actually remove it first and then added it again (using same names etc) and then it worked just as before incl scripts and stuff added to the control panel.

ggranvik commented 1 year ago

I updated yesterday and all seems to work fine, however I did actually remove it first and then added it again (using same names etc) and then it worked just as before incl scripts and stuff added to the control panel.

Thanks, yes, I did the same, and it now works. The only thing was that the battery status wouldn't show, but I saw the entity has got a new name, and that is easy to fix of course.

rikroe commented 1 year ago

If anyone still has the issue that it doesn't work after updating to 2023.5.3, please post a log. The integration should recover itself and I'd like to understand why it apparently doesn't.

alexio70 commented 1 year ago

@rikroe integration has not recovered in Frontend 20230503.3 - latest

alexio70 commented 1 year ago

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/coordinator.py", line 58, in _async_update_data await self.account.get_vehicles() File "/usr/local/lib/python3.10/site-packages/bimmer_connected/account.py", line 93, in get_vehicles await self._init_vehicles() File "/usr/local/lib/python3.10/site-packages/bimmer_connected/account.py", line 72, in _init_vehicles vehicles_responses: List[httpx.Response] = [ File "/usr/local/lib/python3.10/site-packages/bimmer_connected/account.py", line 73, in await client.get( File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1754, in get return await self.request( File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1530, in request return await self.send(request, auth=auth, follow_redirects=follow_redirects) File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1617, in send response = await self._send_handling_auth( File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1642, in _send_handling_auth request = await auth_flow.anext() File "/usr/local/lib/python3.10/site-packages/bimmer_connected/api/authentication.py", line 76, in async_auth_flow await self.login() File "/usr/local/lib/python3.10/site-packages/bimmer_connected/api/authentication.py", line 114, in login token_data = await self._login_row_na() File "/usr/local/lib/python3.10/site-packages/bimmer_connected/api/authentication.py", line 165, in _login_row_na response = await client.post( File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1845, in post return await self.request( File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1530, in request return await self.send(request, auth=auth, follow_redirects=follow_redirects) File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1617, in send response = await self._send_handling_auth( File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1645, in _send_handling_auth response = await self._send_handling_redirects( File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1703, in _send_handling_redirects raise exc File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1685, in _send_handling_redirects await hook(response) File "/usr/local/lib/python3.10/site-packages/bimmer_connected/api/authentication.py", line 355, in raise_for_status_event_handler await handle_httpstatuserror(ex, log_handler=_LOGGER) File "/usr/local/lib/python3.10/site-packages/bimmer_connected/api/utils.py", line 75, in handle_httpstatuserror raise _ex_to_raise(_err_message) from ex bimmer_connected.models.MyBMWAuthError: HTTPStatusError: invalid_client - Client authentication failed (e.g., login failure, unknown client, no client authentication included or unsupported authentication method) 2023-05-18 10:24:05.648 DEBUG (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Finished fetching bmw_connected_drive-myemail@gmail.com data in 0.473 seconds (success: False)

alexio70 commented 1 year ago

@rikroe should I reinstall it completely?

JohanKSE commented 1 year ago

If anyone still has the issue that it doesn't work after updating to 2023.5.3, please post a log. The integration should recover itself and I'd like to understand why it apparently doesn't.

Well in my case it was quite simple. I had changed pw but forgot about I so Iuninstalled/re-installed it since i couldn't figure out how to change the pw./J

rikroe commented 1 year ago

Ah now I understand why the reauth flow is not triggering. Basically the library now throws different errors than what HA expects due to some PRs "overtaking" others. It will be fixed with HA 2023.6 as it is already merged.

Workaround in the meantime:

Also, depending on the time you changed your password, BMW had the very awkward idea of changing some characters in their JavaScript before it got send to the server, i.e. ` (backtick) got changed to ' (apostrophe). If you set a new password that complies with the current rules, this should not happen anymore.

Please make sure to follow the BMW password policy mentioned in https://github.com/home-assistant/core/issues/92318#issuecomment-1532703364.

alexio70 commented 1 year ago

reinstall did not work for me; what am I missing here? Scherm­afbeelding 2023-05-18 om 20 50 35

klessed commented 1 year ago

removing and reïnstalling didn't work. I now see Retrying setup: 'currentPressure'

rikroe commented 1 year ago

@alexio70 I would need the log entries for this, but might be the same @klessed is seeing... For some reason the API doesn't provide all information for the tire state that we excpect...

sanderlv commented 1 year ago

I seem to have this issue now. I am on: Home Assistant 2023.5.4 Supervisor 2023.04.1 Operating System 10.2 Frontend 20230503.3 - latest

It seems to have appeard when updating to HAOS 10.2

The error:

Logger: homeassistant.components.bmw_connected_drive.coordinator
Source: components/bmw_connected_drive/coordinator.py:61
Integration: BMW Connected Drive (documentation, issues)
First occurred: 22:38:18 (4 occurrences)
Last logged: 22:39:13

Unexpected error fetching bmw_connected_drive-bmw.nl@mydomain.nl data: HTTPStatusError: invalid_client - Client authentication failed (e.g., login failure, unknown client, no client authentication included or unsupported authentication method)
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/bimmer_connected/api/authentication.py", line 380, in raise_for_status_event_handler
    response.raise_for_status()
  File "/usr/local/lib/python3.10/site-packages/httpx/_models.py", line 749, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '401 Unauthorized' for url 'https://customer.bmwgroup.com/gcdm/oauth/authenticate'
For more information check: https://httpstatuses.com/401

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/coordinator.py", line 61, in _async_update_data
    await self.account.get_vehicles()
  File "/usr/local/lib/python3.10/site-packages/bimmer_connected/account.py", line 93, in get_vehicles
    await self._init_vehicles()
  File "/usr/local/lib/python3.10/site-packages/bimmer_connected/account.py", line 72, in _init_vehicles
    vehicles_responses: List[httpx.Response] = [
  File "/usr/local/lib/python3.10/site-packages/bimmer_connected/account.py", line 73, in <listcomp>
    await client.get(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1757, in get
    return await self.request(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1530, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1617, in send
    response = await self._send_handling_auth(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1642, in _send_handling_auth
    request = await auth_flow.__anext__()
  File "/usr/local/lib/python3.10/site-packages/bimmer_connected/api/authentication.py", line 80, in async_auth_flow
    await self.login()
  File "/usr/local/lib/python3.10/site-packages/bimmer_connected/api/authentication.py", line 118, in login
    token_data = await self._login_row_na()
  File "/usr/local/lib/python3.10/site-packages/bimmer_connected/api/authentication.py", line 170, in _login_row_na
    response = await client.post(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1848, in post
    return await self.request(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1530, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1617, in send
    response = await self._send_handling_auth(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1703, in _send_handling_redirects
    raise exc
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1685, in _send_handling_redirects
    await hook(response)
  File "/usr/local/lib/python3.10/site-packages/bimmer_connected/api/authentication.py", line 382, in raise_for_status_event_handler
    await handle_httpstatuserror(ex, log_handler=_LOGGER)
  File "/usr/local/lib/python3.10/site-packages/bimmer_connected/api/utils.py", line 79, in handle_httpstatuserror
    raise _ex_to_raise(_err_message) from ex
bimmer_connected.models.MyBMWAuthError: HTTPStatusError: invalid_client - Client authentication failed (e.g., login failure, unknown client, no client authentication included or unsupported authentication method)
cp1983 commented 1 year ago

Still have issues with the integration. Removed Connected Drive integration from home assistant. Updated home assistant to 2023.6.1. Changed the password on my BMW account to a new password. Added the connected drive integration again in home assistant with new password.

Data was updating fine for 1.5 hours. Then it requires reconfiguration again.

That being said, The new password does not work anymore on the BMW website either.

Going to disable the home assistant integration for a while and see it the password still goes invalid without the integration enabled.

bwired-nl commented 1 year ago

same here as you have, did all the same, works for a very short while and the same problem again, :-(

lbuijk commented 1 year ago

Same here since a week or so - no updates installed and waiting before I do that (because of other issues with 2023 version)

JohanKSE commented 1 year ago

Same here, looks like every major update from BMW breaks the app.

/Johan

Den ons 5 juli 2023 16:15lbuijk @.***> skrev:

Same here since a week or so - no updates installed and waiting before I do that (because of other issues with 2023 version)

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/92550#issuecomment-1621852788, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADMB6JLLZGRL7Y7JBUWIKUDXOVZILANCNFSM6AAAAAAXWILVZY . You are receiving this because you commented.Message ID: @.***>

joelez83 commented 1 year ago

Hi everyone, I finally got it working by removing and reinstalling the integration, changing the password in BMW site and (only after that) re-authenticating in the integration's login pop up. Hope it will help!

rikroe commented 1 year ago

Glad it's working again for you. Closing this as I'm cleaning up and as far as I know all should be well again. Please create a new issue if you still face problems.

rikroe commented 1 year ago

@home-assistant close