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[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, vehicle_state: dict, fetched_at: Optional[datetime.datetime] = 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
available_attributes

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

brand

Get the car brand.

static combine_data(account: MyBMWAccount, vehicle_base: dict, vehicle_state: dict, fetched_at: Optional[datetime.datetime] = None) → Dict[KT, VT][source]

Combine API responses and additional information to a single dictionary.

drive_train

Get the type of drive train of the vehicle.

drive_train_attributes

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.

get_vehicle_image(direction: bimmer_connected.vehicle.vehicle.VehicleViewDirection) → bytes[source]

Get a rendered image of the vehicle.

:returns bytes containing the image in PNG format.

has_combustion_drivetrain

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

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

has_electric_drivetrain

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.

has_hv_battery
has_internal_combustion_engine
has_range_extender
has_weekly_planner_service
is_charging_plan_supported

Return True if charging control (weekly planner) is available.

is_lsc_enabled

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

is_vehicle_active

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.

is_vehicle_tracking_enabled

Return True if vehicle finder is enabled in vehicle.

lsc_type

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.

mileage

Get the mileage of the vehicle.

name

Get the name of the vehicle.

timestamp

Get the timestamp when the data was recorded.

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

Update the state of a vehicle.

vin

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

class bimmer_connected.vehicle.vehicle.VehicleViewDirection[source]

Viewing angles for the vehicle.

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

FRONT = 'VehicleInfo'
FRONTSIDE = 'VehicleStatus'
SIDE = 'ChargingHistory'
UNKNOWN = 'UNKNOWN'

bimmer_connected.vehicle.remote_services

Trigger remote services on a vehicle.

class bimmer_connected.vehicle.remote_services.ExecutionState[source]

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

DELIVERED = 'DELIVERED'
ERROR = 'ERROR'
EXECUTED = 'EXECUTED'
INITIATED = 'INITIATED'
PENDING = 'PENDING'
UNKNOWN = 'UNKNOWN'
class bimmer_connected.vehicle.remote_services.RemoteServiceStatus(response: dict)[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.

trigger_charge_now() → bimmer_connected.vehicle.remote_services.RemoteServiceStatus[source]

Trigger the vehicle to start charging.

A state update is NOT triggered after this, as the vehicle state is unchanged.

trigger_remote_air_conditioning() → bimmer_connected.vehicle.remote_services.RemoteServiceStatus[source]

Trigger the air conditioning to start.

A state update is NOT triggered after this, as the vehicle state is unchanged.

trigger_remote_air_conditioning_stop() → bimmer_connected.vehicle.remote_services.RemoteServiceStatus[source]

Trigger the air conditioning to stop.

A state update is NOT triggered after this, as the vehicle state is unchanged.

trigger_remote_door_lock() → bimmer_connected.vehicle.remote_services.RemoteServiceStatus[source]

Trigger the vehicle to lock its doors.

A state update is triggered after this, as the lock state of the vehicle changes.

trigger_remote_door_unlock() → bimmer_connected.vehicle.remote_services.RemoteServiceStatus[source]

Trigger the vehicle to unlock its doors.

A state update is triggered after this, as the lock state of the vehicle changes.

trigger_remote_horn() → bimmer_connected.vehicle.remote_services.RemoteServiceStatus[source]

Trigger the vehicle to sound its horn.

A state update is NOT triggered after this, as the vehicle state is unchanged.

trigger_remote_light_flash() → bimmer_connected.vehicle.remote_services.RemoteServiceStatus[source]

Trigger the vehicle to flash its headlights.

A state update is NOT triggered after this, as the vehicle state is unchanged.

trigger_remote_service(service_id: bimmer_connected.vehicle.remote_services.Services, params: Optional[Dict[KT, VT]] = None) → bimmer_connected.vehicle.remote_services.RemoteServiceStatus[source]

Trigger a generic remote service and wait for the result.

trigger_remote_vehicle_finder() → bimmer_connected.vehicle.remote_services.RemoteServiceStatus[source]

Trigger the vehicle finder.

A state update is triggered after this, as the location state of the vehicle changes.

trigger_send_poi(poi: Union[bimmer_connected.models.PointOfInterest, Dict[KT, VT]]) → bimmer_connected.vehicle.remote_services.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’

A state update is NOT triggered after this, as the vehicle state is unchanged.

class bimmer_connected.vehicle.remote_services.Services[source]

Enumeration of possible services to be executed.

AIR_CONDITIONING = 'climate-now'
CHARGE_NOW = 'CHARGE_NOW'
DOOR_LOCK = 'door-lock'
DOOR_UNLOCK = 'door-unlock'
HORN = 'horn-blow'
LIGHT_FLASH = 'light-flash'
VEHICLE_FINDER = 'vehicle-finder'

bimmer_connected.vehicle.charging_profile

Models the charging profiles of a vehicle.

class bimmer_connected.vehicle.charging_profile.ChargingMode[source]

Charging mode of electric vehicle.

DELAYED_CHARGING = 'DELAYED_CHARGING'
IMMEDIATE_CHARGING = 'IMMEDIATE_CHARGING'
UNKNOWN = 'UNKNOWN'
class bimmer_connected.vehicle.charging_profile.ChargingPreferences[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: bimmer_connected.vehicle.charging_profile.TimerTypes, departure_times: List[bimmer_connected.vehicle.charging_profile.DepartureTimer], preferred_charging_window: bimmer_connected.vehicle.charging_profile.ChargingWindow, charging_preferences: bimmer_connected.vehicle.charging_profile.ChargingPreferences, charging_mode: bimmer_connected.vehicle.charging_profile.ChargingMode)[source]

Models the charging profile of a vehicle.

charging_mode = None

Returns the preferred charging mode.

charging_preferences = None

Returns the preferred charging preferences.

departure_times = None

List of timers.

is_pre_entry_climatization_enabled = None

Get status of pre-entry climatization.

preferred_charging_window = None

Returns the preferred charging window.

timer_type = None

Returns the current timer plan type.

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

A charging window.

end_time

End of the charging window.

start_time

Start of the charging window.

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

A departure timer.

action

What does the timer do.

start_time

Deperture time for this timer.

timer_id

ID of this timer.

weekdays

Active weekdays for this timer.

class bimmer_connected.vehicle.charging_profile.TimerTypes[source]

Different timer types.

ONE_WEEK = 'WEEKLY_PLANNER'
OVERRIDE_TIMER = 'OVERRIDE_TIMER'
TWO_TIMES_TIMER = 'TWO_TIMES_TIMER'
TWO_WEEKS = 'TWO_WEEKS_TIMER'
UNKNOWN = 'UNKNOWN'

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: 'UNKNOWN'>, lids: List[bimmer_connected.vehicle.doors_windows.Lid] = <factory>, windows: List[bimmer_connected.vehicle.doors_windows.Window] = <factory>)[source]

Provides an accessible version of properties.doorsAndWindows.

all_lids_closed

Check if all lids are closed.

all_windows_closed

Check if all windows are closed.

door_lock_state = 'UNKNOWN'

Get state of the door locks.

lids = None

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

open_lids

Get all open lids of the car.

open_windows

Get all open windows of the car.

windows = None

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

is_closed

Check if the lid is closed.

name = None

name of the lid

class bimmer_connected.vehicle.doors_windows.LidState[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[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[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: Optional[bimmer_connected.models.ValueWithUnit] = ValueWithUnit(value=None, unit=None), remaining_range_electric: Optional[bimmer_connected.models.ValueWithUnit] = ValueWithUnit(value=None, unit=None), remaining_range_total: Optional[bimmer_connected.models.ValueWithUnit] = ValueWithUnit(value=None, unit=None), remaining_fuel: Optional[bimmer_connected.models.ValueWithUnit] = ValueWithUnit(value=None, unit=None), remaining_fuel_percent: Optional[int] = None, remaining_battery_percent: Optional[int] = None, charging_status: Optional[bimmer_connected.vehicle.fuel_and_battery.ChargingState] = None, charging_start_time_no_tz: Optional[datetime.datetime] = None, charging_end_time: Optional[datetime.datetime] = None, is_charger_connected: bool = False, account_timezone: datetime.timezone = datetime.timezone.utc)[source]

Provides an accessible version of status.FuelAndBattery.

account_timezone = datetime.timezone.utc
charging_end_time = None

The estimated time the vehicle will have finished charging.

charging_start_time

The planned time the vehicle will start charging.

charging_start_time_no_tz = None

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

charging_status = None

Charging state of the vehicle.

classmethod from_vehicle_data(vehicle_data: Dict[KT, VT])[source]

Creates the class based on vehicle data from API.

is_charger_connected = False

Get status of the connection

remaining_battery_percent = None

State of charge of the high voltage battery in percent.

remaining_fuel = ValueWithUnit(value=None, unit=None)

Get the remaining fuel of the vehicle.

remaining_fuel_percent = None

State of charge of the high voltage battery in percent.

remaining_range_electric = ValueWithUnit(value=None, unit=None)

Get the remaining range of the vehicle on electricity.

remaining_range_fuel = ValueWithUnit(value=None, unit=None)

Get the remaining range of the vehicle on fuel.

remaining_range_total = ValueWithUnit(value=None, unit=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: Optional[bimmer_connected.models.GPSPosition] = None, heading: Optional[int] = None, vehicle_update_timestamp: Optional[datetime.datetime] = None, account_region: Optional[bimmer_connected.const.Regions] = None, remote_service_position: Optional[Dict[KT, VT]] = None)[source]

The current position of a vehicle.

account_region = None
classmethod from_vehicle_data(vehicle_data: Dict[KT, VT])[source]

Creates the class based on vehicle data from API.

heading = None

The last known heading/direction of the vehicle.

location = None

The last known position of the vehicle.

remote_service_position = None
set_remote_service_position(remote_service_dict: Dict[KT, VT])[source]

Store remote service position returned from vehicle finder service.

vehicle_update_timestamp = None

bimmer_connected.vehicle.reports

Models the state of a vehicle.

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

Check control message sent from the server.

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

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

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

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

has_check_control_messages = False

Indicates if check control messages are present.

messages = None

List of check control messages.

class bimmer_connected.vehicle.reports.CheckControlStatus[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: bimmer_connected.vehicle.reports.ConditionBasedServiceStatus, due_date: Optional[datetime.datetime], due_distance: bimmer_connected.models.ValueWithUnit)[source]

Entry in the list of condition based services.

classmethod from_api_entry(type: str, status: str, dateTime: Optional[str] = None, mileage: Optional[int] = None, is_metric: bool = True, **kwargs)[source]

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

class bimmer_connected.vehicle.reports.ConditionBasedServiceReport(messages: List[bimmer_connected.vehicle.reports.ConditionBasedService] = <factory>, is_service_required: bool = False)[source]

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

is_service_required = False

Indicates if a service is required.

messages = None

List of the condition based services.

class bimmer_connected.vehicle.reports.ConditionBasedServiceStatus[source]

Status of the condition based services.

OK = 'OK'
OVERDUE = 'OVERDUE'
PENDING = 'PENDING'
UNKNOWN = 'UNKNOWN'