BMW ConnectedDrive component

it’s kinda strange. with the bmw component included in HA 0.65 upwards i don’t get any data at all:

image

with gerard33’s custom_component i get data, but repeating error messages like the one above.

These are shown in the App under Check Control Messages (or something like that).
For me this shows Tyre pressure = OK and Motor oil = OK.

That’s strange :confused:

Can you check this GitHub - bimmerconnected/bimmer_connected: 🚘 Library to query the status of your BMW or Mini from the ConnectedDrive portal and share the output of the fingerprint function? In this version some changes have been inplemented to make the component work in North-America and China, maybe that version works better for you car as well.

ok. sorry, can’t see those messages in my app :frowning:
i will upload my fingerprint data to the github. thanks

Same here!
Using 0.65 and 0.66b: No data!
Regards.

Someone?

2018-03-30 22:18:46 ERROR (MainThread) [homeassistant.components.binary_sensor] bmw_connected_drive: Error on device update!
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 188, in _async_add_entity
await entity.async_device_update(warning=False)
File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 327, in async_device_update
yield from self.hass.async_add_job(self.update)
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/lib/python3.6/site-packages/homeassistant/components/binary_sensor/bmw_connected_drive.py”, line 105, in update
self._state = bool(vehicle_state.door_lock_state.value
File “/usr/lib/python3.6/site-packages/bimmer_connected/state.py”, line 196, in door_lock_state
return LockState(self._attributes[‘door_lock_state’])
KeyError: ‘door_lock_state’

Here are some updates on the status of the BMW component.

In HA 0.66 the following items are added

  • Binary sensors for Doors, Windows and Door lock state
  • Lock

Support for North-America
This PR brings support to users from USA and Canada. The bimmer_connected library has moved to a different API on the BMW servers for this.
It’s a breaking change where you have to change the country in the config to a region.
This will be part of HA 0.67.

Device tracker
This PR fixes the toggling state if vehicle tracking is disabled. This will be part of HA 0.67.

Other
Currently additional items are being added like info on the condition based services, check_control_messages and parking lights.
Also items for electric cars will be added soon.

Custom component
I have also added the heading to the device tracker, so you can show your car on the map including the right direction :slight_smile:.

In order to make this work I have made pictures for every 30 degrees.
I only need to find a free website where I can store these pictures so they are available with a direct link like https://web.site.com/bmw_30.png. So Google Drive and free pictures sites wont work for that as they do not provide a link with the exact filename in it, which is needed to select to picture with the right heading.
If there are any ideas just let me know.

All the above mentioned stuff (except eletric car stuff) is available with the latest custom component which can be found here.
:warning: This version contains a breaking change as the naming of the entity_ids and some attributes has changed (so it’s the same as in the version on HA). So if you use any automations please check these.

I try it :slight_smile:
Regards.

Seems… some problems from Europe :frowning:
Works fine before 0.65. After that many problems. I try to use custom_component:

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

Error setting up platform bmw_connected_drive
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/components/device_tracker/init.py”, line 188, in async_setup_platform
disc_info)
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/device_tracker/bmw_connected_drive.py”, line 27, in setup_scanner
tracker.update()
File “/config/custom_components/device_tracker/bmw_connected_drive.py”, line 49, in update
if not self.vehicle.state.is_vehicle_tracking_enabled:
File “/config/deps/lib/python3.6/site-packages/bimmer_connected/state.py”, line 69, in _func_wrapper
raise ValueError(‘No data available!’)
ValueError: No data available!

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 223, in async_update_ha_state
device_attr = self.device_state_attributes
File “/config/custom_components/switch/bmw_connected_drive.py”, line 75, in device_state_attributes
‘last_update’: self._vehicle.state.timestamp.replace(tzinfo=None),
File “/config/deps/lib/python3.6/site-packages/bimmer_connected/state.py”, line 69, in _func_wrapper
raise ValueError(‘No data available!’)
ValueError: No data available!

@ezar Can you check this https://github.com/m1n3rva/bimmer_connected#data-contributions and share the output of the fingerprint function?

I changed VIN to XXXXXXXXXXXXXXXXXXXX
I do not know if it will be useful

DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.account:getting new oauth token
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.com
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.com:443 “POST /webapi/oauth/token HTTP/1.1” 200 None
DEBUG:bimmer_connected.account:got new token XXXXXXXXXXXXXXXXXXX with expiration date 2018-03-31 08:11:10.418796
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.com
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.com:443 “GET /webapi/v1/user/vehicles HTTP/1.1” 200 None
DEBUG:bimmer_connected.state:requesting new data from connected drive
DEBUG:bimmer_connected.account:Old token is still valid. Not getting a new one.
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): b2vapi.bmwgroup.com
DEBUG:urllib3.connectionpool:https://b2vapi.bmwgroup.com:443 “GET /webapi/v1/user/vehicles/XXXXXXXXXXXXXXXXXXXX/status HTTP/1.1” 400 None
ERROR:bimmer_connected.account:Unknown status code 400, expected 200
ERROR:bimmer_connected.account:{
“error” : {
“code” : 500,
“description” : “(SmartPhoneUtil-A-101) Mandatory parameter(s) missed or blank: dlat and dlon are required for BMW vehicles!”
}
}
Traceback (most recent call last):
File “/usr/local/bin/bimmerconnected”, line 106, in
main()
File “/usr/local/bin/bimmerconnected”, line 44, in main
args.func(args)
File “/usr/local/bin/bimmerconnected”, line 73, in fingerprint
account.update_vehicle_states()
File “/usr/local/lib/python3.5/dist-packages/bimmer_connected/account.py”, line 205, in update_vehicle_states
car.update_state()
File “/usr/local/lib/python3.5/dist-packages/bimmer_connected/vehicle.py”, line 58, in update_state
self.state.update_data()
File “/usr/local/lib/python3.5/dist-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.5/dist-packages/bimmer_connected/account.py”, line 128, in send_request
raise IOError(msg)
OSError: Unknown status code 400, expected 200

UPDATE:
I try adding /status?dlat=xxx&dlon=yyy and works fine. It generate status_0.txt and vehicles_0.txt files.

Can you share these files?
And it looks like adding the lat + lon makes it possible to get the newest data for specific cars which otherwise give errors.
@m1n3rva let’s see what we can do with that.

@gerard33, @ezar

I heard of some vehicles where you only get the position of the vehicle if you’re close to the vehicle. In these cases you have to provide your GPS position and you only get the response in case your position is within 2km of the position of the vehicle. Some sort of privacy thing.

Looking at the vehicle data, I saw the attribute "vehicleFinderRestriction" : "NONE" for all examples we have collected so far:

@ezar:
Can you check if for your car, the vehicleFinderRestriction is something other then None?

@m1n3rva This TAG doesn’t appears :frowning:

Seems that using previous version I can access to more information that using last :frowning:
Why?

Regards.

How did you get the picture of the car to appear as the icon? (the picture next to “BMW X1”)

Maybe to host the pictures of the car we could use GitHub? Upload them to a repo that never changes and just use something like raw.githubusercontent.com/gerard33/repo-name/pictures/numberofdegrees

I have downloaded the picture of my car via the link mentioned here.
Then I added it in known_devices.yaml with picture: /local/bmw.png

Thanks. I have made a repo for this and tested it. Doesn’t seem to work correctly with raw.githubusercontent.com. Found this https://raw.githack.com/ so will test with that (currently ConnectedDrive is not available).

If you want to test it as well you can add the config below and change x1_sdrive18i to your model.

camera:
  - platform: generic
    name: BMW X1
    still_image_url: https://maps.googleapis.com/maps/api/staticmap?center={{ states.device_tracker.x1_sdrive18i.attributes.latitude }},{{ states.device_tracker.x1_sdrive18i.attributes.longitude }}&zoom=13&size=500x500&maptype=roadmap&markers=icon:https://rawcdn.githack.com/gerard33/bmw-pictures/master/pictures/bmw-{{ states.device_tracker.x1_sdrive18i.attributes.heading_rounded }}.png%7C{{ states.device_tracker.x1_sdrive18i.attributes.latitude }},{{ states.device_tracker.x1_sdrive18i.attributes.longitude }}
    limit_refetch_to_url_change: true
1 Like

Maybe we can download the picture automatically with the device_tracker component in the future?

I tried your camera config and it worked perfectly! :smile:

No idea what it is, but I see here that lscType is “NOT_SUPPORTED” where for all working cars it has a value other than that.

@ezar, can you check that in your vehicles_0.txt?

That was exactly my intention as mentioned in that issue on Github :wink:
We’ll see if we get that working.

Good to see the camera config is working. It’s a nice addon :grinning:

Now we kind of need to document the camera config somewhere though (it’s hard to set up, with the templates and everything). Maybe in the device_tracker docs?
I don’t think that it really fits anywhere else?

Yes. I have this TAG: lscType is “NOT_SUPPORTED”

Yes indeed, but I first have to make a PR for the device tracker, because currently the part which gets the heading (and rounds it to steps of 30 degrees) is not available in the code. When I will do that, I will also add the documentation.
Currently this is only available in the custom component.

1 Like