New Plugin - BMW Connected Drive

Posted on
Tue Dec 24, 2019 3:30 pm
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

Plugin reboot worked for me:

Code: Select all
Dec 24, 2019 at 4:27:38 PM
   BMW Connected Drive Debug       menuDumpVehicles
   BMW Connected Drive             Vehicle Data:
{
    "xxxx": {
        "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-12",
                "cbsRemainingMileage": 14000,
                "cbsState": "OK",
                "cbsType": "OIL"
            },
            {
                "cbsDescription": "Next visual inspection due when the stated distance has been covered or by the stated date.",
                "cbsDueDate": "2020-12",
                "cbsRemainingMileage": 14000,
                "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": "SECURED",
        "doorPassengerFront": "CLOSED",
        "doorPassengerRear": "CLOSED",
        "hood": "CLOSED",
        "internalDataTimeUTC": "2019-12-24T20:33:31",
        "mileage": 37965,
        "parkingLight": "OFF",
        "position": {
            "heading": 264,
            "lat": 40.289307,
            "lon": -74.316574,
            "status": "OK"
        },
        "positionLight": "OFF",
        "publicKey": "xxx",
        "rearWindow": "INVALID",
        "remainingFuel": 37,
        "remainingRangeFuel": 440,
        "remainingRangeFuelMls": 273,
        "singleImmediateCharging": false,
        "steering": "LH",
        "sunroof": "CLOSED",
        "trunk": "CLOSED",
        "updateReason": "VEHICLE_SHUTDOWN_SECURED",
        "updateTime": "2019-12-24T20:33:31+0000",
        "vehicleCountry": "US",
        "vin": "xxxx",
        "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": "ID4",
            "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": "xxxx",
            "yearOfConstruction": 2018
        }
    ]
}



Posted on
Tue Dec 24, 2019 4:37 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

You've got 'remainingRangeFuelMls', is that what you want?

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

Posted on
Tue Dec 24, 2019 8:22 pm
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

I think that's the remaining miles in the tank. I'm just looking to convert litres to miles. Here's how I did it in my script:

Code: Select all
if('remaining_fuel' in map):
                 indigo.variable.updateValue(1919960516, value=map['remaining_fuel'])
                #convert litres to gallons: litres/3.785411784
                litres = map["remaining_fuel"]
                gallons = int(litres)/3.785411784
                gallons = round(gallons,1)
                indigo.variable.updateValue(1224477707, value=str(gallons))

Posted on
Tue Dec 24, 2019 8:23 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

You mean liters to gallons, not miles, right?

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

Posted on
Wed Dec 25, 2019 10:15 am
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

Yes, apologies. Too much holiday "sauce"

Posted on
Wed Dec 25, 2019 11:47 am
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

One more thing I noticed. It appears that the field s_mileage is being reported in the plugin as kilometers.

my car has 23,590 miles. The plugin shows s_mileage = 37965

Posted on
Wed Dec 25, 2019 11:58 am
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

A few snippets I'm using that may save you some time:

Convert Km to Miles and store in variable:

Code: Select all
# convert kilomters to miles: kilometers * 0.62137
bmw = indigo.devices[105421725]
kilo = int(bmw.states["s_mileage"])
miles = int(kilo)*0.62137
miles = round(miles,1)
indigo.variable.updateValue(1758513378, value=str(miles))


Convert litres to gallons and store in variable:

Code: Select all
# convert litres to gallons: litres/3.785411784
bmw = indigo.devices[105421725]
litres = int(bmw.states["s_remainingFuel"])
gallons = int(litres)/3.785411784
gallons = round(gallons,1)
indigo.variable.updateValue(1224477707, value=str(gallons))


Convert ISO 8601 time and store in variable as EST:

Code: Select all
import time
import datetime
import dateutil.parser

# convert ISO-8601 to EST
bmw = indigo.devices[105421725]
strTime = str(bmw.states["s_updateTime"])
datetime_object = dateutil.parser.parse(strTime)
dateNewTime = datetime_object - datetime.timedelta(hours = 5)
strNewTime = dateNewTime.strftime("%m/%d/%Y %I:%M %p")
indigo.variable.updateValue(1198238432, value=strNewTime)

