bimmer_connected.vehicle

The bimmer_connected.vehicle module contains all data & parsers for a vehicle.

bimmer_connected.vehicle.vehicle

Models state and remote services of one vehicle.

class bimmer_connected.vehicle.vehicle.LscType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Known Values for lsc_type field.

Not really sure, what this value really contains.

ACTIVATED = 'ACTIVATED'
NOT_CAPABLE = 'NOT_CAPABLE'
NOT_SUPPORTED = 'NOT_SUPPORTED'
UNKNOWN = 'UNKNOWN'
class bimmer_connected.vehicle.vehicle.MyBMWVehicle(account: MyBMWAccount, vehicle_base: dict, fetched_at: datetime | None = None)[source]

Models state and remote services of one vehicle.

Parameters:
  • account – MyBMW account this vehicle belongs to

  • attributes – attributes of the vehicle as provided by the server

property available_attributes: List[str]

Get the list of non-drivetrain attributes available for this vehicle.

property brand: CarBrands

Get the car brand.

combine_data(data: Dict | List[Dict], fetched_at: datetime | None = None) Dict[source]

Combine API responses and additional information to a single dictionary.

property drive_train: DriveTrainType

Get the type of drive train of the vehicle.

property drive_train_attributes: List[str]

Get list of attributes available for the drive train of the vehicle.

The list of available attributes depends if on the type of drive train. Some attributes only exist for electric/hybrid vehicles, others only if you have a combustion engine. Depending on the state of the vehicle, some of the attributes might still be None.

async get_vehicle_image(direction: VehicleViewDirection) bytes[source]

Get a rendered image of the vehicle.

:returns bytes containing the image in PNG format.

async get_vehicle_state() None[source]

Retrieve vehicle data from BMW servers.

property has_combustion_drivetrain: bool

Return True if vehicle is equipped with an internal combustion engine.

In this case we can get the state of the gas tank.

property has_electric_drivetrain: bool

Return True if vehicle is equipped with a high voltage battery.

In this case we can get the state of the battery in the state attributes.

property is_charging_plan_supported: bool

Return True if charging profile is available and can be set via API.

property is_charging_settings_supported: bool

Return True if charging settings can be set via API.

property is_lsc_enabled: bool

Return True if LastStateCall is enabled (vehicle automatically updates API).

property is_remote_charge_start_enabled: bool

Return True if charging can be started via the API.

property is_remote_charge_stop_enabled: bool

Return True if charging can be stop via the API.

property is_remote_climate_start_enabled: bool

Return True if AC/ventilation can be started via the API.

property is_remote_climate_stop_enabled: bool

Return True if AC/ventilation can be stopped via the API.

property is_remote_horn_enabled: bool

Return True if the horn can be activated via the API.

property is_remote_lights_enabled: bool

Return True if the lights can be activated via the API.

property is_remote_lock_enabled: bool

Return True if vehicle can be locked via the API.

property is_remote_sendpoi_enabled: bool

Return True if POIs can be set via the API.

property is_remote_set_ac_limit_enabled: bool

Return True if AC limit can be set via the API.

property is_remote_set_target_soc_enabled: bool

Return True if Target SoC can be set via the API.

property is_remote_unlock_enabled: bool

Return True if POIs can be unlocked via the API.

property is_vehicle_active: bool

Deprecated, always returns False.

Check if the vehicle is active/moving.

If the vehicle was active/moving at the time of the last status update, current position is not available.

property is_vehicle_tracking_enabled: bool

Return True if vehicle finder is enabled in vehicle.

property lsc_type: LscType

Get the lscType of the vehicle.

Not really sure what that value really means. If it is NOT_CAPABLE, that probably means that the vehicle state will not contain much data.

property mileage: ValueWithUnit

Get the mileage of the vehicle.

property name: str

Get the name of the vehicle.

property timestamp: datetime | None

Get the timestamp when the data was recorded.

update_state(data: Dict | List[Dict], fetched_at: datetime | None = None) None[source]

Update the state of a vehicle.

property vin: str

Get the VIN (vehicle identification number) of the vehicle.

