Access to a MyBMW account and all vehicles therein.

class bimmer_connected.account.MyBMWAccount(username: str, password: dataclasses.InitVar[str], region: Regions, config: MyBMWClientConfiguration = None, log_responses: dataclasses.InitVar[bool] = False, observer_position: dataclasses.InitVar[GPSPosition] = None, use_metric_units: dataclasses.InitVar[Optional[bool]] = None)[source]

Create a new connection to the MyBMW web service.

async add_vehicle(vehicle_base: dict, fetched_at: datetime | None = None) None[source]

Add or update a vehicle from the API responses.

config: MyBMWClientConfiguration = None

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

property gcid: str | None

Returns the current GCID.

static get_stored_responses() List[AnonymizedResponse][source]

Return responses stored if log_responses was set to True.

get_vehicle(vin: str) MyBMWVehicle | None[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.

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

Retrieve vehicle data from BMW servers.

log_responses: dataclasses.InitVar[bool] = False

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

observer_position: dataclasses.InitVar[GPSPosition] = None

Optional. Required for getting a position on older cars.

password: dataclasses.InitVar[str]

MyBMW password.

property refresh_token: str | None

Returns the current refresh_token.

region: Regions

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, gcid: str | None = None) None[source]

Overwrite the current value of the MyBMW refresh token and GCID (if available).

property timezone

Returns the current tzinfo.

use_metric_units: dataclasses.InitVar[Optional[bool]] = None

Deprecated. All returned values are metric units (km, l).

username: str

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

property utcdiff

Returns the difference to UTC in minutes.

vehicles: List[MyBMWVehicle]