BMW ConnectedDrive component

I am pretty sure @m1n3rva is still available for the project. I understand it’s annoying the component doesn’t work anymore for US users, but the issue is 8 days old. So let’s wait a bit more.

It’s always possible by the way to fork the library on Github and make a fix if someone knows what needs to be changed. That version can either be used in a custom component or be released on PyPi after which a PR to HA can be made.

1 Like

Just updated my homeassistant and now I’m getting “invalid config” for this component. All sensors gone.

I’m in Europe. Seems like the update in HA caused the issue as it was working fine until I updated.

I’m seeing the same thing now (component not found) in North America, and I haven’t yet done the update. It may not be the change to HA, but rather BMW server changes spreading to other regions . . .

edit: BTW jitmonlee, have you already checked your home-assistant.log for clues?

1 Like

Any solution to this? Same problem here.

Problem solved for me with version 0.91.2

1 Like

I don’t see anything in the changelog for this version . . . where are you using the component?

Subbing, same problem here. My Z-Wave stick stopped working with 91.0 so I had to downgrade which has caused several other issues. This issue started before that fiasco, I’m not ready to try 91.2 yet but I would be happy to know/confirm this issue has been fixed with 91.2. I also don’t see anything in the notes.

Oooooooookaaaaaaaaay. It just started working for me again. I didn’t change anything.

12:38pm (US) Eastern Daylight Time it suddenly decided I’m no longer at the airport and I was at work.

Hi,

This could be one of the coolest components in my setup, but unfortunately I’m just not able to get it work:(

I have an i3 REX, I’m in Europe. Services work like charm using the ios connected drive app and of course they work if I’m using the BMW website. (I cannot see any charging etc info though.)

After enabling the component in the configuration.yaml

bmw_connected_drive:
  i3:
    username: !secret bmwusr
    password: !secret bmwpwd
    region: "rest_of_world" 

I see the following errors:

Sat Apr 20 2019 20:56:26 GMT+0200 (Central European Summer Time)
bmw_connected_drive: Error on device update!
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
await entity.async_device_update(warning=False)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 348, in async_device_update
await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/bmw_connected_drive/binary_sensor.py", line 163, in update
self._state = vehicle_state.has_check_control_messages
  File "/usr/local/lib/python3.7/site-packages/bimmer_connected/state.py", line 71, in _func_wrapper
return func(self, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/bimmer_connected/state.py", line 326, in has_check_control_messages
return len(self.check_control_messages) > 0
TypeError: object of type 'NoneType' has no len()

I’m on HASS.IO, ver 0.89.2

Thanks,
Ben

Update your Home Assistant and it will work. You’re on an old version.

Thx, I did.
Services are working now, but I’m still getting errors: it seems that none of the sensors are working.
Since I don’t have any info at the connected drive site either, I guess something is wrong with the service @BMW.

Is there a way to somehow get rid of these error messages?

2019-04-21 01:28:23 ERROR (MainThread) [homeassistant.components.sensor] bmw_connected_drive: Error on device update!
Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 261, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 379, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/bmw_connected_drive/sensor.py", line 147, in update
self._state = getattr(vehicle_state, self._attribute)
File "/usr/local/lib/python3.7/site-packages/bimmer_connected/state.py", line 264, in __getattr__
return self._attributes[item]
KeyError: 'lastChargingEndReason'

I’m getting similar errors from the homeassistant.components.binary_sensor and the homeassistant.components.core components, too. I think the reason is, that I’m having some errors on BMW side and the bmw_connected_drive component somehow handles that in a wrong way and causing HA components to throw errors?

Thanks
Ben

I think that the only way to eliminate this sort of error is to get the server to respond properly, i.e., as expected by the code. If the BMW server isn’t supplying the json data that the underlying library is looking for (like in that getattr call), then it’s gonna throw an error that the specified attribute can’t be found – e.g. ‘lastChargingReason’ in your snippet. So the error is real . . . maybe the bimmer_connected library code could be improved to make sure that the json dump it’s getting isn’t empty or obviously corrupt data before trying to extract the wanted attributes – then it might throw a “bad data” error instead of “getting attribute” error. But even then, if the problem is on the server side as you suspect, some kind of error is appropriate because something isn’t working as expected.

Did you ever get it working? It is weird that you aren’t getting the last charging Reason attribute. Are any sensors showing up in HA? Back when HA became more strict about the way that entities were named I had to fix the BMW component so that it wouldn’t add entities with double underscore. It was replacing spaces and parenthesis with underscore and the name of the car came back from BMW as i3 (REX) which made it into HA as i3__REX_. I don’t know if this was fixed in the component or if it is still necessary.

In fact I find that the HA component is more reliable and easier to work with then the app. I love that I can automate it and have a quite a few things in Node red that deal with the car. Let me know if you want me to share more.

No, not yet.
It turned out that for some reason BMW is not providing the same info in my country than in the US: https://github.com/m1n3rva/bimmer_connected/issues/102#issuecomment-486029141

Services are working, but I had to disable the component, because of the hundreds of errors in the log.

It would be a great feature to be able to configure the HA component, and customize the list of used services and sensors through configuration.yaml.

That’s a good point: it would be nice to be able to show the sensors that each user was most interested in. I’ve got more sensors showing for my i3 than I have for all other devices combined! Quite a few are redundant (at least for my purposes), and others aren’t things I really need to monitor frequently if at all.

I notice that the connecteddrive maxFuel sensor doesn’t have a unit of measurement assigned – there’s no little label at the bottom of the circle like other numeric sensors do.

I also notice that it’s returning a value of 8. Now at integer precision, my i3 has a fuel capacity of 2 gallons – so that 8 is 8 liters.

So the component should report units for the maxFuel sensor and perform unit conversion when appropriate.

OK, it’s been a month and a half since I wondered if m1n3rva was still active and available for the bimmer_connected library which this component relies on. Has anyone heard from him/her in the meantime? Of course anyone can lose interest in a project or just become so swamped with paid work or personal issues that they just have to lay back for a while. That’s perfectly understandable. But does anyone else have the keys to the project? I’ve submitted a fix for the OPEN_TILT bug but with no one to accept the pull request nothing happens, right?

Figured this out. Turns out my 2016 X5 unlike my 2014 had an option in iDrive to enable / disable GPS tracking. If GPS Tracking is Disabled you will get the above error.

Not that it matters, but I think that sensor ‘charging_level_hv’ should have units “%” . . . since it’s a percentage of full charge. It would also make it easier to pick it out in the veritable garden of blooming sensors.