BMW ConnectedDrive component

The car is an i3 with a range extender. Following is the result of the script:

DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.account:getting new oauth token
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 “POST /gcdm/oauth/token HTTP/1.1” 200 None
DEBUG:bimmer_connected.account:got new token WyysACLabkGZk9iuF9wu1ddqwUNk2RB5 with expiration date 2019-02-07 20:01:16.308471
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 “GET /webapi/v1/user/vehicles HTTP/1.1” 200 None
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.us:443
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.us:443 “GET /webapi/v1/user/vehicles/WBY7Z4C55JVD96760/status?deviceTime=2019-02-07T19%3A01%3A20&dlat=0.0&dlon=0.0 HTTP/1.1” 200 None
DEBUG:bimmer_connected.state:received new data from connected drive
fingerprint of the vehicles written to /usr/bin/vehicle_fingerprint/2019-02-07_19-01-15

Forgot to include the fingerprint files:

status_0.txt

{
“vehicleStatus”: {
“DCS_CCH_Activation”: “NA”,
“DCS_CCH_Ongoing”: false,
“cbsData”: [
{
“cbsDescription”: “Next change due when the stated distance has been covered or by the specified date.”,
“cbsDueDate”: “2019-08”,
“cbsState”: “OK”,
“cbsType”: “OIL”
},
{
“cbsDescription”: “Next change due at the latest by the stated date.”,
“cbsDueDate”: “2020-07”,
“cbsState”: “OK”,
“cbsType”: “BRAKE_FLUID”
},
{
“cbsDescription”: “Next visual inspection due when the stated distance has been covered or by the stated date.”,
“cbsDueDate”: “2020-07”,
“cbsState”: “OK”,
“cbsType”: “VEHICLE_CHECK”
}
],
“chargingConnectionType”: “CONDUCTIVE”,
“chargingInductivePositioning”: “NOT_POSITIONED”,
“chargingLevelHv”: 88,
“chargingStatus”: “NOT_CHARGING”,
“checkControlMessages”: ,
“connectionStatus”: “CONNECTED”,
“doorDriverFront”: “CLOSED”,
“doorDriverRear”: “CLOSED”,
“doorLockState”: “SELECTIVE_LOCKED”,
“doorPassengerFront”: “CLOSED”,
“doorPassengerRear”: “CLOSED”,
“hood”: “CLOSED”,
“internalDataTimeUTC”: “2019-02-08T02:07:28”,
“lastChargingEndReason”: “UNKNOWN”,
“lastChargingEndResult”: “UNKNOWN”,
“maxRangeElectric”: 122,
“maxRangeElectricMls”: 75,
“mileage”: 4313,
“parkingLight”: “OFF”,
“position”: {
“status”: “DRIVER_DISABLED”
},
“positionLight”: “OFF”,
“remainingFuel”: 8,
“remainingRangeElectric”: 104,
“remainingRangeElectricMls”: 64,
“remainingRangeFuel”: 60,
“remainingRangeFuelMls”: 37,
“singleImmediateCharging”: false,
“sunroof”: “CLOSED”,
“trunk”: “CLOSED”,
“updateReason”: “VEHICLE_SHUTDOWN”,
“updateTime”: “2019-02-07T21:07:28-0500”,
“vehicleCountry”: “US”,
“vin”: “some_vin”,
“windowDriverFront”: “CLOSED”,
“windowPassengerFront”: “CLOSED”
}
}

vehicles_0.txt

{
“vehicles”: [
{
“a4a”: “USB_ONLY”,
“bodytype”: “I01”,
“brand”: “BMW_I”,
“breakdownNumber”: “+4989356955109”,
“carCloud”: “ACTIVATED”,
“chargeNow”: “NOT_SUPPORTED”,
“chargingControl”: “WEEKLY_PLANNER”,
“chargingUpdateMode”: “NORMAL_PROGNOSE_BASED”,
“climateControl”: “NOT_SUPPORTED”,
“climateControlRES”: “NOT_SUPPORTED”,
“climateFunction”: “AIRCONDITIONING”,
“climateNow”: “ACTIVATED”,
“climateNowRES”: “NOT_SUPPORTED”,
“color”: “FLUID BLACK MIT AKZENT BMW I BLAU”,
“colorCode”: “C2W”,
“countryCode”: “V2-US”,
“dealer”: {
“city”: “San Francisco”,
“country”: “US”,
“name”: “BMW of San Francisco”,
“phone”: “+1 415 8639000”,
“postalCode”: “94103”,
“street”: “1675 Howard St”
},
“doorLock”: “ACTIVATED”,
“doorUnlock”: “ACTIVATED”,
“driveTrain”: “BEV_REX”,
“hasAlarmSystem”: true,
“hmiVersion”: “ID5”,
“hornBlow”: “ACTIVATED”,
“hub”: “HUB_US”,
“intermodalRouting”: “AVAILABLE”,
“ipa”: “NOT_SUPPORTED”,
“lastDestinations”: “SUPPORTED”,
“lightFlash”: “ACTIVATED”,
“lscType”: “I_LSC_IMM”,
“model”: “i3 94 REX”,
“onlineSearchMode”: “MAP”,
“rangeMap”: “RANGE_POLYGON”,
“remote360”: “NOT_SUPPORTED”,
“remoteSoftwareUpgrade”: “NOT_SUPPORTED”,
“sendPoi”: “ACTIVATED”,
“smartSolution”: “NOT_SUPPORTED”,
“statisticsAvailable”: true,
“statisticsCommunityEnabled”: false,
“steering”: “LH”,
“supportedChargingModes”: [
“AC_LOW”,
“AC_HIGH”,
“DC”
],
“vehicleFinder”: “DRIVER_DISABLED”,
“vin”: “some_vin”,
“yearOfConstruction”: 2018
}
]
}

I’m still hoping to find a fix for this. Possible?

The output from the script looks good. When looking at the error log, it seems you have an old version of the bmw connected drive component. Which HA version are you on?

The BMW Connected Drive component also works if you have a recent Mini vehicle :oncoming_automobile:

Check this post for more info.

can anyone help with this? I would really like to be able to integrate both of my X5s into HA (see previous post for full details)

Jan 30 18:15:48 peon hass[32033]: 2019-01-30 18:15:48 ERROR (SyncWorker_5) 
[bimmer_connected.account] Unknown status code 404, expected 200
Jan 30 18:15:48 peon hass[32033]: 2019-01-30 18:15:48 ERROR (SyncWorker_5) 
[bimmer_connected.account] { 
Jan 30 18:15:48 peon hass[32033]:   "error" : {
Jan 30 18:15:48 peon hass[32033]:     "code" : 500,
Jan 30 18:15:48 peon hass[32033]:     "description" : "(SmartPhoneUtil-A-2012) Ressource not 
found. No status available for VIN <removed VIN for which is the correct vin>"
Jan 30 18:15:48 peon hass[32033]:   }
Jan 30 18:15:48 peon hass[32033]: }
Jan 30 18:15:48 peon hass[32033]: 2019-01-30 18:15:48 ERROR (SyncWorker_5) 
[homeassistant.components.bmw_connected_drive] Error updating the vehicle state.
Jan 30 18:15:48 peon hass[32033]: 2019-01-30 18:15:48 ERROR (SyncWorker_5) 
[homeassistant.components.bmw_connected_drive] Unknown status code 404, expected 200
Jan 30 18:15:48 peon hass[32033]: Traceback (most recent call last):
Jan 30 18:15:48 peon hass[32033]:   File "/opt/homeassistant/lib64/python3.7/site  - 
packages/homeassistant/components/bmw_connected_drive/__init__.py", line 151, in update
Jan 30 18:15:48 peon hass[32033]:     self.account.update_vehicle_states()
Jan 30 18:15:48 peon hass[32033]:   File "/opt/homeassistant/lib64/python3.7/site- 
packages/bimmer_connected/account.py", line 213, in update_vehicle_states
Jan 30 18:15:48 peon hass[32033]:     car.update_state()
Jan 30 18:15:48 peon hass[32033]:   File "/opt/homeassistant/lib64/python3.7/site- 
packages/bimmer_connected/vehicle.py", line 72, in update_state
Jan 30 18:15:48 peon hass[32033]:     self.state.update_data()
Jan 30 18:15:48 peon hass[32033]:   File "/opt/homeassistant/lib64/python3.7/site- 
packages/bimmer_connected/state.py", line 99, in update_data
Jan 30 18:15:48 peon hass[32033]:     params=params)
Jan 30 18:15:48 peon hass[32033]:   File "/opt/homeassistant/lib64/python3.7/site- 
packages/bimmer_connected/account.py", line 134, in send_request
Jan 30 18:15:48 peon hass[32033]:     raise IOError(msg)
Jan 30 18:15:48 peon hass[32033]: OSError: Unknown status code 404, expected 200

Can you share your config? And does it work when you only define 1 car in the config file?

This is my configuration.yaml

bmw_connected_drive:
  white:
    username: !secret bmw_login
    password: !secret bmw_passwd
    region: "north_america"

I have two cars on my bmw connected account and they both work just fine (though the bmw app), I tried to open another BMW connected account with a different email address and add just one car into that account but BMW wouldn’t let me do that.

Hi, I just bought a new BMW and I have already setup the BMW car component. However, the links for components sites: binary_sensors, presence detection, lock and sensor are all redirecting to the car component site and thus I cannot get to know the components correct parameters to set. There there’s only info about the services. Could someone post an example of configuration for these components or just a working link to their sites? Thanks!

Never mind, I’ve checked all sensors generated and it’s impressive all the info you can get from a new BMW using the BMW car component, thanks!!

Hi, there’s a lot info inside this component. I mean for my car I’ve got:
6 binary_sensors
1 device_tracker
1 lock
4 sensors
And each of them have several attributes that will be interesting to get displayed (i.e. each of the 4 doors or each of the 4 windows states).
Is there an easy way to display in lovelace each of these attributes of each sensor, withouth having to create a new separate sensor using template->sensor-> states.XXX.attributes.XXX for each of the attributes??
I will like to know how you have implented/displayed this. Thanks!!

