bimmer_connected.account

Library to read data from the BMW Connected Drive portal.

The library bimmer_connected provides a Python interface to interact with the BMW Connected Drive web service. It allows you to read the current state of the vehicle and also trigger remote services.

Disclaimer: This library is not affiliated with or endorsed by BMW Group.

class bimmer_connected.account.ConnectedDriveAccount(username: str, password: str, region: bimmer_connected.country_selector.Regions, log_responses: pathlib.Path = None, retries_on_500_error: int = 5)[source]

Create a new connection to the BMW Connected Drive web service.

Parameters:
  • username – Connected drive user name
  • password – Connected drive password
  • country – Country for which the account was created. For a list of valid countries, check https://www.bmw-connecteddrive.com . Use the name of the countries exactly as on the website.
  • log_responses – If log_responses is set, all responses from the server will be loged into this directory. This can be used for later analysis of the different responses for different vehicles.
  • retries_on_500_error – If retries_on_500_error is set, a communication with the Connected Drive server will automatically be retried the number of times specified in the event the error code received was 500. This sometimes occurs (presumably) due to bugs in the server implementation.
add_update_listener(listener: Callable) → None[source]

Add a listener for state updates.

get_vehicle(vin: str) → bimmer_connected.vehicle.ConnectedDriveVehicle[source]

Get vehicle with given VIN.

The search is NOT case sensitive. :param vin: VIN of the vehicle you want to get. :return: Returns None if no such vehicle is found.

request_header

Generate a header for HTTP requests to the server.

send_request(url: str, data=None, headers=None, expected_response=200, post=False, allow_redirects=True, logfilename: str = None, params: dict = None)[source]

Send an http request to the server.

If the http headers are not set, default headers are generated. You can choose if you want a GET or POST request.

server_url

Get the url of the server for this country.

set_observer_position(latitude: float, longitude: float) → None[source]

Set the position of the observer for all vehicles.

see VehicleViewDirection.set_observer_position() for more details.

update_vehicle_states() → None[source]

Update the state of all vehicles.

Notify all listeners of the vehicle state update.

vehicles

Get list of vehicle of this account