BMW ConnectedDrive component

The requirements line in manifest.json has exactly to be like in my post above:
bimmer-connected-drive==0.5.6

In your post you refer to your Github url, but that must not be used as we saw earlier that that doesn’t work.

I haven’t updated the bimmerconnected Github yet, your PR is not yet merged, so it’s correct that the new Lidstate is not there. There is even no version 0.5.6 available there yet. So the download you made showed the current version, which is without the new LidState value.

But that new value is in in the version from your Github and that’s the one I have uploaded to PyPi. As you can see in my screenshot in the post above that new value is correctly loaded. I will place all my custom_component files on Github this evening (CEST), so you can use these and that should definitely work. Will send you a PM when the files are available, so we don’t “pollute” this topic too much :wink:

Edit: @roborob I have sent you a PM with the link to the files on Github.

I have a 2013 X320d. I have no values for milage, Remaining fuel and Remaining range fuel in HA. I think this is because of the age of my car. The younger X320d of my father has these values in his iPhone App - I cannot see them in my app.
Unfortunately I do not have Horn, Lights and Climate (last one would be the one I need) in HA. But I do have these options in my iPhone-App. Any chance to get it working in HA? Especially climat would be interesting because of the heater (Standheizung) I have, which than could be triggered via logic … :slight_smile:

Have you checked if you have bmw_connected_drive.activate_air_conditioning under Developer Tools-Services in HA. Because these are added as a service, not as an entity.

If these are not available, you can run the fingerprint option. If that shows something like "climateNow" : "ACTIVATED", it should work.

If you are comfortable with it, you can make a PR on the Bimmerconnected Github to share the results of the fingerprint. That can be used for future development. All personal data is removed already, but please double check that.

Otherwise you can also share the results in a post here or PM them to me.

1 Like

Hi Gerald,
thanks for your quick reply. I did had a look. I have these results:
Binary Sensors:
binary_sensor.x3_xdrive20d_lids
binary_sensor.x3_xdrive20d_windows
But I do not know whether they really work. Does lid means open/closed? Can I integrate it to open my car? And what about the windows? In my iPhone app I do not have this option…

Than I have a new group with one member:
group.all_locks entity_id: lock.x3_xdrive20d_lock
What is this about? Can I use this top open/close the car?

At least I have these sensors. But due to the age of my car (2013) they are not supported afaik. In my Dad´s car (X3 from 2015), I can see values in his iPhone App.
sensor.x3_xdrive20d_mileage - unknown
sensor.x3_xdrive20d_remaining_fuel - unknown
sensor.x3_xdrive20d_remaining_range_fuel - unknown
sensor.x3_xdrive20d_remaining_range_total -0

Regarding climate I was not able to find any result. I will run the fingerprint option. Is it correct, that I have to log on to my Intel NUC (on which is running hass.io) via putty and then have to install a tool typing this:
pip3 install --upgrade bimmer_connected
and then run the tool with
bimmerconnected fingerprint
How do I get the result? Is it displayed in the console so that I can copy it?
Thanks for your support!

The binary sensors show if a lid or window is open or closed. The attributes of that sensor (click on it to see the attributes) show more details. Also check the documentation → BMW Connected Drive - Home Assistant

Did you check the climate service under Developer Tools - Services like I mentioned above?
And you can indeed run the script in via Putty in Hassio. You have to use this addon to be able to do that.
And how you can get the results is mentioned on the fingerprint page :slight_smile:

This will create a set of log files in the “vehicle_fingerprint” folder.

1 Like

Hi gerald, I got you wrong. Now I had a look at the “services”. I have running the German Gui so I have different names in the menue bar. And you are right. I do have:
bmw_connected_drive.activate_air_conditioning
bmw_connected_drive.light_flash
bmw_connected_drive.sound_horn
bmw_connected_drive.update_state
:slight_smile:
But the states - also the one for lids and windows - are not supported for such an old cars mine.
I am new to HA and so far had no experience with services. I will now read a bit to get more familiar with this and how to use. My idea: On working days (Monday-Friday) start heating at 7:15 a.m. if tempreatur outside (I have a sensor therefor) is less than 5°C.
I like this forum and am very happy with so much feedback that is given to everyone!

Hi Gerad, since yesterday evening - when I uprgraded to 97.1 - the component does not work anymore. I made a few restarts. Everything else is working fine. Only connected drive is not available. Or is there an issue on server side?

