bimmer_connected.account

Access to a MyBMW account and all vehicles therein.

class bimmer_connected.account.MyBMWAccount(username: str, password: dataclasses.InitVar, region: bimmer_connected.const.Regions, config: bimmer_connected.api.client.MyBMWClientConfiguration = None, log_responses: dataclasses.InitVar = False, observer_position: dataclasses.InitVar = None, use_metric_units: dataclasses.InitVar = True)[source]

Create a new connection to the MyBMW web service.

add_vehicle(vehicle_base: dict, vehicle_state: dict, fetched_at: Optional[datetime.datetime] = None) → None[source]

Add or update a vehicle from the API responses.

config = None

Optional. If provided, username/password/region are ignored.

static get_stored_responses() → List[bimmer_connected.models.AnonymizedResponse][source]

Return responses stored if log_responses was set to True.

get_vehicle(vin: str) → Optional[bimmer_connected.vehicle.vehicle.MyBMWVehicle][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 vehicle is found.

get_vehicles(force_init: bool = False) → None[source]

Retrieve vehicle data from BMW servers.

log_responses = False

Optional. If set, all responses from the server will be logged to this directory.

observer_position = None

Optional. Required for getting a position on older cars.

password = None

MyBMW password.

refresh_token

Returns the current refresh_token.

region = None

Region of the account. See api.Regions.

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

Set the position of the observer for all vehicles.

set_refresh_token(refresh_token: str) → None[source]

Overwrite the current value of the MyBMW refresh token.

set_use_metric_units(use_metric_units: bool) → None[source]

Change between using metric units (km, l) if True or imperial units (mi, gal) if False.

timezone

Returns the current tzinfo.

use_metric_units = True

Optional. Use metric units (km, l) by default. Use imperial units (mi, gal) if False.

username = None

MyBMW user name (email) or 86-prefixed phone number (China only).

utcdiff

Returns the difference to UTC in minutes.