New Plugin - BMW Connected Drive

Posted on
Mon Dec 09, 2019 7:54 pm
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

New Plugin - BMW Connected Drive

Testing release available: https://github.com/FlyingDiver/Indigo-B ... /tag/0.0.0

This version provides state information for the data retrieved from the Connected Drive portal. Activating services will be in a future release.

I have an X4 M40i. I have no idea what's different for an electric or hybrid vehicle.

What state should be the status value for the device?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Dec 10, 2019 12:25 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: New Plugin - BMW Connected Drive

Battery, for an EV.


Sent from my iPhone using Tapatalk Pro

Posted on
Tue Dec 10, 2019 6:32 am
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

howartp wrote:
Battery, for an EV.


How do I tell it's an EV?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Dec 10, 2019 10:26 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: New Plugin - BMW Connected Drive

I don’t know yet; I was going to do the BMW plugin and got my folder structure ready but not actually started reading the docs yet.


Sent from my iPhone using Tapatalk Pro

Posted on
Tue Dec 10, 2019 10:38 am
juntta offline
Posts: 143
Joined: Oct 13, 2014
Location: Finland

Re: New Plugin - BMW Connected Drive

FlyingDiver wrote:
howartp wrote:
Battery, for an EV.


How do I tell it's an EV?


driveTrain field in vehicle data should tell it.

See Get Vehicle Data: https://github.com/edent/BMW-i-Remote/blob/master/README.md

Posted on
Tue Dec 10, 2019 10:41 am
juntta offline
Posts: 143
Joined: Oct 13, 2014
Location: Finland

Re: New Plugin - BMW Connected Drive

juntta wrote:
FlyingDiver wrote:
howartp wrote:
Battery, for an EV.


How do I tell it's an EV?


driveTrain field in vehicle data should tell it.

See Get Vehicle Data: https://github.com/edent/BMW-i-Remote/blob/master/README.md


I’ll try to find time to pull out my 330e data or my wifes 530e for examples.

Posted on
Tue Dec 10, 2019 10:43 am
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

juntta wrote:
driveTrain field in vehicle data should tell it.

See Get Vehicle Data: https://github.com/edent/BMW-i-Remote/blob/master/README.md


Interesting. That's a different API call than the code I started with. I'll have to play around with this.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Dec 10, 2019 10:50 am
juntta offline
Posts: 143
Joined: Oct 13, 2014
Location: Finland

Re: New Plugin - BMW Connected Drive

FlyingDiver wrote:
juntta wrote:
driveTrain field in vehicle data should tell it.

See Get Vehicle Data: https://github.com/edent/BMW-i-Remote/blob/master/README.md


Interesting. That's a different API call than the code I started with. I'll have to play around with this.


That might actually be outdated but fields should be quite close the same.

There are plenty of new fields on car data with my g20 330e compared to f30 330e that I had. But trip data is totally different and the old API calls dont work with the new model. I haven’t found API calls for trip data yet.

Posted on
Tue Dec 10, 2019 1:20 pm
juntta offline
Posts: 143
Joined: Oct 13, 2014
Location: Finland

Re: New Plugin - BMW Connected Drive

Here is my car data:

Code: Select all
2019-12-10 21:11:54,185 - INFO - BMW ConnectedDrive API request_car_data(): connect to URL https://www.bmw-connecteddrive.fi/api/me/vehicles/v2
[
{"supportedChargingModes": ["AC_LOW"],
"hasNavi": true,
"modelName": "330e",
"bodyType": "Sedan",
"series": "3",
"brand": "BMW",
"basicType": "330E",
"vin": "[VINHERE]",
"hasSunRoof": false,
"steering": "LEFT",
"licensePlate": null,
"dcOnly": false,
"driveTrain": "PHEV",
"modelYearNA": "2020",
"doorCount": 4,
"maxFuel": null,
"hasRex": false},

{"supportedChargingModes": ["AC_LOW"],
"hasNavi": true,
"modelName": "530e iPerformance",
"bodyType": "Sedan",
"series": "5",
"brand": "BMW",
"basicType": "530E IPERFORMANCE",
"vin": "[VINHERE]",
"hasSunRoof": false,
"steering": "LEFT",
"licensePlate": null,
"dcOnly": false,
"driveTrain": "PHEV",
"modelYearNA": "2019",
"doorCount": 4,
"maxFuel": null,
"hasRex": false}
]

Posted on
Tue Dec 10, 2019 1:25 pm
juntta offline
Posts: 143
Joined: Oct 13, 2014
Location: Finland

Re: New Plugin - BMW Connected Drive

and more detailed info here

Code: Select all
G30 530e