It’s working OK for me on 0.97.1. What I find is that often I need to restart HA 3 or 4 times for the component to work again after a reboot kills it. I think the issue is at BMW’s end.

I have the same issue after updating to 0.97.1, after several reboots it might work but other times I cannot get it to work. Looks like there is no consistency.

@Knallfrosch, @henninne
CC @WhimsySpoon
Nothing has changed in the BMW component for months, so this has nothing to do with HA (0.97.1). This is caused by the BMW server not being available at the time HA restarts. Also check my earlier post, quoted below with also a link to a post with a possible solution.

hi guys, trying to get this to work with my HA setup but no luck, error 500.
This is my configuration.yaml entry:

bmw_connected_drive:
  name:
    username: !secret connecteddrive_username
    password: !secret connecteddrive_password
    region: "rest_of_world"
    read_only: false

And the error log:

2019-08-11 14:40:52 ERROR (SyncWorker_17) [bimmer_connected.account] Unknown status code 500, expected 200
2019-08-11 14:40:52 ERROR (SyncWorker_17) [bimmer_connected.account] Error
2019-08-11 14:40:53 ERROR (MainThread) [homeassistant.setup] Error during setup of component bmw_connected_drive
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 172, in _async_setup_component
    component.setup, hass, processed_config  # type: ignore
  File "/usr/local/lib/python3.7/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 49, in setup
    accounts.append(setup_account(account_config, hass, name))
  File "/usr/src/homeassistant/homeassistant/components/bmw_connected_drive/__init__.py", line 77, 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.7/site-packages/bimmer_connected/account.py", line 55, in __init__
    self._get_vehicles()
  File "/usr/local/lib/python3.7/site-packages/bimmer_connected/account.py", line 190, in _get_vehicles
    logfilename='vehicles')
  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

Any idea what’s wrong? My credentials are ok and I can login just fine on the Android app/web interface.

I agree, it’s definitely not the component itself misbehaving. I too thought it was an issue whereby you must agree to the latest Ts and Cs, but as a test, I just bounced my HA instance, and it came back up unable to configure the component. Two bounces later, still no joy. The third, it worked. I didn’t open the BMW app or website.

It’s almost as if they’re load balancing to an instance that’s not very well.

I actually found the same thing, failed a few times then it connected.
I am however missing a few options that I have in the BMW ConnectedDrive android app such as flash the lights and turn on the AC/heating remotely. The only action I can take is to lock/unlock doors. Any idea if this just doesn’t work for the “rest_of_world” option?

Those options appear as services. Go to /developer-tools/service, or via the Developer Tools, Services menu and you’ll see the options prefixed with bmw_connected_drive.

I too am in the rest_of_world region and they’re present for me. I haven’t tried them, though.

1 Like

Yeah you’re right I see the activate_air_conditioning, light_flash, sound_horn under services under Dev Tools. Will try it later when I get home. Just need to pass the VIN in the service data field or does it need to be proper JSON syntax I wonder?

Almost certainly:

{
  "VIN": "123456..."
}

I’m seeing a new error appear in my logs now:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>502 Proxy Error</title>
</head><body>
<h1>Proxy Error</h1>
<p>The proxy server received an invalid
response from an upstream server.<br />
The proxy server could not handle the request <em><a href="/spuWebAPI/api/v1/user/vehicles/WBA1R520407E27550/status">GET&nbsp;/spuWebAPI/api/v1/user/vehicles/WBA1R520407E27550/status</a></em>.<p>
Reason: <strong>Error reading from remote server</strong></p></p>
<p>Additionally, a 502 Bad Gateway
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>

I’m really starting to think that BMW’s infrastructure is sub-par.

Is there a way to get a message/feedback once I run the scripts from /developer-tools/service (flash light/remote AC) whether they have been successfully executed? I do see errors in the log sometimes and they don’t go through but hard to tell if they worked

Also the BMW connected app seems to be able to pull way more data, last trip time, trip distance, consumption, etc. Would be nice to get these but maybe not exposed via the same api

Hi Gerard,
I did not have a look at the logs, but since the next update to 97.2 the component is working again without any issues.

The BMW servers (at least in the US where I’m using them) have stopped returning the confirmation that the component is expecting, so you get a timeout error every time even if the command was executed successfully, :frowning:

BTW, this seems to also affect horn honk and lock and unlock.