BMW ConnectedDrive component

Thank you. I did go through the discussion regarding the fix coming. Did not however identify that that would fix all of those problems. This HA project is getting more and more expensive, first bulbs, then switches and sensors, then a new car… Damn.

In which Release will it ne fixed?

You mean the unintended error messages? That will be part of HA 0.80 as the PR is already merged.

yes. thank you

thank you. Did just the update and no errors anymore in my log

1 Like

@gerard33,

Would you mind to take a look at the following topic?
https://github.com/m1n3rva/bimmer_connected/issues/95

Wondering if I missed something in the configuration or that my car is just not supported.

Unfortunately your car is not supported at the moment.

It is possible that you need to add position arguments, can you check this post and use the lat/lon of where your car is with the fingerprint command. Does that show proper data for your car?

If it does then I can have a look to renew this PR.

bimmerconnected with status and lat/lon arguments (shows different lat/lon than specified as argument, but they look real enough to me because it’s nearby):

vehicle status:
    {
        "vin": "XXXXXXXXXXXX",
        "steering": "LH",
        "position": {
            "lon": 6.6XXXX,
            "lat": 52.3XXXXX,
            "status": "OK"
        },
        "updateTime": "2018-10-17T10:00:50+0200",
        "DCS_CCH_Ongoing": false,
        "DCS_CCH_Activation": "NA",
        "vehicleCountry": "NL"
    }

bimmerconnected with fingerprint and lat/lon arguments (shows dummy lat/lon):

$ more status_0.txt
{
  "vehicleStatus": {
    "DCS_CCH_Activation": "NA",
    "DCS_CCH_Ongoing": false,
    "position": {
      "lat": 12.3456,
      "lon": 34.5678,
      "status": "OK"
    },
    "steering": "LH",
    "updateTime": "2018-10-17T10:00:50+0200",
    "vehicleCountry": "NL",
    "vin": "some_vin"
  }
}

$ more vehicles_0.txt
{
  "vehicles": [
    {
      "a4a": "USB_ONLY",
      "bodytype": "F30",
      "brand": "BMW",
      "breakdownNumber": "+4989358957103",
      "carCloud": "NOT_SUPPORTED",
      "chargeNow": "NOT_SUPPORTED",
      "chargingControl": "NOT_SUPPORTED",
      "climateControl": "START_TIMER",
      "climateControlRES": "NOT_SUPPORTED",
      "climateFunction": "VENTILATION",
      "climateNow": "ACTIVATED",
      "climateNowRES": "NOT_SUPPORTED",
      "color": "BLACK SAPPHIRE METALLIC",
      "colorCode": "475",
      "countryCode": "V1-NL",
      "dealer": {
        "city": "XXXXXXXXXXXX",
        "country": "NL",
        "name": "XXXXXXXXXXXX",
        "phone": "XXXXXXXXXXXX",
        "postalCode": "XXXXXXXXXXXX",
        "street": "XXXXXXXXXXXX"
      },
      "doorLock": "ACTIVATED",
      "doorUnlock": "ACTIVATED",
      "driveTrain": "CONV",
      "fuelType": "DIESEL",
      "hasAlarmSystem": false,
      "hmiVersion": "ID4",
      "hornBlow": "ACTIVATED",
      "hub": "HUB_ECE",
      "intermodalRouting": "NOT_AVAILABLE",
      "ipa": "NOT_SUPPORTED",
      "lastDestinations": "NOT_SUPPORTED",
      "lightFlash": "ACTIVATED",
      "lscType": "NOT_SUPPORTED",
      "model": "325d",
      "onlineSearchMode": "MAP",
      "onlineSearchProvider": "GOOGLE",
      "rangeMap": "NOT_SUPPORTED",
      "remote360": "NOT_SUPPORTED",
      "remoteSoftwareUpgrade": "NOT_SUPPORTED",
      "sendPoi": "ACTIVATED",
      "smartSolution": "NOT_SUPPORTED",
      "statisticsAvailable": false,
      "statisticsCommunityEnabled": false,
      "steering": "LH",
      "vehicleFinder": "ACTIVATED",
      "vin": "some_vin",
      "yearOfConstruction": 2013
    }
  ]
}

That’s unfortunately still no relevant data :cry:

The only things that could work is the climate function, door lock, horn blow and light flash.
Are these options working in HA? Or don’t these get loaded properly due to the errors?

The device tracker wont be very helpful as it will only show the right coordinates if your car is home, as the PR is designed to use the coordinates of your house which are entered in configuration.yaml (API will only give coordinates if your car is near the coordinates sent to the API).