Posted on
Wed Dec 25, 2019 12:29 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

ryanbuckner wrote:
One more thing I noticed. It appears that the field s_mileage is being reported in the plugin as kilometers.

my car has 23,590 miles. The plugin shows s_mileage = 37965


Yeah, the API is returning km/liter/etc. Right now the plugin is putting the raw numbers in the states. I'm going to have to put a units preference in the plugin and then convert as needed.

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

Posted on
Tue Dec 31, 2019 2:30 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

Pre-release 0.0.4 - https://github.com/FlyingDiver/Indigo-B ... /tag/0.0.4

Set preferred units (US/Metric) in the plugin preferences.

Edit the vehicle device to select the preferred state to display as device status.

I think this is done for the first release, pending testing by users outside the US and electric/hybrid vehicles. Please report if you fit in either category.

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

Posted on
Tue Dec 31, 2019 2:41 pm
juntta offline
Posts: 143
Joined: Oct 13, 2014
Location: Finland

Re: New Plugin - BMW Connected Drive

FlyingDiver wrote:
I think this is done for the first release, pending testing by users outside the US and electric/hybrid vehicles. Please report if you fit in either category.


I’ll try to find some time to test it by end of the week with my -19 330e & -19 530e

Posted on
Thu Jan 02, 2020 11:25 am
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

The 0.0.4 tagged plugin is still version 0.0.3 in Github

Posted on
Thu Jan 02, 2020 11:37 am
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

Fixed, I think.

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

Posted on
Thu Jan 02, 2020 3:02 pm
ryanbuckner offline
Posts: 1080
Joined: Oct 08, 2011
Location: Northern Virginia

Re: New Plugin - BMW Connected Drive

This works. It does throw an error until you pick your state key. Maybe default to one?

Posted on
Thu Jan 02, 2020 3:06 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - BMW Connected Drive

ryanbuckner wrote:
This works. It does throw an error until you pick your state key. Maybe default to one?


Oops, yeah, I need to do something there.

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

Posted on
Mon Jan 06, 2020 7:26 am
juntta offline
Posts: 143
Joined: Oct 13, 2014
Location: Finland

Re: New Plugin - BMW Connected Drive

I managed to find some time now to try this plugin out. It throws some errors in log after I created vehicle:

Code: Select all
Failed to establish a new connection: [Errno 60] Operation timed out',))
   BMW Connected Drive Error       Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
  File "plugin.py", line 120, in runConcurrentThread
  File "plugin.py", line 175, in updateVehicle
TypeError: state value type must be bool, int, real, or string

   BMW Connected Drive Error       plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)

6 Jan 2020 at 15.11.00
   BMW Connected Drive Error       Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
  File "plugin.py", line 120, in runConcurrentThread
  File "plugin.py", line 175, in updateVehicle
TypeError: state value type must be bool, int, real, or string


Maybe due to slow response from BMW Connected Drive service?

My car data now, both are PHEVs, deleted VINs, location data & car SIM(?, breakdown number) numbers:

Code: Select all
   BMW Connected Drive             Vehicle Data:
{
    "xxx": {
        "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": "2021-07",
                "cbsRemainingMileage": 23000,
                "cbsState": "OK",
                "cbsType": "OIL"
            },
            {
                "cbsDescription": "Next visual inspection due when the stated distance has been covered or by the stated date.",
                "cbsDueDate": "2023-07",
                "cbsRemainingMileage": 60000,
                "cbsState": "OK",
                "cbsType": "VEHICLE_CHECK"
            },
            {
                "cbsDescription": "Next change due at the latest by the stated date.",
                "cbsDueDate": "2022-07",
                "cbsState": "OK",
                "cbsType": "BRAKE_FLUID"
            }
        ],
        "chargingConnectionType": "CONDUCTIVE",
        "chargingInductivePositioning": "NOT_POSITIONED",
        "chargingLevelHv": 100,
        "chargingStatus": "FINISHED_FULLY_CHARGED",
        "checkControlMessages": [],
        "connectionStatus": "CONNECTED",
        "doorDriverFront": "CLOSED",
        "doorDriverRear": "CLOSED",
        "doorLockState": "SECURED",
        "doorPassengerFront": "CLOSED",
        "doorPassengerRear": "CLOSED",
        "fuelPercent": 25,
        "hood": "CLOSED",
        "internalDataTimeUTC": "2020-01-06T12:35:51",
        "lastChargingEndReason": "CHARGING_GOAL_REACHED",
        "lastChargingEndResult": "SUCCESS",
        "mileage": 8459,
        "parkingLight": "OFF",
        "position": {
            "heading": 100,
            "lat": LAT,
            "lon": LON,
            "status": "OK"
        },
        "positionLight": "OFF",
        "rearWindow": "INVALID",
        "remainingFuel": 9,
        "remainingRangeElectric": 42,
        "remainingRangeElectricMls": 26,
        "remainingRangeFuel": 184,
        "remainingRangeFuelMls": 114,
        "singleImmediateCharging": false,
        "trunk": "CLOSED",
        "updateReason": "DOOR_STATE_CHANGED",
        "updateTime": "2020-01-06T12:35:51+0000",
        "vehicleCountry": "FI",
        "vin": "xxx",
        "windowDriverFront": "CLOSED",
        "windowDriverRear": "CLOSED",
        "windowPassengerFront": "CLOSED",
        "windowPassengerRear": "CLOSED"
    },
    "yyy": {
        "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": "2021-03",
                "cbsRemainingMileage": 29000,
                "cbsState": "OK",
                "cbsType": "OIL"
            },
            {
                "cbsDescription": "Next visual inspection due when the stated distance has been covered or by the stated date.",
                "cbsDueDate": "2023-03",
                "cbsRemainingMileage": 60000,
                "cbsState": "OK",
                "cbsType": "VEHICLE_CHECK"
            },
            {
                "cbsDescription": "Next change due at the latest by the stated date.",
                "cbsDueDate": "2022-03",
                "cbsState": "OK",
                "cbsType": "BRAKE_FLUID"
            }
        ],
        "chargingConnectionType": "CONDUCTIVE",
        "chargingInductivePositioning": "NOT_POSITIONED",
        "chargingLevelHv": 56,
        "chargingStatus": "CHARGING",
        "chargingTimeRemaining": 115,
        "checkControlMessages": [],
        "connectionStatus": "CONNECTED",
        "doorDriverFront": "CLOSED",
        "doorDriverRear": "CLOSED",
        "doorLockState": "SECURED",
        "doorPassengerFront": "CLOSED",
        "doorPassengerRear": "CLOSED",
        "hood": "CLOSED",
        "internalDataTimeUTC": "2020-01-06T12:36:06",
        "lastChargingEndReason": "UNKNOWN",
        "lastChargingEndResult": "UNKNOWN",
        "maxRangeElectric": 27,
        "maxRangeElectricMls": 17,
        "mileage": 2183,
        "parkingLight": "OFF",
        "position": {
            "heading": 281,
            "lat": LAT,
            "lon": LON,
            "status": "OK"
        },
        "positionLight": "OFF",
        "rearWindow": "INVALID",
        "remainingFuel": 21,
        "remainingRangeElectric": 14,
        "remainingRangeElectricMls": 8,
        "remainingRangeFuel": 342,
        "remainingRangeFuelMls": 212,
        "singleImmediateCharging": false,
        "trunk": "CLOSED",
        "updateReason": "CHARGING_STARTED",
        "updateTime": "2020-01-06T13:11:39+0000",
        "vehicleCountry": "FI",
        "vin": "yyy",
        "windowDriverFront": "CLOSED",
        "windowDriverRear": "CLOSED",
        "windowPassengerFront": "CLOSED",
        "windowPassengerRear": "CLOSED"
    },
    "vehicles": [
        {
            "a4a": "NOT_SUPPORTED",
            "bodytype": "G20",
            "brand": "BMW",
            "breakdownNumber": "sss",
            "carCloud": "NOT_SUPPORTED",
            "chargeNow": "NOT_SUPPORTED",
            "chargingControl": "WEEKLY_PLANNER",
            "chargingUpdateMode": "NORMAL_PROGNOSE_BASED",
            "climateControl": "NOT_SUPPORTED",
            "climateControlRES": "NOT_SUPPORTED",
            "climateFunction": "AIRCONDITIONING",
            "climateNow": "ACTIVATED",
            "climateNowRES": "NOT_SUPPORTED",
            "color": "ALPINWEISS  III",
            "colorCode": "300",
            "countryCode": "B1-NE-FI",
            "dealer": {
                "city": "Lappeenranta",
                "country": "FI",
                "name": "Veljekset Laakkonen Oy, Lappeenrant",
                "phone": "+358 10 2149555",
                "postalCode": "53500",
                "street": "Katsastajankatu 4"
            },
            "doorLock": "ACTIVATED",
            "doorUnlock": "ACTIVATED",
            "driveTrain": "PHEV",
            "hasAlarmSystem": true,
            "hmiVersion": "id7",
            "hornBlow": "ACTIVATED",
            "hub": "HUB_ECE",
            "intermodalRouting": "NOT_AVAILABLE",
            "ipa": "NOT_SUPPORTED",
            "lastDestinations": "NOT_SUPPORTED",
            "lightFlash": "ACTIVATED",
            "lscType": "LSC_PHEV",
            "model": "330e",
            "onlineSearchMode": "MAP",
            "rangeMap": "NOT_SUPPORTED",
            "remote360": "NOT_SUPPORTED",
            "remoteSoftwareUpgrade": "ACTIVATED",
            "sendPoi": "ACTIVATED",
            "smartSolution": "NOT_SUPPORTED",
            "statisticsAvailable": false,
            "statisticsCommunityEnabled": false,
            "steering": "LH",
            "supportedChargingModes": [
                "AC_LOW"
            ],
            "vehicleFinder": "ACTIVATED",
            "vehicleFinderRestriction": "NONE",
            "vin": "xxx",
            "yearOfConstruction": 2019
        },
        {
            "a4a": "BLUETOOTH",
            "bodytype": "G30",
            "brand": "BMW",
            "breakdownNumber": "SSS",
            "carCloud": "ACTIVATED",
            "chargeNow": "NOT_SUPPORTED",
            "chargingControl": "WEEKLY_PLANNER",
            "chargingUpdateMode": "NORMAL_PROGNOSE_BASED",
            "climateControl": "NOT_SUPPORTED",
            "climateControlRES": "NOT_SUPPORTED",
            "climateFunction": "AIRCONDITIONING",
            "climateNow": "ACTIVATED",
            "climateNowRES": "NOT_SUPPORTED",
            "color": "BLACK SAPPHIRE METALLIC",
            "colorCode": "475",
            "countryCode": "B1-NE-FI",
            "dealer": {
                "city": "Jyv\u00e4skyl\u00e4",
                "country": "FI",
                "name": "Veljekset Laakkonen Oy, Jyv\u00e4skyl\u00e4",
                "phone": "+358 10 2148400",
                "postalCode": "40320",
                "street": "Palokankaantie 20"
            },
            "doorLock": "ACTIVATED",
            "doorUnlock": "ACTIVATED",
            "driveTrain": "PHEV",
            "hasAlarmSystem": true,
            "hmiVersion": "ID5",
            "hornBlow": "ACTIVATED",
            "hub": "HUB_ECE",
            "intermodalRouting": "NOT_AVAILABLE",
            "ipa": "NOT_SUPPORTED",
            "lastDestinations": "NOT_SUPPORTED",
            "lightFlash": "ACTIVATED",
            "lscType": "LSC_PHEV",
            "model": "530e iPerformance",
            "onlineSearchMode": "MAP",
            "rangeMap": "NOT_SUPPORTED",
            "remote360": "NOT_SUPPORTED",
            "remoteSoftwareUpgrade": "NOT_SUPPORTED",
            "sendPoi": "ACTIVATED",
            "smartSolution": "NOT_SUPPORTED",
            "statisticsAvailable": true,
            "statisticsCommunityEnabled": false,
            "steering": "LH",
            "supportedChargingModes": [
                "AC_LOW"
            ],
            "vehicleFinder": "ACTIVATED",
            "vehicleFinderRestriction": "NONE",
            "vin": "yyy",
            "yearOfConstruction": 2019
        }
    ]
}

Who is online

Users browsing this forum: No registered users and 3 guests

cron