BMW ConnectedDrive component

So I will apologize in advance if I am doing something wrong but I am running hassio 0.64.3 and I cannot for the life of me get the BMW connected component to work. Basically if I have the configuration in this format:

bmw_connected_drive:
name:
username: xxxxx
password: xxxxx
country: USA

Then I can check the configuration and restart homeassistant just fine but I get an “invalid config” “The following components and platforms could not be set up:” “bmw-connected-drive” “please check your config”

Looking through this thread it seems like I should remove the “name:” line from my config file possibly? If I do that I cannot restart homeassistant and I cannot successfully check the configuration.

I’m not sure what else to do? Any assistance would be greatly appreciated!

This is not working for USA and Canada yet due to a different login method on the BMW ConnectedDrive site for these countries. Christian is working on a method for Canada which is currently tested by coolTNT. So hopefully this is something that can be added.

ignore this post :smiley:
Reading the post BMW ConnectedDrive component helped :wink:

I believe our method might work for USA too, once we figure it out…

The Canadian API URLs end with .us , so I think they might be for USA as well.

@coolTNT

I just implemented a very basic script with all the ingredients I’ve understood from your data so far. You can run it with basic_canada.py <username> <password>. This script does not depend on any other libraries, so you can tweak it and fiddle around until it works. No need to worry about the architecture and other countries.

There is also a basic_germany.py which is working for my account. So you can also have a look there to get some inspiration.

The script will basically retrieve the token and the get the list of vehicles in your account form the server.

If you can make that script work, I can then try to integrate it with the existing code.

https://github.com/ChristianKuehnel/bimmer_connected/blob/canada/basic_canada.py

its a bug in the documentation, see:

Hey @ChristianKuehnel , I’ve managed to get basic_canada.py to return the vehicle information from my account, and I’ve created a pull request on GitHub with my changes. (I’m lawtancool on GitHub :slight_smile: )

I’m not super familiar with how GitHub works, so apologies if I didn’t do it right…

1 Like

maybe someone can help me and tell me what the error messages mean.
i’m running hass 0.64.3 and tried the custom_component.

all i can see is DOOR and WINDOW state, which both show as closed.

here’s the excerpt of my log:

