I have configured the Component according to the documentation (but removed name). However this is what I am seeing:
Log Details (ERROR)
Wed Feb 28 2018 13:02:26 GMT+0100 (W. Europe Standard Time)
Error during setup of component bmw_connected_drive
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/setup.py”, line 148, in _async_setup_component
component.setup, hass, processed_config)
File “/usr/lib/python3.6/asyncio/futures.py”, line 332, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.6/asyncio/tasks.py”, line 250, in _wakeup
future.result()
File “/usr/lib/python3.6/asyncio/futures.py”, line 245, in result
raise self._exception
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/bmw_connected_drive.py”, line 52, in setup
bimmer = BMWConnectedDriveAccount(username, password, country, name)
File “/usr/lib/python3.6/site-packages/homeassistant/components/bmw_connected_drive.py”, line 83, in init
self.account = ConnectedDriveAccount(username, password, country)
File “/usr/lib/python3.6/site-packages/bimmer_connected/account.py”, line 52, in init
self._get_vehicles()
File “/usr/lib/python3.6/site-packages/bimmer_connected/account.py”, line 158, in _get_vehicles
self._get_oauth_token()
File “/usr/lib/python3.6/site-packages/bimmer_connected/account.py”, line 83, in _get_oauth_token
self._oauth_token = url_with_token[‘access_token’][0]
KeyError: ‘access_token’
This is my configuration:
bmw_connected_drive:
mycar:
username: [email protected]
password: mySecretPass
country: Sweden
@silfa718 Try both before and after login, I guess.
@ChristianKuehnel I think the API is located at https://b2vapi.bmwgroup.us but the problem is my account can’t seem to get a OAuth access token from customer.bmwgroup.com or wherever the OAuth server is. Maybe there is a different server for Canada and the USA that we need to be looking for?
2018-02-27 23:46:57 ERROR (MainThread) [homeassistant.setup] 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'
I’m having a problem with configuration.yaml. Fails!!
Testing configuration at /config
ERROR:homeassistant.config:Invalid config for [bmw_connected_drive]: [name] is an invalid option for [bmw_connected_drive]. Check: bmw_connected_drive->bmw_connected_drive->mycar->name. (See /config/configuration.yaml, line 66). Please check the docs at https://home-assistant.io/components/bmw_connected_drive/
ERROR:homeassistant.setup:Setup failed for bmw_connected_drive: Invalid config.
Failed config
bmw_connected_drive:
mycar: [source /config/configuration.yaml:67]
country: USA
name: XXXX <------- This is the problem. Not liasted on the USA Site
password: my password
username: my username
What I did for the German website:
I used the developer console from Google Chrome and observed me logging into the connected drive site. And there is one URL where the browser sends the username/password and get the “access_token” back in the header of the response.
What I would need are examples of:
the url that the login request is sent to
an example of the request header (to see if the format is the same)
an example of the response header (to see if the format is the same)
I can’t analyze that as I can’t create a Canadian Connected Drive account without a Canadian vehicle…
The problem here is that obviously the US and Canadian Connected Drive portals are using a different URL to login via username/password. So i need someone with such an account to figure out the parameters (see my comment above: BMW ConnectedDrive component)
This should be fixed in HA 0.64.2 which is just released.
That’s already the case
When the door_lock_state is LOCKED or SECURED:
The lock (switch) has a locked icon
The status of the binary sensor ‘Door lock state’ is shown as Safe
When the door_lock_state is SELECTIVELOCKED or UNLOCKED:
The lock (switch) has an unlocked icon
The status of the binary sensor ‘Door lock state’ is shown as Unsafe
I see you don’t have that binary sensor in your group, but it’s already available, so you can add that.
Quickest way to find all sensors available for your car is to go to Developer tools - States and go to Filter attributes where you can enter the type of your car, in your case X1 sDrive18d.
You can add control: hidden to your BMW X1 Group so no On/Off switch is shown in the header, which will avoid you to accidentally switch on the horn, lights and climate at the same time
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/tasks.py", line 180, in _step
result = coro.send(None)
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 69, in device_state_attributes
'last_update': vehicle_state.timestamp,
File "/config/deps/lib/python3.6/site-packages/bimmer_connected/state.py", line 46, in _func_wrapper
raise ValueError('No data available!')
ValueError: No data available!
2018-03-02 08:43:13 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/deps/lib/python3.6/site-packages/bimmer_connected/state.py", line 44, in _func_wrapper
return func(self, *args, **kwargs)
File "/config/deps/lib/python3.6/site-packages/bimmer_connected/state.py", line 91, in timestamp
unix_time = int(self._attributes['updateTime_converted_timestamp'])
KeyError: 'updateTime_converted_timestamp'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/tasks.py", line 180, in _step
result = coro.send(None)
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 69, in device_state_attributes
'last_update': vehicle_state.timestamp,
File "/config/deps/lib/python3.6/site-packages/bimmer_connected/state.py", line 46, in _func_wrapper
raise ValueError('No data available!')
ValueError: No data available!
You are using the custom component, that version is not changed yet.
Either remove the custom component so you can use the updated version in 0.64.2 or wait until I have updated the custom component.
Edit: the custom component is bumped to bimmer_connected v0.41.
Can you open the BMW ConnectedDrive app and after that check if HA shows recent data?
Some older cars don’t seem to support auto refresh of the data. See this post BMW ConnectedDrive component.
@coolTNT
Thx for the analysis. The request and response look quite different from the one from Europe. What I’m missing is the access_token in the Location attribute. This token is then used in the authentication of the API calls. So it seems this is done differently in the Canadian site