BMW ConnectedDrive component

Could be that ConnectedDrive is not yet working correctly for USA and Canada.
Can you check this post?

And can you follow these instructions to see if the data is available for you?

That seems like the same issue as mentioned here. Weā€™ll take care of it :thinking:

The links in that post donā€™t work for me.

Try using https://crm.bmw.ca/en-CA/ConnectedDrive/Account
It seems to look at lot more similar to the login pages that you get in other countries, without the other bmw.ca stuff around the login formā€¦
(I just found it by snooping around in the HTML source code, so honestly itā€™s just a wild guess)

Iā€™m currently updating my Home Assistant instance to try it out.

Wont let me login.

It seems to work normally for me, at least in a web browser

Edit: Sorry, I realized that you are from USA, not Canada. Maybe the US has a similar url to https://crm.bmw.ca/en-CA/ConnectedDrive/Account ?

Iā€™m getting this in Canada:
Error during setup of component bmw_connected_drive Traceback (most recent call last): File "/srv/homeassistant/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py", line 148, in _async_setup_component component.setup, hass, processed_config) File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__ yield self # This tells Task to wait for completion. File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup future.result() File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result raise self._exception File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/srv/homeassistant/homeassistant/lib/python3.5/site-packages/homeassistant/components/bmw_connected_drive.py", line 52, in setup bimmer = BMWConnectedDriveAccount(username, password, country, name) File "/srv/homeassistant/homeassistant/lib/python3.5/site-packages/homeassistant/components/bmw_connected_drive.py", line 83, in __init__ self.account = ConnectedDriveAccount(username, password, country) File "/srv/homeassistant/homeassistant/lib/python3.5/site-packages/bimmer_connected/account.py", line 52, in __init__ self._get_vehicles() File "/srv/homeassistant/homeassistant/lib/python3.5/site-packages/bimmer_connected/account.py", line 158, in _get_vehicles self._get_oauth_token() File "/srv/homeassistant/homeassistant/lib/python3.5/site-packages/bimmer_connected/account.py", line 83, in _get_oauth_token self._oauth_token = url_with_token['access_token'][0] KeyError: 'access_token'

Is there a way I can manually specify a url? I want to try https://crm.bmw.ca/en-CA/ConnectedDrive/Account
It looks like itā€™s failing at a step that uses OAuth. Does the OAuth step contact a country specific server or is it the same across all countries? I have a feeling that some countries donā€™t use the central OAuth system, like Canada and US

The issue is: I canā€™t debug the other countries, as I cannot create an account for these countries. My guess is that the url for the login page is not the one Iā€™m getting from https://www.bmw-connecteddrive.com/country-select/country-selection.html

Can you debug the login process with the developer tools in Firefox/Chrome.
What Iā€™m looking for is the {server} part for these urls:

REMOTE_SERVICE_URL = '{server}/api/vehicle/remoteservices/v1/{vin}/{service}'
VEHICLE_STATE_URL = '{server}/api/vehicle/dynamic/v1/{vin}'
VEHICLE_SPECS_URL = '{server}/api/vehicle/specs/v1/{vin}'
LIST_VEHICLES_URL = '{server}/api/me/vehicles/v2'

I hope that only the {server} is different and that the rest of the API is the sameā€¦

1 Like

and the name: field is a bug in the documentation. leave that one away.

The fix for the documentation is on the way:
https://github.com/home-assistant/home-assistant.github.io/pull/4769

1 Like

I was capturing packets from the BMW Remote App, and it seems to be contacting https://b2vapi.bmwgroup.us

Is there a way we can manually try this url?

I tried https://b2vapi.bmwgroup.us/api/vehicle/specs/v1/{vin} :

{"error":"invalid_token","error_description":"The access token provided is expired, revoked, malformed, or invalid for other reasons."}

I couldnā€™t find anything useful in the sources of the login page :frowning:

Iā€™m willing to help out, let me know what you need me to do.

Which page do you need me to get that debug info for the {server}?

@silfa718 I think he wants the login page, but I couldnā€™t find any references to ā€œAPIā€ or whatever in the Canadian login pageā€¦

It would help knowing where to look.

Go to the website where you usually login to ConnectedDrive, then do a ā€œInspect elementā€, then use Ctrl+F to find anything that might mention ā€œAPIā€. Try looking around in the sources tab in the inspection window as well.

Today Iā€™ve got errors when starting home assistant while itā€™s trying to setup the connected drive component.

2018-02-27 08:57:11 ERROR (MainThread) [homeassistant.setup] Error during setup of component bmw_connected_drive
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/setup.py", line 148, in _async_setup_component
component.setup, hass, processed_config)
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 331, in __iter__
yield self  # This tells Task to wait for completion.
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 244, in _wakeup
future.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 244, in result
raise self._exception
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/bmw_connected_drive.py", line 52, in setup
bimmer = BMWConnectedDriveAccount(username, password, country, name)
  File "/home/homeassistant/.homeassistant/custom_components/bmw_connected_drive.py", line 83, in __init__
self.account = ConnectedDriveAccount(username, password, country)
  File "/home/homeassistant/.homeassistant/deps/lib/python3.6/site-packages/bimmer_connected/account.py", line 54, in __init__
self._get_vehicles()
  File "/home/homeassistant/.homeassistant/deps/lib/python3.6/site-packages/bimmer_connected/account.py", line 161, in _get_vehicles
response = self.send_request(LIST_VEHICLES_URL.format(server=self.server_url), headers=self.request_header)
  File "/home/homeassistant/.homeassistant/deps/lib/python3.6/site-packages/bimmer_connected/account.py", line 119, in send_request
raise IOError(msg)
OSError: Unknown status code 502, expected 200

edit: forget this: BMW page is in maintenance mode :wink:

Iā€™m a bit suprised that we do not receive a notification of when this mainteance is scheduled and at least for me, during daytime.

When Honeywell performs changes to their portal where we connect to with our thermostat, we receive a proper announcement upfront.

Can anyone confirm if the lock switch will be able to lock your car from HA?

Yes, we can :slight_smile:

2 Likes

Awesome that is a very cool feature

Starting from version 0.65 if I understand @gerard33 previous answer correctly. At the moment only using the custom component.

@gerard33 Thank you for clarifying what is currently available because I was not sure if it was just me that did not find the other sensors in 0.64 :slight_smile:

1 Like