bimmer_connected.account

Access to a MyBMW account and all vehicles therein.

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

Create a new connection to the MyBMW web service.

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

Add or update a vehicle from the API responses.

config = None

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

gcid

Returns the current GCID.

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, 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.

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

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

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.