2018-03-06 12:43:58 ERROR (Recorder) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/bmw_connected_drive.py", line 98, in update
    listener()
  File "/home/homeassistant/.homeassistant/custom_components/binary_sensor/bmw_connected_drive.py", line 105, in update
    self._state = bool(vehicle_state.door_lock_state.value
  File "/srv/homeassistant/lib/python3.5/site-packages/bimmer_connected/state.py", line 196, in door_lock_state
    return LockState(self._attributes['door_lock_state'])
KeyError: 'door_lock_state'



2018-03-06 12:28:57 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
    result = coro.throw(exc)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 266, in _async_add_entity
    yield from entity.async_added_to_hass()
  File "/home/homeassistant/.homeassistant/custom_components/lock/bmw_connected_drive.py", line 108, in async_added_to_hass
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/lock/bmw_connected_drive.py", line 96, in update
    self._state = (STATE_LOCKED if vehicle_state.door_lock_state.value
  File "/srv/homeassistant/lib/python3.5/site-packages/bimmer_connected/state.py", line 196, in door_lock_state
    return LockState(self._attributes['door_lock_state'])
KeyError: 'door_lock_state'

and then i get a lot of these every 30s:

2018-03-06 12:28:56 ERROR (MainThread) [bimmer_connected.state] No data available!
2018-03-06 12:28:56 ERROR (MainThread) [bimmer_connected.state] No data available!
2018-03-06 12:28:56 ERROR (MainThread) [bimmer_connected.state] No data available!
2018-03-06 12:28:56 ERROR (MainThread) [bimmer_connected.state] No data available!
2018-03-06 12:28:56 ERROR (MainThread) [bimmer_connected.state] No data available!
2018-03-06 12:28:56 ERROR (MainThread) [bimmer_connected.state] No data available!
2018-03-06 12:28:56 ERROR (MainThread) [bimmer_connected.state] No data available!
2018-03-06 12:28:56 ERROR (MainThread) [bimmer_connected.state] No data available!
2018-03-06 12:28:56 ERROR (MainThread) [bimmer_connected.state] No data available!

edit: i just realised i got that info as well:

image

image

edit2: i tried “switching” the horn, and it showed up in my “bmw app’s log”. :slight_smile:

i checked the data receveived for accuracy, and unfortunately i have no idea where the data comes from (or from what time/date).
the actual mileage is 65tkm not 58tkm as shown.
the remaining gas is around 20%, so for sure not 65l which would be about FULL.
also doors/windows status i not updated. i left the door unlocked with open windows for 20min, but they stayed “locked” all the time.
what DOES work though is active control of horn/light and climate which imho is much more important for me, but still …

Hi @iz3man please check the post below to see if you have a compatible version of the iDrive software.
Based on your mileage I guess your version is a bit too old and thus will not show actual data :neutral_face:

Regarding the custom component, can you check if you are using the latest version which uses the v0.4.1 of the library and which should handle these errors correctly.

Thanks gerard33. I remember that issue. I once asked how to find out the idrive version, but can’t remember that i ever saw an answer.
The car is a 5er 2016 model. Latest software if that helps.

Tried this today having upgraded to 0.65 and it’s great :slight_smile: I’ve got location, mileage, fuel level and range (2016 340i in the UK).

Looking forward to having the lock status etc. but will wait for that stuff to be official so I don’t need to mess with custom stuff.

Anyone know how to change the fuel level units from mpg to L?

What ID version do you have? I have a UK 440 2016 and only have ID4 which doesn’t seem to work. Thanks

I think this shows ID4 on the left and ID5 on the right. If so, mine’s ID5.

imho left one is NBT and right one is NBT-EVO - whereas the right one is the newer one.
the new 5er is equipped with NBT-EVO, the last model F10/11 was NBT.

made sure to use latest version - dl’d from github, installed in HA, restarted. still the same.
log is flooded with “no data” messages.

it’s got this line in bmw_connected_drive.py :slight_smile:

REQUIREMENTS = ['bimmer_connected==0.4.1']

Mar 11 16:02:54 hassbian hass[23018]: #033[31m2018-03-11 16:02:54 ERROR (MainThread) [bimmer_connected.state] No data available!#033[0m
Mar 11 16:03:25 hassbian hass[23018]: #033[31m2018-03-11 16:03:25 ERROR (MainThread) [bimmer_connected.state] No data available!#033[0m
Mar 11 16:03:25 hassbian hass[23018]: #033[31m2018-03-11 16:03:25 ERROR (MainThread) [bimmer_connected.state] No data available!#033[0m
Mar 11 16:03:25 hassbian hass[23018]: #033[31m2018-03-11 16:03:25 ERROR (MainThread) [bimmer_connected.state] No data available!#033[0m
Mar 11 16:03:25 hassbian hass[23018]: #033[31m2018-03-11 16:03:25 ERROR (MainThread) [bimmer_connected.state] No data available!#033[0m
Mar 11 16:03:25 hassbian hass[23018]: #033[31m2018-03-11 16:03:25 ERROR (MainThread) [bimmer_connected.state] No data available!#033[0m
Mar 11 16:03:25 hassbian hass[23018]: #033[31m2018-03-11 16:03:25 ERROR (MainThread) [bimmer_connected.state] No data available!#033[0m
Mar 11 16:03:56 hassbian hass[23018]: #033[31m2018-03-11 16:03:56 ERROR (MainThread) [bimmer_connected.state] No data available!#033[0m
Mar 11 16:03:56 hassbian hass[23018]: #033[31m2018-03-11 16:03:56 ERROR (MainThread) [bimmer_connected.state] No data available!#033[0m
Mar 11 16:03:56 hassbian hass[23018]: #033[31m2018-03-11 16:03:56 ERROR (MainThread) [bimmer_connected.state] No data available!#033[0m
Mar 11 16:03:56 hassbian hass[23018]: #033[31m2018-03-11 16:03:56 ERROR (MainThread) [bimmer_connected.state] No data available!#033[0m
Mar 11 16:03:56 hassbian hass[23018]: #033[31m2018-03-11 16:03:56 ERROR (MainThread) [bimmer_connected.state] No data available!#033[0m
Mar 11 16:03:56 hassbian hass[23018]: #033[31m2018-03-11 16:03:56 ERROR (MainThread) [bimmer_connected.state] No data available!#033[0m

Has anyone got this working in Sweden?

Yes works perfectly for me

The data available from the vehicle is in km and liter, it’s a german company after all :smile: . If you want to have different units, this would have to be converted somewhere. There is a central switch unit_system to see if the user wants metric or imperial units: Setup basic information - Home Assistant But is does not actually convert anything. It just says what you would like to have.

So someone has to write an patch of the sensors to check this switch and convert the units if required…

Request for data:
Does anyone have a vehicle with active check control messages? We would be happy for data contributions so that we can implement parsing of these messages: