BMW ConnectedDrive component

this new app ist there already since a few month. the old one still works as well.
but it seems they are changing from time to time something on their API

I raised a bug at github

Thanks so much for this fantastic component. Here is what I’ve done with it:
Not sure where best to post - BMW Connected Automation - Remind me to lock my car
Hope this might inspire or help others trying to achieve similar things.

Hi there,

Thanks so much for a great component! really useful!
However, last couple of days i am having issues with locking and unlocking the car.
I get an error message and in the log it is prompted:

Logger: homeassistant.components.websocket_api.http.connection.1866835160
Source: components/bmw_connected_drive/lock.py:88
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 22:01:04 (1 occurrences)
Last logged: 22:01:04

‘executionStatus’

Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py”, line 135, in handle_call_service await hass.services.async_call( File “/usr/src/homeassistant/homeassistant/core.py”, line 1448, in async_call task.result() File “/usr/src/homeassistant/homeassistant/core.py”, line 1483, in _execute_service await handler.job.target(service_call) File “/usr/src/homeassistant/homeassistant/helpers/entity_component.py”, line 204, in handle_service await self.hass.helpers.service.entity_service_call( File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 482, in entity_service_call future.result() # pop exception if have File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 664, in async_request_call await coro File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 519, in _handle_entity_call await result File “/usr/src/homeassistant/homeassistant/components/lock/init.py”, line 102, in async_lock await self.hass.async_add_executor_job(ft.partial(self.lock, **kwargs)) File “/usr/local/lib/python3.8/concurrent/futures/thread.py”, line 57, in run result = self.fn(*self.args, **self.kwargs) File “/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/lock.py”, line 88, in lock self._vehicle.remote_services.trigger_remote_door_lock() File “/usr/local/lib/python3.8/site-packages/bimmer_connected/remote_services.py”, line 158, in trigger_remote_door_lock result = self._block_until_done(_Services.REMOTE_DOOR_LOCK) File “/usr/local/lib/python3.8/site-packages/bimmer_connected/remote_services.py”, line 213, in _block_until_done status = self._get_remote_service_status(service) File “/usr/local/lib/python3.8/site-packages/bimmer_connected/remote_services.py”, line 236, in _get_remote_service_status return RemoteServiceStatus(json_result) File “/usr/local/lib/python3.8/site-packages/bimmer_connected/remote_services.py”, line 118, in init status = response[‘executionStatus’] KeyError: ‘executionStatus’

Anyone know why i get this error message and what i should do to solve it?
Also, please be kind to me, i am new to HA :slight_smile:

There is a fix on the way

2 Likes

Thanks! That’s good to hear :grinning:

That’s indeed a known issue which you can track here → KeyError: 'executionStatus' · Issue #223 · bimmerconnected/bimmer_connected · GitHub and also here → BMW Connected Drive gives "KeyError: 'executionStatus'" when locking · Issue #34776 · home-assistant/core · GitHub

1 Like

I just updated home assistant to latest core release, now the component does not even start:

Logger: bimmer_connected.account
Source: /usr/local/lib/python3.8/site-packages/bimmer_connected/account.py:103
First occurred: 7:25:31 (1 occurrences)
Last logged: 7:25:31

The BMW Connected Drive portal returned an error: UNKNOWN_ERROR (received status code 400 and expected 200).
Traceback (most recent call last):
File “/usr/local/lib/python3.8/site-packages/bimmer_connected/account.py”, line 98, in _get_oauth_token
response = self.send_request(url, data=data, headers=headers, allow_redirects=False,
File “/usr/local/lib/python3.8/site-packages/bimmer_connected/account.py”, line 152, in send_request
raise IOError(msg)
OSError: The BMW Connected Drive portal returned an error: UNKNOWN_ERROR (received status code 400 and expected 200).

And also this message in the log:

Logger: homeassistant.setup
Source: components/bmw_connected_drive/init.py:127
First occurred: 7:25:32 (1 occurrences)
Last logged: 7:25:32

Error during setup of component bmw_connected_drive
Traceback (most recent call last):
File “/usr/local/lib/python3.8/site-packages/bimmer_connected/account.py”, line 98, in _get_oauth_token
response = self.send_request(url, data=data, headers=headers, allow_redirects=False,
File “/usr/local/lib/python3.8/site-packages/bimmer_connected/account.py”, line 152, in send_request
raise IOError(msg)
OSError: The BMW Connected Drive portal returned an error: UNKNOWN_ERROR (received status code 400 and expected 200).

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

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/setup.py”, line 213, in _async_setup_component
result = await task
File “/usr/local/lib/python3.8/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/init.py”, line 52, in setup
accounts.append(setup_account(account_config, hass, name))
File “/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/init.py”, line 80, in setup_account
cd_account = BMWConnectedDriveAccount(username, password, region, name, read_only)
File “/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/init.py”, line 127, in init
self.account = ConnectedDriveAccount(username, password, region)
File “/usr/local/lib/python3.8/site-packages/bimmer_connected/account.py”, line 61, in init
self._get_vehicles()
File “/usr/local/lib/python3.8/site-packages/bimmer_connected/account.py”, line 214, in _get_vehicles
self._get_oauth_token()
File “/usr/local/lib/python3.8/site-packages/bimmer_connected/account.py”, line 104, in _get_oauth_token
raise OSError(msg) from exception
OSError: Authentication failed. Maybe your password is invalid?

As far as i could see this seems to have a fix on it’s way as well? Once again, sorry if this is obvious, but I’m new to this :slight_smile:

This is indeed fixed and will be part of HA 0.118 which will release 18 November.

4 Likes

Wonderful! fantastic support and response rate! you guys are fantastic!

Great news, I have the same issue, I was on 0.115 and i tried to send the pre-heating command last night and it didnt work, saw it was updated in 0.117 so updated and then it completely broke.

Thanks much for fixing this so quickly, watching out for the release today!

@gerard33 thank you!

Thanks @gerard33 I can confirm that 0.118 fixed the authentication issue :slight_smile:

Hey - weird (to me) behaviour. I’m new to Home Assistant, so I apologise if the answer is obvious.

I’ve installed this component and MOST of the data is there for our 2016 model BMW i3 (United Kingdom).

However, the charging status binary sensor is not pulling charging status through. Is there something I can prod or look at to get more info?
image
Thanks,
CT

Ooops. Obvious idiocy on my part. Looking at the wrong badge.

Sorry!

trying to take advantage of the device_tracker for my car, trying to run some automations when arriving home in my car.
However, i suffer from delays in change of state from not_home to home.
How frequent does the state update? can i change the update frequency? or should i just forget trying to make automations with the car device_tracker?

I suspect this will be due to tracking not working while the car is in motion. I knew that the BMW app does not allow tracking with the vehicle in motion, and I tested at the weekend (while someone else was driving my car!) that HA does not track either. I would assume this would cause the delay in using the car as a tracker for automations.

Somebody probably forgot to tell that to my car because location updates about every 5 minutes for me, even in motion. :laughing:

1 Like

hello,
im new to home assistant so please don’t be mad at me :wink:

i just finished to integrate my i3 to homeassistant via the integration ui.
my config is also in my configuration.yaml

so how im gona call the air condition via the lovance dashboard?
i read all the threads about the i3 but i don’t get how i can add a service call to the loveance dashboard?

maybe someone can assist me.

Best regards

Anybody else having issues with this today? My car is still at home apparently, even though I can see it in the work car park.

Distance and fuel level updated after I got home yesterday, but not after the journey in to work this morning. Seems to be an issue with the App and website too at the moment, so just wondering is it a global issue, or a local issue.

I just restarted my HomeAssistant and now the integration is not working anymore. Seems the same problem

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 316, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 531, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 323, in _async_write_ha_state
    attr.update(self.device_state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/lock.py", line 61, in device_state_attributes
    result["door_lock_state"] = vehicle_state.door_lock_state.value
AttributeError: 'NoneType' object has no attribute 'value'
1 Like