I will make a Github issue to see if we can only hide data and thus the errors in HA when no relevant data is available.

Hi @gerard33,

Thanks for your reply. I haven’t tried the 4 services climate function, door lock, horn blow and light flash yet, but I will try them soon. I’m not sure yet if they won’t show up because of the errors.

As far as I know, the functionalities are limited and this behaviour looks the same as the BMW connected app: you can use those 4 services, but if you want the car’s location, you need to be within 2km or so. Same limitation like here.

Thanks anyway for sorting this out!

I have been running the custom component until now, but decided to switch to the built in version to stay up to date.

When I did this I lost the buttons for Air Condition, Honk Horn and Flash lights in the HA interface. This also means I can no longer access the Air Condition feature with the HomeKit bridge.

I have been trying to figure out how to add these back, but can’t figure out how I add the services (bmw_connected_drive.activate_air_conditioning) as entities in my BMW Connected group, but cannot figure it out.

Could someone here please guide me? How do I trigger the service from the interface and HomeKit and how do I provide the VIN?

You can add the services as scripts. You can find the VIN as attribute of the device tracker.
All info is available here.

The script will show up as a switch in Homekit.

script:
  # BMW ConnectedDrive
  bmw_airco:
    sequence:
      - service: bmw_connected_drive.activate_air_conditioning
        data:
          vin: 'ABC12121212121212'

Any update to getting the measurements in miles vs km?

That’s available since 0.81.
The HA unit system will automatically be used.

Oh man, I feel so stupid…totally missed that. Will that also change my temperature readings from C to F?

I get following error now
“Unknown status code 500, expected 200”

But I can use the component, got all updates and also all scripts are working fine

The BMW service/website fail so often I see more errors than correct readings from my car (slight exaggeration, but paints the picture).
What is your experience?

I’ve just set up this component and I’m trying to understand what I’m doing wrong.
I have it setup correctly in that I can read the status of all entities correctly, but it seems that apart from the bmw_connected_drive.update_state nothing works.
I can’t lock/unlock, I can flash the lights and I suspect I can’t sound the horn (not tried yet)
I have a 2018 2 series Gran Tourer and here is the config:

bmw_connected_drive:
  220d:
    username: !secret bmw_connected_drive_username
    password: !secret bmw_connected_drive_password
    region: "rest_of_world"

if I try to manually flash the lights using the services button I get this errors:

2018-12-19 23:19:26 ERROR (SyncWorker_0) [bimmer_connected.account] Unknown status code 429, expected 200
2018-12-19 23:19:26 ERROR (SyncWorker_0) [bimmer_connected.account] 
2018-12-19 23:19:26 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140555095853712] Error handling message: {'type': 'call_service', 'domain': 'bmw_connected_drive', 'service': 'light_flash', 'service_data': {'vin': 'WBANXXXXXX1234567'}, 'id': 23}
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/components/websocket_api/decorators.py", line 16, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/src/app/homeassistant/components/websocket_api/commands.py", line 148, in handle_call_service
    connection.context(msg))
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/src/app/homeassistant/core.py", line 1121, in async_call
    self._execute_service(handler, service_call))
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/src/app/homeassistant/core.py", line 1145, in _execute_service
    await self._hass.async_add_executor_job(handler.func, service_call)
  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 106, in execute_service
    function_call()
  File "/usr/local/lib/python3.6/site-packages/bimmer_connected/remote_services.py", line 77, in trigger_remote_light_flash
    return self._block_until_done(_Services.REMOTE_LIGHT_FLASH)
  File "/usr/local/lib/python3.6/site-packages/bimmer_connected/remote_services.py", line 142, in _block_until_done
    status = self._get_remote_service_status(service)
  File "/usr/local/lib/python3.6/site-packages/bimmer_connected/remote_services.py", line 162, in _get_remote_service_status
    response = self._account.send_request(url)
  File "/usr/local/lib/python3.6/site-packages/bimmer_connected/account.py", line 134, in send_request
    raise IOError(msg)
OSError: Unknown status code 429, expected 200

If I use the BMW Official app all works fine.
Any ideas?

Error 429 is for too many requests. Never seen that one before.
Did you use the right VIN? You have to use the VIN as shown in the device tracker attributes.

yes:


(with the right vin indeed, copied from my !secrets and checked that one twice…)

I’ve just tried again and this time did not get the error message. The difference was that the car was locked this time (vs unlocked last time, which could explain the failure), but it still failed to flash the lights and nothing in the logs (I’m already in debug), not a single entry…