2019-12-10 20:38:26,835 - INFO - BMW ConnectedDrive API request_car_data(): connect to URL https://www.bmw-connecteddrive.fi/api/vehicle/dynamic/v1/[VINHERE]?offset=-120
2019-12-10 20:38:26,835 - INFO - --------------START CAR DATA --------------
2019-12-10 20:38:26,836 - INFO - Segment_LastTrip_ratio_electric_driven_distance: 100
2019-12-10 20:38:26,836 - INFO - Segment_LastTrip_time_segment_end: 10.12.2019 16:04:00 UTC
2019-12-10 20:38:26,836 - INFO - Segment_LastTrip_time_segment_end_formatted: 10.12.2019 16:04
2019-12-10 20:38:26,836 - INFO - Segment_LastTrip_time_segment_end_formatted_date: 10.12.2019
2019-12-10 20:38:26,836 - INFO - Segment_LastTrip_time_segment_end_formatted_time: 16:04
2019-12-10 20:38:26,836 - INFO - battery_size_max: 9140
2019-12-10 20:38:26,836 - INFO - beMaxRangeElectric: 35.0
2019-12-10 20:38:26,836 - INFO - beMaxRangeElectricKm: 35.0
2019-12-10 20:38:26,836 - INFO - beMaxRangeElectricMile: 21.0
2019-12-10 20:38:26,836 - INFO - beRemainingRangeElectric: 34.0
2019-12-10 20:38:26,836 - INFO - beRemainingRangeElectricKm: 34.0
2019-12-10 20:38:26,836 - INFO - beRemainingRangeElectricMile: 21.0
2019-12-10 20:38:26,836 - INFO - beRemainingRangeFuel: 571.0
2019-12-10 20:38:26,836 - INFO - beRemainingRangeFuelKm: 571.0
2019-12-10 20:38:26,836 - INFO - beRemainingRangeFuelMile: 354.0
2019-12-10 20:38:26,836 - INFO - chargeNowAllowed: NOT_ALLOWED
2019-12-10 20:38:26,836 - INFO - chargingHVStatus: FINISHED_FULLY_CHARGED
2019-12-10 20:38:26,836 - INFO - chargingLevelHv: 100.0
2019-12-10 20:38:26,836 - INFO - chargingLogicCurrentlyActive: NOT_CHARGING
2019-12-10 20:38:26,836 - INFO - chargingSystemStatus: CHARGINGENDED
2019-12-10 20:38:26,836 - INFO - charging_connection_type: CONDUCTIVE
2019-12-10 20:38:26,836 - INFO - charging_inductive_positioning: not_positioned
2019-12-10 20:38:26,836 - INFO - charging_status: CHARGINGENDED
2019-12-10 20:38:26,836 - INFO - check_control_messages:
2019-12-10 20:38:26,836 - INFO - condition_based_services: 00001,OK,2021-03,29000;00100,OK,2023-03,60000;00003,OK,2022-03,
2019-12-10 20:38:26,836 - INFO - connectorStatus: CONNECTED
2019-12-10 20:38:26,836 - INFO - door_driver_front: CLOSED
2019-12-10 20:38:26,837 - INFO - door_driver_rear: CLOSED
2019-12-10 20:38:26,837 - INFO - door_lock_state: SECURED
2019-12-10 20:38:26,837 - INFO - door_passenger_front: CLOSED
2019-12-10 20:38:26,837 - INFO - door_passenger_rear: CLOSED
2019-12-10 20:38:26,837 - INFO - head_unit: NBTEvo
2019-12-10 20:38:26,837 - INFO - head_unit_pu_software: 03/19
2019-12-10 20:38:26,837 - INFO - heading: 281
2019-12-10 20:38:26,837 - INFO - hood_state: CLOSED
2019-12-10 20:38:26,837 - INFO - kombi_current_remaining_range_fuel: 571.0
2019-12-10 20:38:26,837 - INFO - lastChargingEndReason: CHARGING_GOAL_REACHED
2019-12-10 20:38:26,837 - INFO - lastChargingEndResult: SUCCESS
2019-12-10 20:38:26,837 - INFO - lastUpdateReason: CHARGINGDONE
2019-12-10 20:38:26,837 - INFO - lights_parking: OFF
2019-12-10 20:38:26,837 - INFO - lsc_trigger: CHARGINGDONE
2019-12-10 20:38:26,837 - INFO - mileage: 1477
2019-12-10 20:38:26,837 - INFO - prognosisWhileChargingStatus: NOT_NEEDED
2019-12-10 20:38:26,837 - INFO - remaining_fuel: 35
2019-12-10 20:38:26,837 - INFO - single_immediate_charging: isFalse
2019-12-10 20:38:26,837 - INFO - soc_hv_percent: 99.0
2019-12-10 20:38:26,837 - INFO - trunk_state: CLOSED
2019-12-10 20:38:26,837 - INFO - unitOfCombustionConsumption: l/100km
2019-12-10 20:38:26,837 - INFO - unitOfElectricConsumption: kWh/100km
2019-12-10 20:38:26,837 - INFO - unitOfEnergy: kWh
2019-12-10 20:38:26,837 - INFO - unitOfLength: km
2019-12-10 20:38:26,837 - INFO - updateTime: 10.12.2019 17:12:35 UTC
2019-12-10 20:38:26,837 - INFO - updateTime_converted: 10.12.2019 19:12
2019-12-10 20:38:26,837 - INFO - updateTime_converted_date: 10.12.2019
2019-12-10 20:38:26,837 - INFO - updateTime_converted_time: 19:12
2019-12-10 20:38:26,837 - INFO - updateTime_converted_timestamp: 1576005155000
2019-12-10 20:38:26,838 - INFO - vehicle_tracking: 0
2019-12-10 20:38:26,838 - INFO - window_driver_front: CLOSED
2019-12-10 20:38:26,838 - INFO - window_driver_rear: CLOSED
2019-12-10 20:38:26,838 - INFO - window_passenger_front: CLOSED
2019-12-10 20:38:26,838 - INFO - window_passenger_rear: CLOSED
2019-12-10 20:38:26,838 - INFO - --------------END CAR DATA --------------