class bimmer_connected.vehicle.vehicle.VehicleViewDirection(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Viewing angles for the vehicle.

This is used to get a rendered image of the vehicle.

FRONT = 'FrontView'
FRONTSIDE = 'AngleSideViewForty'
SIDE = 'SideViewLeft'
UNKNOWN = 'UNKNOWN'

bimmer_connected.vehicle.remote_services

Trigger remote services on a vehicle.

class bimmer_connected.vehicle.remote_services.ExecutionState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Enumeration of possible states of the execution of a remote service.

DELIVERED = 'DELIVERED'
ERROR = 'ERROR'
EXECUTED = 'EXECUTED'
IGNORED = 'IGNORED'
INITIATED = 'INITIATED'
PENDING = 'PENDING'
UNKNOWN = 'UNKNOWN'
class bimmer_connected.vehicle.remote_services.RemoteServiceStatus(response: dict, event_id: str | None = None)[source]

Wraps the status of the execution of a remote service.

class bimmer_connected.vehicle.remote_services.RemoteServices(vehicle: MyBMWVehicle)[source]

Trigger remote services on a vehicle.

async trigger_charge_start() RemoteServiceStatus[source]

Trigger the vehicle to start charging.

async trigger_charge_stop() RemoteServiceStatus[source]

Trigger the vehicle to stop charging.

async trigger_charging_profile_update(charging_mode: ChargingMode | None = None, precondition_climate: bool | None = None) RemoteServiceStatus[source]

Update the charging profile on the vehicle.

async trigger_charging_settings_update(target_soc: int | None = None, ac_limit: int | None = None) RemoteServiceStatus[source]

Update the charging settings on the vehicle.

async trigger_remote_air_conditioning() RemoteServiceStatus[source]

Trigger the air conditioning to start.

async trigger_remote_air_conditioning_stop() RemoteServiceStatus[source]

Trigger the air conditioning to stop.

async trigger_remote_door_lock() RemoteServiceStatus[source]

Trigger the vehicle to lock its doors.

async trigger_remote_door_unlock() RemoteServiceStatus[source]

Trigger the vehicle to unlock its doors.

async trigger_remote_horn() RemoteServiceStatus[source]

Trigger the vehicle to sound its horn.

async trigger_remote_light_flash() RemoteServiceStatus[source]

Trigger the vehicle to flash its headlights.

async trigger_remote_service(service_id: Services, params: Dict | None = None, data: Any = None, refresh: bool = False) RemoteServiceStatus[source]

Trigger a remote service and wait for the result.

async trigger_remote_vehicle_finder() RemoteServiceStatus[source]

Trigger the vehicle finder.

async trigger_send_poi(poi: PointOfInterest | Dict) RemoteServiceStatus[source]

Send a PointOfInterest to the vehicle.

Parameters:

poi – A PointOfInterest containing at least ‘lat’ and ‘lon’ and optionally ‘name’, ‘street’, ‘city’, ‘postalCode’, ‘country’

class bimmer_connected.vehicle.remote_services.Services(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Enumeration of possible services to be executed.

AIR_CONDITIONING = 'climate-now'
CHARGE_START = 'start-charging'
CHARGE_STOP = 'stop-charging'
CHARGING_PROFILE = 'CHARGING_PROFILE'
CHARGING_SETTINGS = 'CHARGING_SETTINGS'
DOOR_LOCK = 'door-lock'
DOOR_UNLOCK = 'door-unlock'
HORN = 'horn-blow'
LIGHT_FLASH = 'light-flash'
SEND_POI = 'SEND_POI'
VEHICLE_FINDER = 'vehicle-finder'

bimmer_connected.vehicle.charging_profile

Models the charging profiles of a vehicle.

class bimmer_connected.vehicle.charging_profile.ChargingMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Charging mode of electric vehicle.

DELAYED_CHARGING = 'DELAYED_CHARGING'
IMMEDIATE_CHARGING = 'IMMEDIATE_CHARGING'
UNKNOWN = 'UNKNOWN'
class bimmer_connected.vehicle.charging_profile.ChargingPreferences(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Charging preferences of electric vehicle.

CHARGING_WINDOW = 'CHARGING_WINDOW'
NO_PRESELECTION = 'NO_PRESELECTION'
UNKNOWN = 'UNKNOWN'
class bimmer_connected.vehicle.charging_profile.ChargingProfile(is_pre_entry_climatization_enabled: bool, timer_type: TimerTypes, departure_times: List[DepartureTimer], preferred_charging_window: ChargingWindow, charging_preferences: ChargingPreferences, charging_mode: ChargingMode, ac_current_limit: int | None = None, ac_available_limits: list | None = None, charging_preferences_service_pack: str | None = None)[source]

Models the charging profile of a vehicle.

ac_available_limits: list | None = None

Available AC limits to be selected.

ac_current_limit: int | None = None

Returns the ac current limit.

charging_mode: ChargingMode

Returns the preferred charging mode.

charging_preferences: ChargingPreferences

Returns the preferred charging preferences.

charging_preferences_service_pack: str | None = None

Service Pack required for remote service format.

departure_times: List[DepartureTimer]

List of timers.

format_for_remote_service() dict[source]

Format current charging profile as base to be sent to remote service.

is_pre_entry_climatization_enabled: bool

Get status of pre-entry climatization.

preferred_charging_window: ChargingWindow

Returns the preferred charging window.

timer_type: TimerTypes

Returns the current timer plan type.

class bimmer_connected.vehicle.charging_profile.ChargingWindow(window_dict: dict)[source]

A charging window.

property end_time: time

End of the charging window.

property start_time: time

Start of the charging window.

class bimmer_connected.vehicle.charging_profile.DepartureTimer(timer_dict: dict)[source]

A departure timer.

property action: str | None

What does the timer do.

property start_time: time | None

Deperture time for this timer.

property timer_id: int | None

ID of this timer.

property weekdays: List[str]

Active weekdays for this timer.

class bimmer_connected.vehicle.charging_profile.TimerTypes(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Different timer types.

TWO_TIMES_TIMER = 'TWO_TIMES_TIMER'
UNKNOWN = 'UNKNOWN'
WEEKLY_PLANNER = 'WEEKLY_PLANNER'

bimmer_connected.vehicle.doors_windows

Models the state of a vehicle.

class bimmer_connected.vehicle.doors_windows.DoorsAndWindows(door_lock_state: ~bimmer_connected.vehicle.doors_windows.LockState = LockState.UNKNOWN, lids: ~typing.List[~bimmer_connected.vehicle.doors_windows.Lid] = <factory>, windows: ~typing.List[~bimmer_connected.vehicle.doors_windows.Window] = <factory>)[source]

Provides an accessible version of properties.doorsAndWindows.

property all_lids_closed: bool

Check if all lids are closed.

property all_windows_closed: bool

Check if all windows are closed.

door_lock_state: LockState = 'UNKNOWN'

Get state of the door locks.

lids: List[Lid]

All lids (doors+hood+trunk) of the car.

property open_lids: List[Lid]

Get all open lids of the car.

property open_windows: List[Window]

Get all open windows of the car.

windows: List[Window]

All windows (doors+sunroof) of the car.

class bimmer_connected.vehicle.doors_windows.Lid(name: str, state: str)[source]

A lid of the vehicle.

Lids are: Doors + Trunk + Hatch

property is_closed: bool

Check if the lid is closed.

name

name of the lid

class bimmer_connected.vehicle.doors_windows.LidState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Possible states of the hatch, trunk, doors, windows, sun roof.

CLOSED = 'CLOSED'
INTERMEDIATE = 'INTERMEDIATE'
INVALID = 'INVALID'
OPEN = 'OPEN'
OPEN_TILT = 'OPEN_TILT'
UNKNOWN = 'UNKNOWN'
class bimmer_connected.vehicle.doors_windows.LockState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Possible states of the door locks.

LOCKED = 'LOCKED'
PARTIALLY_LOCKED = 'PARTIALLY_LOCKED'
SECURED = 'SECURED'
SELECTIVE_LOCKED = 'SELECTIVE_LOCKED'
UNKNOWN = 'UNKNOWN'
UNLOCKED = 'UNLOCKED'
class bimmer_connected.vehicle.doors_windows.Window(name: str, state: str)[source]

A window of the vehicle.

A window can be a normal window of the car or the sun roof.

bimmer_connected.vehicle.fuel_and_battery

Generals models used for bimmer_connected.

class bimmer_connected.vehicle.fuel_and_battery.ChargingState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Charging state of electric vehicle.

CHARGING = 'CHARGING'
COMPLETE = 'COMPLETE'
DEFAULT = 'DEFAULT'
ERROR = 'ERROR'
FINISHED_FULLY_CHARGED = 'FINISHED_FULLY_CHARGED'
FINISHED_NOT_FULL = 'FINISHED_NOT_FULL'
FULLY_CHARGED = 'FULLY_CHARGED'
INVALID = 'INVALID'
NOT_CHARGING = 'NOT_CHARGING'
PLUGGED_IN = 'PLUGGED_IN'
TARGET_REACHED = 'TARGET_REACHED'
UNKNOWN = 'UNKNOWN'
WAITING_FOR_CHARGING = 'WAITING_FOR_CHARGING'
class bimmer_connected.vehicle.fuel_and_battery.FuelAndBattery(remaining_range_fuel: ValueWithUnit | None = (None, None), remaining_range_electric: ValueWithUnit | None = (None, None), remaining_range_total: ValueWithUnit | None = (None, None), remaining_fuel: ValueWithUnit | None = (None, None), remaining_fuel_percent: int | None = None, remaining_battery_percent: int | None = None, charging_status: ChargingState | None = None, charging_start_time_no_tz: datetime | None = None, charging_end_time: datetime | None = None, is_charger_connected: bool = False, charging_target: int | None = None, account_timezone: timezone = datetime.timezone.utc)[source]

Provides an accessible version of status.FuelAndBattery.

account_timezone: timezone = datetime.timezone.utc
charging_end_time: datetime | None = None

The estimated time the vehicle will have finished charging.

property charging_start_time: datetime | None

The planned time the vehicle will start charging.

charging_start_time_no_tz: datetime | None = None

The planned time the vehicle will start charging without time zone information.

charging_status: ChargingState | None = None

Charging state of the vehicle.

charging_target: int | None = None

State of charging target in percent.

classmethod from_vehicle_data(vehicle_data: Dict)[source]

Create the class based on vehicle data from API.

is_charger_connected: bool = False

Get status of the connection

remaining_battery_percent: int | None = None

State of charge of the high voltage battery in percent.

remaining_fuel: ValueWithUnit | None = (None, None)

Get the remaining fuel of the vehicle.

remaining_fuel_percent: int | None = None

State of charge of the high voltage battery in percent.

remaining_range_electric: ValueWithUnit | None = (None, None)

Get the remaining range of the vehicle on electricity.

remaining_range_fuel: ValueWithUnit | None = (None, None)

Get the remaining range of the vehicle on fuel.

remaining_range_total: ValueWithUnit | None = (None, None)

Get the total remaining range of the vehicle (fuel + electricity, if available).

bimmer_connected.vehicle.location

Generals models used for bimmer_connected.

class bimmer_connected.vehicle.location.VehicleLocation(location: GPSPosition | None = None, heading: int | None = None, vehicle_update_timestamp: datetime | None = None, account_region: Regions | None = None, remote_service_position: Dict | None = None)[source]

The current position of a vehicle.

account_region: Regions | None = None
classmethod from_vehicle_data(vehicle_data: Dict)[source]

Create the class based on vehicle data from API.

heading: int | None = None

The last known heading/direction of the vehicle.

location: GPSPosition | None = None

The last known position of the vehicle.

remote_service_position: Dict | None = None
set_remote_service_position(remote_service_dict: Dict)[source]

Store remote service position returned from vehicle finder service.

vehicle_update_timestamp: datetime | None = None

bimmer_connected.vehicle.reports

Models the state of a vehicle.

class bimmer_connected.vehicle.reports.CheckControlMessage(description_short: str, description_long: str | None, state: CheckControlStatus)[source]

Check control message sent from the server.

description_long: str | None
description_short: str
classmethod from_api_entry(type: str, severity: str, longDescription: str | None = None, **kwargs)[source]

Parse a check control entry from the API format to CheckControlMessage.

state: CheckControlStatus
class bimmer_connected.vehicle.reports.CheckControlMessageReport(messages: ~typing.List[~bimmer_connected.vehicle.reports.CheckControlMessage] = <factory>, has_check_control_messages: bool = False)[source]

Parse and summarizes check control messages (e.g. low tire pressure).

has_check_control_messages: bool = False

Indicate if check control messages are present.

messages: List[CheckControlMessage]

List of check control messages.

class bimmer_connected.vehicle.reports.CheckControlStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Status of the condition based services.

CRITICAL = 'CRITICAL'
HIGH = 'HIGH'
LOW = 'LOW'
MEDIUM = 'MEDIUM'
OK = 'OK'
UNKNOWN = 'UNKNOWN'
class bimmer_connected.vehicle.reports.ConditionBasedService(service_type: str, state: ConditionBasedServiceStatus, due_date: datetime | None, due_distance: ValueWithUnit)[source]

Entry in the list of condition based services.

due_date: datetime | None
due_distance: ValueWithUnit
classmethod from_api_entry(type: str, status: str, dateTime: str | None = None, mileage: int | None = None, **kwargs)[source]

Parse a condition based service entry from the API format to ConditionBasedService.

service_type: str
state: ConditionBasedServiceStatus
class bimmer_connected.vehicle.reports.ConditionBasedServiceReport(messages: ~typing.List[~bimmer_connected.vehicle.reports.ConditionBasedService] = <factory>, is_service_required: bool = False)[source]

Parse and summarizes condition based services (e.g. next oil service).

is_service_required: bool = False

Indicate if a service is required.

messages: List[ConditionBasedService]

List of the condition based services.

class bimmer_connected.vehicle.reports.ConditionBasedServiceStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Status of the condition based services.

OK = 'OK'
OVERDUE = 'OVERDUE'
PENDING = 'PENDING'
UNKNOWN = 'UNKNOWN'
class bimmer_connected.vehicle.reports.Headunit(idrive_version: str = '', headunit_type: str = '', software_version: str = '')[source]

Parse and summarizes headunit hard/software versions.

headunit_type: str = ''

Type of headunit.

idrive_version: str = ''

IDRIVE generation.

software_version: str = ''

Current software revision of vehicle