You can use this https://github.com/ciotlosm/custom-lovelace/tree/master/entity-attributes-card to show the attributes.
The binary_sensor of the door and window will alert you however if a door or window is open. In that case you can also open the device to see which attribute it is.

1 Like

Has anybody seen the component stop working sometime perhaps between yesterday, March 27 and today March 28? Sensors are no longer working, can’t honk horn, can’t flash lights or lock doors anymore . . .

I think it may be the underlying bimmer_connected python library, since I’ve also tried running the sample script from GitHub - bimmerconnected/bimmer_connected: 🚘 Library to query the status of your BMW or Mini from the ConnectedDrive portal and I’m getting I/O errors. (This had been working from terminal on my desktop and phone.)

I checked the connecteddrive.bmwusa.com website, and can still log in, so the USA server is still up.

Here’s the error log. For the record, the password hasn’t changed and still works on the web portal.

Thu Mar 28 2019 09:54:38 GMT-0500 (Central Daylight Time)
Authentication failed. Maybe your password is invalid?
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/bimmer_connected/account.py”, line 89, in _get_oauth_token
expected_response=200, post=True)
File “/usr/local/lib/python3.7/site-packages/bimmer_connected/account.py”, line 134, in send_request
raise IOError(msg)
OSError: Unknown status code 500, expected 200

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

Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/bmw_connected_drive/init.py”, line 144, in update
self.account.update_vehicle_states()
File “/usr/local/lib/python3.7/site-packages/bimmer_connected/account.py”, line 213, in update_vehicle_states
car.update_state()
File “/usr/local/lib/python3.7/site-packages/bimmer_connected/vehicle.py”, line 72, in update_state
self.state.update_data()
File “/usr/local/lib/python3.7/site-packages/bimmer_connected/state.py”, line 99, in update_data
params=params)
File “/usr/local/lib/python3.7/site-packages/bimmer_connected/account.py”, line 123, in send_request
headers = self.request_header
File “/usr/local/lib/python3.7/site-packages/bimmer_connected/account.py”, line 107, in request_header
self._get_oauth_token()
File “/usr/local/lib/python3.7/site-packages/bimmer_connected/account.py”, line 94, in _get_oauth_token
raise OSError(msg) from exception
OSError: Authentication failed. Maybe your password is invalid?

Yes I am also having this same problem. Sometime last night on the 27th I suddenly am getting authentication failures. I am getting a status code 400 though and the same suggestion that password is invalid. I logged it and changed my password a few times and still can’t get it to connect.

Error during setup of component bmw_connected_drive
Traceback (most recent call last):
File “/home/anhman/.homeassistant/deps/lib/python3.6/site-packages/bimmer_connected/account.py”, line 89, in _get_oauth_token
expected_response=200, post=True)
File “/home/anhman/.homeassistant/deps/lib/python3.6/site-packages/bimmer_connected/account.py”, line 134, in send_request
raise IOError(msg)
OSError: Unknown status code 400, expected 200

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

Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/setup.py”, line 154, in _async_setup_component
component.setup, hass, processed_config) # type: ignore
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/bmw_connected_drive/init.py”, line 56, in setup
accounts.append(setup_account(account_config, hass, name))
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/bmw_connected_drive/init.py”, line 86, in setup_account
username, password, region, name, read_only)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/bmw_connected_drive/init.py”, line 131, in init
self.account = ConnectedDriveAccount(username, password, region)
File “/home/anhman/.homeassistant/deps/lib/python3.6/site-packages/bimmer_connected/account.py”, line 55, in init
self._get_vehicles()
File “/home/anhman/.homeassistant/deps/lib/python3.6/site-packages/bimmer_connected/account.py”, line 188, in _get_vehicles
self._get_oauth_token()
File “/home/anhman/.homeassistant/deps/lib/python3.6/site-packages/bimmer_connected/account.py”, line 94, in _get_oauth_token
raise OSError(msg) from exception
OSError: Authentication failed. Maybe your password is invalid?

rafale77, are you using the component in North America, or one of the other two regions BMW divides the world into?

I think this may be something BMW has changed with the connected drive server, so I’ve added an issue on github for the bimmer_connected library that HA uses.

I am using the component in North America. I’ve been going nuts trying to find out whether I inadvertently changed something in my setup and even went to a backup of my VM with no success.

Yes, it stopped working for me too, and I’m sure I didn’t change anything because I was traveling.

I’m home now and the device_tracker still thinks the car is at the airport.

(Also North America)

I have had the same issue in the same time frame. No updates to HASS itself or my config. Must be a problem on BMW’s end. I’ve now had to change my password for BMW Connected Drive, as an unfortunate side effect is that HASS seems to be locking out my account.

Anyone know another way to ping m1n3rva? Haven’t seen any responses from him/her here or at github. Sure hope they haven’t abandoned the project.

Looks like the developer/maintainer is MIA. Does that mean that if the community can fix the issue, that the component (and the library at github) needs to be forked for North American users? And if we can’t it’s the end of the road?

1 Like