Closed cpohli closed 8 months 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!
(message by CodeOwnersMention)
bmw_connected_drive documentation bmw_connected_drive source (message by IssueLinks)
Ditto, having the same issue.
Same on my side.
My 2 cents: 1/ I suspect that the BMW API are throttled in a way (I see regular messages complaining about too much calls) and that some gateway there is assimilating the HA usage to some "rogue stuffs", invalidating the OAUTH Refresh Token we get when authenticating.
2/ I imagine that there is some timer for polling the car status into the connector, if yes, how can we set it lower to go below the radar again ?
I'm having the same issue since a couple of days. It would be nice to have a setting where you can specify how often it should fetch data. I don't need it every hour. Couple times a day should be enough for me.
same here (Europe), twice a day reconfiguring since a week or so
Probably not hugely useful, but I also have the same issue. FWIW I have 2 vehicles in my account..
just fyi, same issue for me.
So you get a MyBMWAuthError due to HTTPStatusError: Client error '401 Unauthorized' for url
but reconfiguring the integration helps?
Or do you get issues like KeyError: 'capabilities'
?
I get both @rikroe
Then this looks to me as if BMW again has some issues with their APIs. capabilities
is at the core of the returned JSON, if that is missing, something bad is happening.
I do get the Client error '401 Unauthorized'
as well but it recovers by itself:
I also need to reconfigure the integration every few hours because it stops working with Client error '401 Unauthorized'
this happens to me since the latest homeassistant upgrade.
So you get a
MyBMWAuthError due to HTTPStatusError: Client error '401 Unauthorized' for url
but reconfiguring the integration helps?Or do you get issues like
KeyError: 'capabilities'
?
I first see these and after that it changes to Client error '401 Unauthorized' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles/state?apptimezone=60.0&appDateTime=1700998634584'
Logger: homeassistant.components.bmw_connected_drive.coordinator Source: helpers/update_coordinator.py:290 Integration: BMW Connected Drive (documentation, issues) First occurred: November 24, 2023 at 07:29:02 (8 occurrences) Last logged: 06:37:34
Unexpected error fetching bmw_connected_drive-xxxxxxx data: 'capabilities' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 290, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/coordinator.py", line 59, in _async_update_data await self.account.get_vehicles() File "/usr/local/lib/python3.11/site-packages/bimmer_connected/account.py", line 112, in get_vehicles if vehicle_state[ATTR_CAPABILITIES].get("isChargingPlanSupported", False) or vehicle_state[
KeyError: 'capabilities'
You do see that it sometimes does not work for quite a while and then gets new data for a short period. Sometimes it works and sometimes you have to re-authenticate after it fails. The gaps are the moments it's not getting data for the battery of the EV.
It seems the issue started after the 07.2023.63 update for my car and the update 3.11.1 for the app (both came together). Also, the app seems to be way slower than before, sometimes taking over 30s to update itself. This could suggest there is an issue with BMW servers.
2023-11-26 13:39:02.931 ERROR (MainThread) [bimmer_connected.api.authentication] MyBMWAuthError due to HTTPStatusError: Client error '401 Unauthorized' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles/state?apptimezone=60.0&appDateTime=1701002337050'
It seems the issue started after the 07.2023.63 update for my car and the update 3.11.1 for the app (both came together). Also, the app seems to be way slower than before, sometimes taking over 30s to update itself. This could suggest there is an issue with BMW servers.
2023-11-26 13:39:02.931 ERROR (MainThread) [bimmer_connected.api.authentication] MyBMWAuthError due to HTTPStatusError: Client error '401 Unauthorized' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles/state?apptimezone=60.0&appDateTime=1701002337050'
I doubt the (ota) car updates have anything to do with this issue. For me this issue happened months after the update.
I doubt the (ota) car updates have anything to do with this issue. For me this issue happened months after the update.
I also doubt the issue is really due to the car OTA (which was available only 1 week ago like the version scheme doesn't suggest), but it might participate in giving more traffic to BMW servers. In this OTA, there is a mention of "improving ConnectedDrive services".
Same issue for me. Hope you find a solution :-)
+1 I have to re-integrate multiple times during the day to make it work.
Here's what I see from the logs
Source: helpers/update_coordinator.py:322
Integration: BMW Connected Drive
First occurred: 07:48:34 (1 occurrences)
Last logged: 07:48:34
Error fetching bmw_connected_drive-<redacted> data: HTTPStatusError: { "statusCode": 429, "message": "Rate limit is exceeded. Try again in 1 seconds." }
Logger: bimmer_connected.api.authentication
Source: custom_components/bmw_connected_drive/coordinator.py:61
Integration: BMW Connected Drive
First occurred: 26 de novembro de 2023 às 10:06:04 (3 occurrences)
Last logged: 07:58:37
MyBMW API error: HTTPStatusError: Client error '401 Unauthorized' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles/state?apptimezone=0.0&appDateTime=1700993161860' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401
MyBMW API error: HTTPStatusError: { "statusCode": 429, "message": "Rate limit is exceeded. Try again in 1 seconds." }
MyBMW API error: HTTPStatusError: Client error '401 Unauthorized' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles/state?apptimezone=0.0&appDateTime=1701071914771' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401
Logger: custom_components.bmw_connected_drive.coordinator
Source: helpers/update_coordinator.py:343
Integration: BMW Connected Drive
First occurred: 26 de novembro de 2023 às 10:06:04 (2 occurrences)
Last logged: 07:58:37
Authentication failed while fetching bmw_connected_drive-<redacted> data: HTTPStatusError: Client error '401 Unauthorized' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles/state?apptimezone=0.0&appDateTime=1700993161860' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401
Authentication failed while fetching bmw_connected_drive-<redacted> data: HTTPStatusError: Client error '401 Unauthorized' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles/state?apptimezone=0.0&appDateTime=1701071914771' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401
Same issue and same logs as the people above. Based on the first time I see a gap in the data, I derive the issue first occurred on 21 November for me. That was before I upgraded to 2023.11.3, so should not be related to this.
Same issue for me. I think it’s since the update of the my bmw app
Same issue will monitor this issue and if I can help with data let me know.
Same here (Europe), twice a day reconfiguring. With 2 profiles is actually 4 times a day :)
same problem here - since a couple of days...
Same here
same for me (europe)- following
We didn't change anything regarding the API calls in the last releases. This seems to be a change on BMW server side.
A couple of questions to try to jail the problem down:
A which time (UTC) does do you get the error? It happens several times every day. No particular time of day.
is it on a regular time interval (like every six hours)? No. It seems very sporadic.
does the MyBMW app work? Yes.
what happens if you ignore the error? Will it recover by itself? No. I need to reconfigure.
It has actually worked for more than 7 hours now. But during the day (CET) it stopped working 3 times.
It's getting worse. From twice a day to 4 time and counting... I am not able to check all the time but I see that outage is for hours and not regular (interval nor duration). Reconfiguring is needed otherwise all sensors and readings are blank.
Log since 00:00 today
Line 1: Nov 27 02:07:43 System Log Error - ['MyBMWAPIError due to HTTPStatusError: Failed to fetch Vehicle Features.']
Line 2: Nov 27 02:07:48 System Log Error - ['Unable to get details for vehicle VIN NUMBER - (MyBMWAPIError) HTTPStatusError: Failed to fetch Vehicle Features.']
Line 3: Nov 27 11:00:26 System Log Error - ['MyBMWAPIError due to HTTPStatusError: Internal Server Error']
Line 4: Nov 27 11:00:28 System Log Error - ['Unable to get details for vehicle VIN NUMBER - (MyBMWAPIError) HTTPStatusError: Internal Server Error']
Line 35: Nov 27 16:43:48 System Log Error - ["MyBMWAuthError due to HTTPStatusError: Client error '401 Unauthorized'
Line 36: Nov 27 16:43:50 System Log Error - ["Error fetching bmw_connected_drive-BMW data: HTTPStatusError: Client error '401 Unauthorized'
Line 37: Nov 27 16:48:53 System Log Error - ["MyBMWAuthError due to HTTPStatusError: Client error '401 Unauthorized'
Line 38: Nov 27 18:26:32 System Log Error - ["Unexpected error fetching bmw_connected_drive-BMW data: 'capabilities'"]
Line 39: Nov 27 19:26:42 System Log Error - ["Unexpected error fetching bmw_connected_drive-BMW data: 'capabilities'"]
A which time (UTC) does do you get the error? No specific time
is it on a regular time interval (like every six hours)? No
Does the MyBMW app work? yes but not sure when the issues occurs in HA if it works in app at that time.
what happens if you ignore the error? Will it recover by itself? After awhile i need to reconfigure
This is what I am seeing in my logs for the last couple of days. It gives a timeout first and then it's unauthorized for whatever reason. Could it be that BMW kills the session from their end and that the token is not valid anymore?
Line 1184: 2023-11-24 07:29:02.408 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Unexpected error fetching bmw_connected_drive-xxx@xxx data: 'capabilities' Line 1237: 2023-11-24 08:54:47.995 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-xxx@xxx data: HTTPStatusError: {"statusCode":408,"message":"Request Timeout"} Line 1279: 2023-11-24 10:30:53.472 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Unexpected error fetching bmw_connected_drive-xxx@xxx data: 'capabilities' Line 1365: 2023-11-24 13:32:36.397 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Unexpected error fetching bmw_connected_drive-xxx@xxx data: 'capabilities' Line 1437: 2023-11-24 15:33:11.985 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-xxx@xxx data: HTTPStatusError: Client error '401 Unauthorized' for url 'xxx' Line 1501: 2023-11-24 17:28:57.826 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-xxx@xxx data: HTTPStatusError: { "statusCode": 500, "message": "Internal server error", "activityId": "33a43f12-f8db-4f47-bddf-6ba2ba8da0b7" } Line 1535: 2023-11-24 18:39:34.372 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Unexpected error fetching bmw_connected_drive-xxx@xxx data: 'capabilities' Line 1928: 2023-11-25 09:42:58.386 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-xxx@xxx data: HTTPStatusError: Client error '401 Unauthorized' for url 'xxx' Line 2638: 2023-11-26 09:30:57.870 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-xxx@xxx data: HTTPStatusError: Client error '401 Unauthorized' for url 'xxx' Line 2673: 2023-11-26 10:36:15.509 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Unexpected error fetching bmw_connected_drive-xxx@xxx data: 'capabilities' Line 2710: 2023-11-26 11:36:52.885 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Unexpected error fetching bmw_connected_drive-xxx@xxx data: 'capabilities' Line 2749: 2023-11-26 12:37:18.970 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-xxx@xxx data: HTTPStatusError: Client error '401 Unauthorized' for url 'xxx' Line 2877: 2023-11-26 17:21:21.353 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Unexpected error fetching bmw_connected_drive-xxx@xxx data: 'capabilities' Line 2918: 2023-11-26 18:21:51.952 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-xxx@xxx data: HTTPStatusError: Client error '401 Unauthorized' for url 'xxx' Line 3514: 2023-11-27 01:19:50.501 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-xxx@xxx data: [Errno -3] Try again Line 32515: 2023-11-27 06:32:33.955 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-xxx@xxx data: HTTPStatusError: Client error '401 Unauthorized' for url 'xxx' Line 32877: 2023-11-27 06:37:34.147 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Unexpected error fetching bmw_connected_drive-xxx@xxx data: 'capabilities' Line 37152: 2023-11-27 07:37:58.731 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-xxx@xxx data: HTTPStatusError: Client error '401 Unauthorized' for url 'xxx' Line 42545: 2023-11-27 08:54:10.970 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-xxx@xxx data: HTTPStatusError: Client error '401 Unauthorized' for url 'xxx' Line 54888: 2023-11-27 11:49:22.786 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-xxx@xxx data: HTTPStatusError: Client error '401 Unauthorized' for url 'xxx' Line 59507: 2023-11-27 12:54:42.298 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Unexpected error fetching bmw_connected_drive-xxx@xxx data: 'capabilities' Line 63781: 2023-11-27 13:55:23.166 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Error fetching bmw_connected_drive-xxx@xxx data: HTTPStatusError: Client error '401 Unauthorized' for url 'xxx' Line 68402: 2023-11-27 15:00:49.094 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Unexpected error fetching bmw_connected_drive-xxx@xxx data: 'capabilities' Line 76909: 2023-11-27 17:01:24.157 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Unexpected error fetching bmw_connected_drive-xxx@xxx data: 'capabilities' Line 81189: 2023-11-27 18:01:48.187 ERROR (MainThread) [homeassistant.components.bmw_connected_drive.coordinator] Unexpected error fetching bmw_connected_drive-xxx@xxx data: 'capabilities'
What's bugging me is that you actually do not need to re-authenticate (which completely resets the login credentials). A simple reload of the integration is enough (although the re-authenticate notification will still be there).
So it does not seem that the requests are actually blocked by BMW (because that would be on user/IP/...) but rather the API is screwing up and we're not handling it correctly.
I have added some additional logging in my instance and will try see if I can figure out more.
I'm seeing the same issues, however it does feel like something on the BMW side is wrong/different. I recently added my car to the Intelligent Octopus tariff in the UK, and their app seemed to be struggling to run a test charge and intermittently failed to communiate with the car.
What's bugging me is that you actually do not need to re-authenticate (which completely resets the login credentials). A simple reload of the integration is enough (although the re-authenticate notification will still be there).
Restarting HA seems to have the same effect. Do we need some sort of keep auth now? From all user feedback seems to be related to some server side changes and I see that Android app was updated on November 20. So they changed something indeed. Their change log is quiet a black box... "This app updates include bugfixes" ..
Hope that a higher log level reveals the truth 👍
Same problem here - some observations I made:
1) I have a similar issue in the MyBMW iOS App in Version 3.9.3: After some time the app does not reload the current state of the car, even manually reloading the page by „pulling down“ does not load current states. Only restarting the app helps to get the current states. I will now update the MyBMW app and will report if the issue still exists. If not this would be a strong hint that the way communicating over API changes, I guess.
2) Reloading the integration in Home Assistant is also in my case enough to get the states back, no need to re-authenticate (even if the message does not disappears then). Maybe a quick workaround could be to reload the integration when states are unavailable for a longer time (e.g. 15 minutes) - approach for this is described here: https://community.home-assistant.io/t/how-to-automatically-reload-integration-on-a-schedule/571065 - I will test this soon.
I think that the bmw server block something when there are too many attempt of connection. Here the detail of the error message i get
Logger: bimmer_connected.api.authentication Source: components/bmw_connected_drive/coordinator.py:59 First occurred: 27 novembre 2023 à 07:46:18 (14 occurrences) Last logged: 09:20:38
MyBMWAuthError due to HTTPStatusError: Client error '401 Unauthorized' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles/state?apptimezone=60.0&appDateTime=1701112936172' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 MyBMWAuthError due to HTTPStatusError: Client error '401 Unauthorized' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles/state?apptimezone=60.0&appDateTime=1701113240171' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 MyBMWQuotaError due to HTTPStatusError: { "statusCode": 429, "message": "Rate limit is exceeded. Try again in 1 seconds." } MyBMWAuthError due to HTTPStatusError: Client error '401 Unauthorized' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles/state?apptimezone=60.0&appDateTime=1701159079180' For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401 MyBMWAPIError due to 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
A which time (UTC) does do you get the error? It happens several times every day. No particular time of day.
is it on a regular time interval (like every six hours)? No. It seems very sporadic.
does the MyBMW app work? Yes.
what happens if you ignore the error? Will it recover by itself? No. I need to reconfigure.
It has actually worked for more than 7 hours now. But during the day (CET) it stopped working 3 times.
It happens about twice a day here using BMW Europe:
Log messages (high level): MyBMWQuotaError due to HTTPStatusError: { "statusCode": 429, "message": "Rate limit is exceeded. Try again in 1 seconds." } 10:09:03 – (ERREUR) components/bmw_connected_drive/coordinator.py - message survenu pour la première fois à 07:47:37 et apparu 4 fois. Error fetching bmw_connected_drive-myaccount@gmail.com data: [Errno -3] Try again 10:03:58 – (ERREUR) BMW Connected Drive - message survenu pour la première fois à 07:17:20 et apparu 4 fois. ... 18 min before, I have some WebSocketAPI errors complaining about an invalid OAUTH Access Token. Not sure it is related. ... It starts to go banana here, it seems: Unexpected error fetching bmw_connected_drive-myaccount@gmail.com data: 'capabilities' 09:03:31 – (ERREUR) BMW Connected Drive
Hoping this helps ;-)
Same issue here. I did not check the logs yet but as @Zesstra69 showed in the logs: { "statusCode": 429, "message": "Rate limit is exceeded. Try again in 1 seconds." }
This is BMW side and we can not control this, the only thing i think we can do is update the scan intervals?
SCAN_INTERVALS = { "china": 300, "north_america": 600, "rest_of_world": 300, }
Any idea why north_america is allready at 600s scan interval and europe isnt?
Same here - any idea to fix this issue? Where can i find and update the scan intervals? Maybe it helps
It’s more and more often now. I had to reload the integration 7 times today :-(
Some updates:
You should not need to reload the integration - at least that is the case for me. If an error is thrown, it just works again after 5 minutes (at least from what I can tell from a quick analysis of my logs).
I was able to capture a couple of occurrences of the 429/401 errors happening.
I have not fully understood it yet, my current assumption is as follow:
I did get quite a lot of 419 errors, most of them are handled gracefully as described above. However if this happens at the very moment when we also have to refresh our access token (being served the 401), then the re-logn procedure does not kick in. It needs some further investigation in my logs to confirm this.
Also I have to come up with a solution on how to handle this.
For North America, the polling interval was increased as the 429 Too Many Requests error frequently occured at ~6pm UTC (and reset at 12am), so there was a clear time-box indication which we do not have here.
You can try to disable automatic polling in the integration's system options. Then create an automation running every 10 minutes which calls homeassistant.update_entity
on one of the sensors. That effectively changes your polling time.
I did not have to authenticate again today, it seems to be working a bit more stable for me. I do see that at some points there is a gap of 5 min where I did not have any data.
It indeed looks like at some points it failes to refresh the token and then tries again a few minutes later.
Having same issue in Europe. This: SCAN_INTERVALS = { "china": 300, "north_america": 600, "rest_of_world": 300, } where exactly do I need to update this?
Having same issue in Europe. This: SCAN_INTERVALS = { "china": 300, "north_america": 600, "rest_of_world": 300, } where exactly do I need to update this?
You don't as it is in the HA component code.
Follow this posted 2 comments above:
You can try to disable automatic polling in the integration's system options. Then create an automation running every 10 minutes which calls
homeassistant.update_entity
on one of the sensors. That effectively changes your polling time.
As a general observation from my logs, it seems to work overnight (I did not have any 429 Too Many Requests between 10pm yesterday and ~7am this morning. I'll watch overnight again, but this might actually a BMW server issue.
Thanks, I just set this up now, will see how it goes. This is not consistent, I mean I had this whole HA/BMW setup some weeks ago and didn't have these issues before, but now it seems like daily occurrence. Wonder if they changed something, or it's just too many of us HA/BMW users polling them now.
Anybody tried disabling polling completely during the night to see if that allows for more "quota" during the day, say 5mins updates? By the way, I never had any issues with my BMW App on the phone, maybe it auto-relogs in as needed.
Yes, this is also something you can try using automations.
I do think I have a solution for the 429 > 401 > Reauthentication required issue. However this doesn't solve the general occurrence of the 429 but is just alleviating the issue.
create an automation running every 10 minutes which calls
homeassistant.refresh_entity
on one of the sensors
I don't seem to have a homeassistant.refresh_entity
available
Edit: I think that was supposed to be homeassistant.update_entity - this seem to do the job
try service: homeassistant.update_entity
Yes, that's what i fugured, updated my comment seconds before you posted
Thanks - I updated my post as well.
The problem
Every so often the integration pops up and tells me to reconfigure it. When i do so, i am asked to reauthenticate (user/password/location) and everything is fine again. After a while, the integration won't work anymore and i do have to reconfigute it again.
This happened every two days or so for the last few weeks, but recently i encounter this sometimes twice a day.
Is there something i can do?
What version of Home Assistant Core has the issue?
core-2023.11.3
What was the last working version of Home Assistant Core?
No response
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?
Additional information
No response