BMW ConnectedDrive component

Which card did you use from that site? I like that it is a picture card with text on the statuses which you cant do with the normal one.

@Sluddsy do you have the bmw remote services?

@Alexxander0
Yes I do but looks like I have id4 so this may not be compatible.

I took the Temperature glance as example. I am using a picture where I made the bottom grey-transparent in Photoshop.
So picture-elements card with custom:text-element, state-icon and state-icon on the bottom.
On the top custom:circle-sensor-card.

Links for the custom parts I have used.
custom:text-element
custom:circle-sensor-card

Here is a part of my card.

  - icon: mdi:car-connected
    title: BMW X1
    cards:
      - type: picture-elements
        image: /local/lovelace/bmw_layer.jpg
        elements:
        # lock
        - type: custom:text-element
          text: "Slot"
          style:
            top: 86%
            left: 10%
            color: white
            # background-color: rgba(54, 65, 78, 0.8)
        - type: state-icon
          entity: binary_sensor.x1_sdrive18i_door_lock_state
          tap_action: more-info
          style:
            top: 91.5%
            left: 10%              
            "--paper-item-icon-color": white
        - type: state-label
          entity: binary_sensor.x1_sdrive18i_door_lock_state
          style:
            top: 97.5%
            left: 10%
            color: white
        # remaining fuel
        - type: custom:circle-sensor-card
          entity: sensor.x1_sdrive18i_remaining_fuel
          max: 63
          min: 0
          stroke_width: 15
          # stroke_color: '#03a9f4'
          gradient: true
          fill: rgba(54, 65, 78, 0.6)
          name: tank
          units: ' '
          font_style:
            font-size: 1.1em
            color: white
            # text-shadow: '2px 2px black'
          color_stops:
            5: '#09C7E8'
            63: '#09A50C'
          style:
            top: 6%
            left: 5%
            width: 4em
            height: 4em
            transform: none

Since this morning I get the following errors when I restart HASS:

2018-09-18 09:11:01 ERROR (SyncWorker_15) [bimmer_connected.account] Unknown status code 400, expected 200

2018-09-18 09:11:01 ERROR (SyncWorker_15) [bimmer_connected.account] {

“error” : “invalid_grant”,

“error_description” : “the authN circuit failed”

}

2018-09-18 09:11:01 ERROR (MainThread) [homeassistant.setup] Error during setup of component bmw_connected_drive

Traceback (most recent call last):

File “/usr/src/app/homeassistant/setup.py”, line 148, 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/src/app/homeassistant/components/bmw_connected_drive/init.py”, line 61, in setup

accounts.append(setup_account(account_config, hass, name))

File “/usr/src/app/homeassistant/components/bmw_connected_drive/init.py”, line 90, in setup_account

read_only)

File “/usr/src/app/homeassistant/components/bmw_connected_drive/init.py”, line 137, in init

self.account = ConnectedDriveAccount(username, password, region)

File “/usr/local/lib/python3.6/site-packages/bimmer_connected/account.py”, line 55, in init

self._get_vehicles()

File “/usr/local/lib/python3.6/site-packages/bimmer_connected/account.py”, line 181, in _get_vehicles

self._get_oauth_token()

File “/usr/local/lib/python3.6/site-packages/bimmer_connected/account.py”, line 88, in _get_oauth_token

expected_response=200, post=True)

File “/usr/local/lib/python3.6/site-packages/bimmer_connected/account.py”, line 128, in send_request

raise IOError(msg)

OSError: Unknown status code 400, expected 200

Any ideas? Nothing has changed as far as I know…

Same error here. Maybe BMW changed the authentication workflow ?
Edit: I’m in Belgium

Not working for me either

Edit: Im in the UK (Or ‘rest of world’ according to BMW regions)

Looks like BMW has changed something regarding the API indeed.
We will have a look at it.

2 Likes

Mine’s working fine - I’m in the US. I compared the data against the BMW Connected app and it matches.

Broken here, Norway.

also broken with in Germany

PR is made https://github.com/home-assistant/home-assistant/pull/16780.
Thanks to @m1n3rva for fixing the library which was necessary because the login url to the BMW server has changed.

2 Likes

what is the new login url for europe? is an update available or can it be made manualy right now? actual bimmer version is installed via pip.

@gerard33 could somebody explain a noob how to update his Bmw component?

Thanks

old url: webapi/oauth/token
new_url: gcdm/oauth/token

Find the file __init__.py in bmw_connected_drive folder and change
REQUIREMENTS = ['bimmer_connected==0.5.1'] to REQUIREMENTS = ['bimmer_connected==0.5.2'].

Or just wait until HA 0.79 is available.

Sooo… a total HA noob here. Trying to get something out of this component.

So far all I’ve done, is add this to the configuration.yaml:

# BMW Connected
bmw_connected_drive:
  name:
    username: [email protected]
    password: xxx
    region: "rest_of_world"

And I get these errors:

Fri Sep 28 2018 18:34:35 GMT+0300 (Eastern European Summer Time)

Unknown status code 400, expected 200
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/bmw_connected_drive/__init__.py", line 150, in update
    self.account.update_vehicle_states()
  File "/usr/local/lib/python3.6/site-packages/bimmer_connected/account.py", line 205, in update_vehicle_states
    car.update_state()
  File "/usr/local/lib/python3.6/site-packages/bimmer_connected/vehicle.py", line 58, in update_state
    self.state.update_data()
  File "/usr/local/lib/python3.6/site-packages/bimmer_connected/state.py", line 92, in update_data
    VEHICLE_STATUS_URL.format(server=self._account.server_url, vin=self._vehicle.vin), logfilename='status')
  File "/usr/local/lib/python3.6/site-packages/bimmer_connected/account.py", line 128, in send_request
    raise IOError(msg)
OSError: Unknown status code 400, expected 200

And this

Fri Sep 28 2018 18:44:35 GMT+0300 (Eastern European Summer Time)

Error updating the vehicle state.

And this

Fri Sep 28 2018 18:44:35 GMT+0300 (Eastern European Summer Time)

{
  "error" : {
    "code" : 500,
    "description" : "(SmartPhoneUtil-A-101) Mandatory parameter(s) missed or blank: dlat and dlon are required for BMW vehicles!"
  }
}

For longitude and latitude, I have this:

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: xx.xxxxxx
  longitude: yy.yyyyyy

So, any tips on how to go forward? Should I add some ’ or " around the password and username? Something else? Nothing is shown in the overview UI regarding this.

Got a BMW 320D 2014, a working connection to that from the iOS app and the location is Finland. Running HA 0.78.3 from hass.io rpi image.

after the update I get following error messages
No data available for attribute <function VehicleState.charging_status at 0x63b1be88>!

I have already made a PR for that, but it wasn’t merged in the 0.79 release :confused:
https://github.com/home-assistant/home-assistant/pull/16877

But you can safely ignore that message, it’s no actual error and the PR makes sure the logs are not filled with these messages.

you have to update to hass 0.79 to fix the issue

As mentioned above you indeed need HA 0.79 as that contains a fix for a change made in the api by BMW.

Besides that I think you car isn’t supported. There is some work in progress to support older cars for which lon and lat coordinates needs to be send, but that’s not implemented yet.