Posted on
Tue Dec 10, 2019 10:05 pm
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

It's interesting that there's different data for different regions, or maybe models. Unless it's the API that's returning different data. We'll see when I have the next test release ready, hopefully tomorrow.

There's two distinct sets of data - one is the base vehicle info, which I don't think is ever supposed to change. The second is the "current status" data. I think most if not all of the "current status" data should be exposed in the plugin device's states. I'm not sure about the base vehicle info. Which was your first post of the two above. Does that need to be available in a vehicle device?

Another interesting item. Your vehicles have:

"driveTrain": "PHEV",

Mine has:

"driveTrain": "CONV",
"fuelType": "PETROL",

I guess that's because "conventional" could be gas (petrol) or diesel. But PHEV is only electric? There's a different type for Hybrid, I assume?

For the device state, for type PHEV, you would want that to be "chargingLevelHv: 100.0", right?

I'm not sure what makes sense for Conventional. There's "fuelPercent": 97, but do I really care? :)

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Dec 10, 2019 10:42 pm
juntta offline
Posts: 143
Joined: Oct 13, 2014
Location: Finland

Re: New Plugin - BMW Connected Drive

FlyingDiver wrote:
It's interesting that there's different data for different regions, or maybe models. Unless it's the API that's returning different data. We'll see when I have the next test release ready, hopefully tomorrow.

There's two distinct sets of data - one is the base vehicle info, which I don't think is ever supposed to change. The second is the "current status" data. I think most if not all of the "current status" data should be exposed in the plugin device's states. I'm not sure about the base vehicle info. Which was your first post of the two above. Does that need to be available in a vehicle device?

Another interesting item. Your vehicles have:

"driveTrain": "PHEV",

Mine has:

"driveTrain": "CONV",
"fuelType": "PETROL",

I guess that's because "conventional" could be gas (petrol) or diesel. But PHEV is only electric? There's a different type for Hybrid, I assume?

For the device state, for type PHEV, you would want that to be "chargingLevelHv: 100.0", right?

I'm not sure what makes sense for Conventional. There's "fuelPercent": 97, but do I really care? :)


PHEV is for hybrid, pure electric is BEV (I think)

Charging level makes sense for EVs. But fuel level could be the one for conventional. Actually for PHEVs the fuel level is needed too but I prefer charging level if you have to choose one.

Posted on
Wed Dec 11, 2019 12:33 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: New Plugin - BMW Connected Drive

juntta wrote:
PHEV is for hybrid, pure electric is BEV (I think)

Charging level makes sense for EVs. But fuel level could be the one for conventional. Actually for PHEVs the fuel level is needed too but I prefer charging level if you have to choose one.

Should be correct on both counts.

Nissan has two completely different APIs depending on age of the vehicle, the newer one (May 2019 onwards) being vastly superior and reliable once you got it setup, so it’s quite possible BMW are developing new features and data in the API for newer or electric vehicles.


Sent from my iPhone using Tapatalk Pro

Posted on
Wed Dec 11, 2019 4:03 pm
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

New pre-release: https://github.com/FlyingDiver/Indigo-B ... /tag/0.0.1

Vehicle device states have changed. Please delete old vehicle devices and create them again.

I expect state update errors from vehicles different from mine. I'll need info on different vehicles to address that. There's now a menu item to dump the vehicle data to the log. Please send me a PM with that data.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Dec 12, 2019 8:30 pm
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

I just tried the test release with my 2019 540i. Here's the output for the car from the plugin:

