bimmer_connected: The BMW Connected Drive portal returned an error: UNKNOWN_ERROR (received status code 410 and expected 200).
Describe the issue
Since today, I got an error “The BMW Connected Drive portal returned an error: UNKNOWN_ERROR (received status code 410 and expected 200).”. The problem seems to be located in account.update_vehicle_states()
.
I have a small python script to test my integration… All worked until around noon… Then it started generating errors.
Below you can find the script I am using for testing and the (debug) log. I also included the urllib debug information…
CODE:
print('\n********* AUTHENTICATION ************************************')
account = ConnectedDriveAccount('fxxxxxxxxxxxe@xxxx.com', 'xxxxxxxxxxxx', get_region_from_name('rest_of_world'))
print('\n********* UPDATE CAR STATUS *********************************')
account.update_vehicle_states()
print('Found {} vehicles: {}'.format(
len(account.vehicles),
','.join([v.name for v in account.vehicles])))
for vehicle in account.vehicles:
print('VIN: {}'.format(vehicle.vin))
print('Mileage: {}'.format(vehicle.state.vehicle_status.mileage))
print('Vehicle properties:')
print(json.dumps(vehicle.attributes, indent=4))
print('Vehicle status:')
print(json.dumps(vehicle.state.vehicle_status.attributes, indent=4))
DEBUG:
********* AUTHENTICATION ************************************
DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.account:Authenticating against GCDM with MyBMW flow.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): customer.bmwgroup.com:443
DEBUG:urllib3.connectionpool:https://customer.bmwgroup.com:443 "POST /gcdm/oauth/authenticate HTTP/1.1" 200 432
DEBUG:bimmer_connected.account:got authorization challenge -xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*
DEBUG:urllib3.connectionpool:https://customer.bmwgroup.com:443 "POST /gcdm/oauth/authenticate HTTP/1.1" 302 0
DEBUG:bimmer_connected.account:got login code xxxxxxxxxxxxxxxxxxxxxxxx
DEBUG:bimmer_connected.account:getting new oauth token
DEBUG:urllib3.connectionpool:https://customer.bmwgroup.com:443 "POST /gcdm/oauth/token HTTP/1.1" 200 1991
DEBUG:bimmer_connected.account:got new token xxxxxxxxxxxxxxxxxxxxxxxx with expiration date 2021-11-09 21:53:55.089716
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.com:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.com:443 "GET /webapi/v1/user/vehicles HTTP/1.1" 200 None
********* UPDATE CAR STATUS *********************************
DEBUG:bimmer_connected.state:requesting new data from connected drive
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.com:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.com:443 "GET /webapi/v1/user/vehicles/WBAJF11030CD97578/status?deviceTime=2021-11-09T20%3A53%3A57&dlat=0.0&dlon=0.0 HTTP/1.1" 410 None
DEBUG:bimmer_connected.account:The BMW Connected Drive portal returned an error: UNKNOWN_ERROR (received status code 410 and expected 200).
DEBUG:bimmer_connected.account:<.........>
DEBUG:bimmer_connected.state:Service STATUS failed
DEBUG:bimmer_connected.state:{'STATUS': {}, 'LAST_TRIP': {}, 'ALL_TRIPS': {}, 'CHARGING_PROFILE': {}, 'DESTINATIONS': {}, 'RANGEMAP': {}, 'EFFICIENCY': {}, 'NAVIGATION': {}}
DEBUG:bimmer_connected.state:received new data from connected drive
Expected behavior
Normally the account.update_vehicle_states()
should return the information as indicated in the code below. However the vehicle_status
is empty with the following error description: DEBUG:bimmer_connected.vehicle_status:No data available for attribute <function VehicleStatus.mileage at 0x7f3d22c305e0>!
print('VIN: {}'.format(vehicle.vin))
print('Mileage: {}'.format(vehicle.state.vehicle_status.mileage))
print('Vehicle properties:')
print(json.dumps(vehicle.attributes, indent=4))
print('Vehicle status:')
print(json.dumps(vehicle.state.vehicle_status.attributes, indent=4))
Which Home Assistant version are you using?
(used outside HA)
What was the last working version of Home Assistant Core?
No response
What is your region?
Rest of world
ConnectedDrive website
- I can still successfully login to the BMW ConnectedDrive website and the car status is available there.
- I have ConnectedDrive enabled for my vehicle.
Number of cars
- I have 2 or more cars linked to the ConnectedDrive account.
- I have a Mini vehicle linked to my account.
Output of bimmer_connected fingerprint
No response
Anything in the logs that might be useful for us?
See above.
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 50 (11 by maintainers)
Good news! I just created beta releases for both the python library (
bimmer_connected==0.8.0b2
) and our custom component (20211113.1
) that should enable My BMW APIs.⚠️ It is still beta and all tests fail, but you should get some data back into Home Assistant.
Please check the release notes of both carefully and let us know if anything doesn’t work. When it is smoothed out a little bit we will create a PR to get it included in HA proper.
A quick update: Thanks for all your contributions, I was able to start working on it. But please be patient for a while, I’ll keep you posted (also with beta versions to try it out).
@rsteininger the “cli” output was an idea however we didn’t get to realise it yet. It’s still planned!
+1, you aren’t the only one. I was trying to understand what is happening as well, likely BMW changed something on their side.
I’m using HA to get the sensors, in HA many entities started reporting “unknown” state today as you mentioned, I tried to remove and re-add the integration, but many entities kept reporting “unknown” and others just weren’t added again at all.
Should work again with 0.8.0.0b9!
Thanks for the report, it should be fixed with
bimmer_connected==0.8.0b5
/custom component 20211114.3.It was an issue with date parsing in Python 3.6 that I didn’t check (and currently all our test still break so no testing against multiple python versions yet).
question to the development team: I understand that you want to try and “restore” the previous functionally of the vehicle status.
However, for me, I could actually live with with the output from “vehicles_v2_0”.
One comment, one question:
Thanks!
@lolouk44 cool! didn’t know! will upload my fingerprint info as well! THANKS
@rsteininger I don’t think anyone is disputing this. The issue is the API structure has changed. So yes you as a human can spot the data being present, but the current code needs to be updated to pick up the data from the right place, hence the request to provide data in https://github.com/bimmerconnected/bimmer_connected/discussions/327 to help identify what is returned for each car type and where it is in the “stream” 😉