BMW ConnectedDrive component

Thanks, I did initially have it set to rest of world too but looking through this thread I saw that someone was using UK so tried that.
Will try both suggestions later this evening and report back.

What do you guys think about a feature for disabling the services?

I dont use the services and i would like to have them disabled for security reasons.

Would it be possible to make a simple config in the yaml like
disable_services: true?
or something else

Thanks for the help @gerard33 and @danielperna84 the component is now loading and I can see sensors although there are no values. I have also got the following errors:

2018-07-29 16:23:08 WARNING (MainThread) [homeassistant.setup] Setup of config is taking over 10 seconds.
2018-07-29 16:23:24 ERROR (SyncWorker_1) [bimmer_connected.state] No data available!
2018-07-29 16:23:24 ERROR (MainThread) [bimmer_connected.state] No data available!
2018-07-29 16:23:24 ERROR (SyncWorker_16) [bimmer_connected.state] No data available!
2018-07-29 16:23:24 ERROR (SyncWorker_7) [bimmer_connected.state] No data available!
2018-07-29 16:23:24 ERROR (MainThread) [bimmer_connected.state] No data available!
2018-07-29 16:23:24 ERROR (SyncWorker_17) [bimmer_connected.state] No data available!
2018-07-29 16:23:24 ERROR (MainThread) [bimmer_connected.state] No data available!
2018-07-29 16:23:24 ERROR (MainThread) [homeassistant.components.binary_sensor] bmw_connected_drive: Error on device update!
Traceback (most recent call last):
File “/usr/local/lib/python3.6/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.6/site-packages/homeassistant/helpers/entity.py”, line 319, in async_device_update
yield from self.hass.async_add_job(self.update)
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/binary_sensor/bmw_connected_drive.py”, line 159, in update
self._state = not vehicle_state.are_all_cbs_ok
File “/usr/local/lib/python3.6/site-packages/bimmer_connected/state.py”, line 224, in are_all_cbs_ok
for cbs in self.condition_based_services:
TypeError: ‘NoneType’ object is not iterable
2018-07-29 16:23:24 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 326, in _async_add_entity
await entity.async_update_ha_state()
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 215, in async_update_ha_state
device_attr = self.device_state_attributes
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/lock/bmw_connected_drive.py”, line 69, in device_state_attributes
‘door_lock_state’: vehicle_state.door_lock_state.value
AttributeError: ‘NoneType’ object has no attribute ‘value’
2018-07-29 16:23:25 ERROR (MainThread) [homeassistant.components.binary_sensor] bmw_connected_drive: Error on device update!
Traceback (most recent call last):
File “/usr/local/lib/python3.6/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.6/site-packages/homeassistant/helpers/entity.py”, line 319, in async_device_update
yield from self.hass.async_add_job(self.update)
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/binary_sensor/bmw_connected_drive.py”, line 161, in update
self._state = vehicle_state.has_check_control_messages
File “/usr/local/lib/python3.6/site-packages/bimmer_connected/state.py”, line 71, in _func_wrapper
return func(self, *args, **kwargs)
File “/usr/local/lib/python3.6/site-packages/bimmer_connected/state.py”, line 323, in has_check_control_messages
return len(self.check_control_messages) > 0
TypeError: object of type ‘NoneType’ has no len()
2018-07-29 16:23:25 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 326, in _async_add_entity
await entity.async_update_ha_state()
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 215, in async_update_ha_state
device_attr = self.device_state_attributes
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/binary_sensor/bmw_connected_drive.py”, line 112, in device_state_attributes
result[‘door_lock_state’] = vehicle_state.door_lock_state.value
AttributeError: ‘NoneType’ object has no attribute ‘value’
2018-07-29 16:23:25 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 326, in _async_add_entity
await entity.async_update_ha_state()
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 215, in async_update_ha_state
device_attr = self.device_state_attributes
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/binary_sensor/bmw_connected_drive.py”, line 115, in device_state_attributes
result[‘lights_parking’] = vehicle_state.parking_lights.value
AttributeError: ‘NoneType’ object has no attribute ‘value’
2018-07-29 16:25:43

Any ideas of what this is telling me other than it appears no data can be retrieved?

I just wanted to throw this out there. I have been playing with lovelace and I came up with this. It is the same card once as a picture glance and the other is just glance. I wish picture glance allowed you to have the labels but it doesn’t yet. I got the picture off of connecteddrive.com. The charging complete is a template sensor from charging time and the current time.

1 Like

Nice. That inspired me to make a card for my car as well.
This is the result using this great site https://sharethelove.io.

In the top the remaining fuel and range are shown. On the bottom status of the lock, maintenance, doors, windows and mileage.

Screenshot_1
Screenshot_2

Make sure to use this SSH addon Home Assistant Community Add-on: SSH & Web Terminal in which pip3 is available.

Probably your car is not supported. What is the construction year?
And can you also run the fingerprint to see what info that gives?

There is some work in progress to check if the car is supported and only show the relevant sensors and avoid the error messages.

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