Code: Select all
Dec 12, 2019 at 9:15:37 PM
   BMW Connected Drive             Vehicle Data:
{
    "XXXXXXXXXXXX55588": {
        "DCS_CCH_Activation": "NA",
        "DCS_CCH_Ongoing": false,
        "cbsData": [
            {
                "cbsDescription": "Next service due when the stated distance has been covered or by the specified date.",
                "cbsDueDate": "2020-08",
                "cbsRemainingMileage": 2100,
                "cbsState": "OK",
                "cbsType": "OIL"
            },
            {
                "cbsDescription": "Next visual inspection due when the stated distance has been covered or by the stated date.",
                "cbsDueDate": "2021-08",
                "cbsRemainingMileage": 17000,
                "cbsState": "OK",
                "cbsType": "VEHICLE_CHECK"
            },
            {
                "cbsDescription": "Next change due at the latest by the stated date.",
                "cbsDueDate": "2021-07",
                "cbsState": "OK",
                "cbsType": "BRAKE_FLUID"
            }
        ],
        "checkControlMessages": [],
        "doorDriverFront": "CLOSED",
        "doorDriverRear": "CLOSED",
        "doorLockState": "UNLOCKED",
        "doorPassengerFront": "CLOSED",
        "doorPassengerRear": "CLOSED",
        "hood": "CLOSED",
        "internalDataTimeUTC": "2019-12-13T01:03:52",
        "mileage": 36939,
        "parkingLight": "OFF",
        "position": {
            "heading": 295,
            "lat": 39.007812,
            "lon": -77.376686,
            "status": "OK"
        },
        "positionLight": "OFF",
        "publicKey": "readacted",
        "rearWindow": "INVALID",
        "remainingFuel": 25,
        "remainingRangeFuel": 249,
        "remainingRangeFuelMls": 154,
        "singleImmediateCharging": false,
        "steering": "LH",
        "sunroof": "CLOSED",
        "trunk": "CLOSED",
        "updateReason": "VEHICLE_SHUTDOWN",
        "updateTime": "2019-12-13T01:03:52+0000",
        "vehicleCountry": "US",
        "vin": "XXXXXXXXXXXX55588",
        "windowDriverFront": "CLOSED",
        "windowDriverRear": "CLOSED",
        "windowPassengerFront": "CLOSED",
        "windowPassengerRear": "CLOSED"
    },
    "vehicles": [
        {
            "a4a": "BLUETOOTH",
            "asymEncryptionMethod": "RSA-2048",
            "bodytype": "G30",
            "brand": "BMW",
            "breakdownNumber": "+4989358957103",
            "carCloud": "ACTIVATED",
            "chargeNow": "NOT_SUPPORTED",
            "chargingControl": "NOT_SUPPORTED",
            "climateControl": "DEPARTURE_TIMER",
            "climateControlRES": "NOT_SUPPORTED",
            "climateFunction": "VENTILATION",
            "climateNow": "ACTIVATED",
            "climateNowRES": "NOT_SUPPORTED",
            "color": "BLACK SAPPHIRE METALLIC",
            "colorCode": "475",
            "countryCode": "V2-US",
            "dealer": {
                "city": "Suitland",
                "country": "US",
                "name": "Passport BMW",
                "phone": "+1 301 4232700",
                "postalCode": "20746",
                "street": "4730 Auth Place"
            },
            "doorLock": "ACTIVATED",
            "doorUnlock": "ACTIVATED",
            "driveTrain": "CONV",
            "egoVehiclePath": "G30",
            "fuelType": "PETROL",
            "hasAlarmSystem": true,
            "hmiVersion": "ID5",
            "hornBlow": "ACTIVATED",
            "hub": "HUB_US",
            "intermodalRouting": "NOT_AVAILABLE",
            "ipa": "NOT_SUPPORTED",
            "lastDestinations": "NOT_SUPPORTED",
            "lightFlash": "ACTIVATED",
            "lscType": "LSC_BASIS",
            "model": "540i xDrive",
            "onlineSearchMode": "MAP",
            "rangeMap": "NOT_SUPPORTED",
            "remote360": "ACTIVATED",
            "remote360packageEncryption": "ZIP",
            "remoteSoftwareUpgrade": "NOT_SUPPORTED",
            "sendPoi": "ACTIVATED",
            "smartSolution": "NOT_SUPPORTED",
            "statisticsAvailable": false,
            "statisticsCommunityEnabled": false,
            "steering": "LH",
            "vehicleFinder": "ACTIVATED",
            "vehicleFinderRestriction": "NONE",
            "vin": "XXXXXXXXXXXX55588",
            "yearOfConstruction": 2018
        }
    ]
}


Who is online

Users browsing this forum: No registered users and 3 guests