BMW ConnectedDrive component

I will check the mapping I have made this evening. At least that part of the api is for service messages.
It looks like the service for that specific part is needed in December 2018, but your output has some more details then mine.
In the meanwhile you could check the BMW app for this

here is a screenshot of my APP. all fine, no service required.
but the information shown seems different then yours. there is no service history, or mileage shown.
EDIT: i checked the car and there is some ā€œwiper fluidā€ to be refilled. maybe thatā€™s it.
EDIT: i canā€™t check the idrive version anywhere.

Unfortunately no, my car canā€™t be updated without replacing hardware. iDrive 5 uses more powerful hardware than iDrive 4. I googled a bit, and there seems to have been some efforts to upgrade, but id5 on id4 hardware runs rather unstable because of the limitations (less RAM, slower CPU). And there also is something with an additional harddrive. With iDrive 5 there seems to be an optional additional harddrive which stores media files. I think to cache media from Spotify etcā€¦ Without this extra harddrive the Connected apps have no storage to use, and therefore are not available as well.

Regarding the device tracker:
I once have read, that the remote functions rely on Text-Messages that are sent from BMW to the SIM in the car, which in turn responds with the location data. My assumption would be, that with Connected+ this is different and the car is alway online. For my regular ConnectedDrive though I think polling the location could be a problem. Imagine BMW sending a text to a car every minute. Iā€™m pretty sure they wouldnā€™t like that.
This would need to be confirmed though. Itā€™s been a while since Iā€™ve read that. Back then I was wondering why it took ages to find the location or honk the horn. And it was explained with the wakeup-text that is being used.

EDIT:
I have downloaded the CarData package just now. Whatā€™s interesting is, that the lat and lon (location) in there match exactly the value I get when using the script. The thing is: the CarData data tells me this location has been recorded in September 2017. So Iā€™m pretty sure using the location data from the script wonā€™t help. I know that even at the same location GPS coordinates always hop. So sadly even the location data is useless with older iDrive systems.
Another Edit:
Using the location feature in the Connected App manually now has updated the data the script fetches. But using the App to update this is nowhere near pracitcal.

Some screenshots of the current status.

screenshot_3

screenshot_4

2 Likes

:heart_eyes:

Mercedes just released their API 5 days ago :slight_smile:

Edit: Created a small python library during lunch to facilitate the integration:

Iā€™m really curious if this works for me. What are the prerequisites and how do I install this on a hass.io installation?

Nice script you have made. Have you seen the PR by @ReneNulschDE for Mercedes ME at https://github.com/home-assistant/home-assistant/pull/11743/files? I think he uses another API (at least another url). I am reusing his great PR a lot for the BMW component :grinning:

Currently you can download the Python script and add your credentials. When you run that from the command line it will show some data. If thatā€™s there then this will work for you as well.

Here is a screenshot of the current version.
Still a lot of work to do, but we are getting there.

@JesseWebDotCom, were you already able to run the script? If so I can add some extra sensors based on the info from your electric car.

Havenā€™t seen it, thanks for the link :slight_smile:

Thatā€™s for ā€œMercedes meā€ which is a interface from Mercedes that plug onto the obd port (and itā€™s quit nice since it work even on car from 2010 or so).
The one I wrote is for the new api which is integrated in Mercedes latest model.

Hi,
Can I do this when running Hass.io? (Download script, enter credentials)

No, Iā€™ve been sick with the flu and havenā€™t had time to call Bmw. Unless youā€™ve made some changes to the script that may fix things for me.

Please post a link to the source code at the tope of this thread (so others can easily access and test it). Thanks

any testing release to get the data from the script into homeassistant @gerard33 ?

I would love to test this with my i3. How can I enable it on my home assistant server? Happy for some instructions.

great to see a working version. screenshot looks great. canā€™t wait to make this work here as well.
as far as i see it, this is just FETCHING info from bmw website. itā€™s NOT interacting with the car.
so no way of unlocking the car, or starting remote heating etc ā€¦??

@gerard33

Thanks for the script, heres an output from my BMW i3.

C:\bmwcd>bmwcdapi.py -p
...running bmwcdapi.py
--------------START CAR DATA--------------
DCS_CCH_Activation: None
DCS_CCH_Ongoing : None
Segment_LastTrip_ratio_electric_driven_distance: 100
Segment_LastTrip_time_segment_end: 26.01.2018 16:46:00 UTC
Segment_LastTrip_time_segment_end_formatted: 26.01.2018 16:46
Segment_LastTrip_time_segment_end_formatted_date: 26.01.2018
Segment_LastTrip_time_segment_end_formatted_time: 16:46
battery_size_max: 35820
beMaxRangeElectric: 170.0
beMaxRangeElectricKm: 170.0
beMaxRangeElectricMile: 105.0
beRemainingRangeElectric: 168.0
beRemainingRangeElectricKm: 168.0
beRemainingRangeElectricMile: 104.0
beRemainingRangeFuel: 0.0
beRemainingRangeFuelKm: 0.0
beRemainingRangeFuelMile: 0.0
chargeNowAllowed: NOT_ALLOWED
chargingHVStatus: FINISHED_FULLY_CHARGED
chargingLevelHv: 100.0
chargingLogicCurrentlyActive: NOT_CHARGING
chargingSystemStatus: CHARGINGENDED
charging_connection_type: CONDUCTIVE
charging_inductive_positioning: not_positioned
charging_status: CHARGINGENDED
check_control_messages:
condition_based_services: 00003,OK,2019-04,;00017,OK,2019-04,
connectorStatus: CONNECTED
door_driver_front: CLOSED
door_driver_rear: CLOSED
door_lock_state: SECURED
door_passenger_front: CLOSED
door_passenger_rear: CLOSED
gps_lat: 60.000000
gps_lng: 10.500000
head_unit: NBT
head_unit_pu_software: 07/14
heading: 166
hood_state: CLOSED
kombi_current_remaining_range_fuel: 0.0
lastChargingEndReason: CHARGING_GOAL_REACHED
lastChargingEndResult: SUCCESS
lastUpdateReason: VEHCSHUTDOWN_SECURED
lights_parking: OFF
lsc_trigger: VEHCSHUTDOWN_SECURED
mileage: 7165
prognosisWhileChargingStatus: NOT_NEEDED
remaining_fuel: 0
shdStatusUnified: CLOSED
single_immediate_charging: isUnused
soc_hv_percent: 96.4
sunroof_position: 0
sunroof_state: CLOSED
trunk_state: CLOSED
unitOfCombustionConsumption: l/100km
unitOfElectricConsumption: kWh/100km
unitOfEnergy: kWh
unitOfLength: km
updateTime: 26.01.2018 21:53:12 UTC
updateTime_converted: 26.01.2018 22:53
updateTime_converted_date: 26.01.2018
updateTime_converted_time: 22:53
updateTime_converted_timestamp: 1517007192000
vehicle_tracking: 1
window_driver_front: CLOSED
window_driver_rear: CLOSED
window_passenger_front: CLOSED
window_passenger_rear: CLOSED
--------------END CAR DATA--------------
--------------START CAR NAV--------------
auxPowerEcoPro: 1.2
auxPowerEcoProPlus: 0.4
auxPowerRegular: 1.4
driveTrain: bev_ohne_rex
eco: 6b1,4c8,427,427,453,4ce,5f7,68f,728,859,98b
ecoEv: 6b1,4c8,427,427,453,4ce,5f7,68f,728,859,98b
isoCountryCode: NOR
kAccEco: 2520000
kAccReg: 2412000
kDecEco: 3240000
kDecReg: 3240000
kDown: 3384000
kUp: 3132000
latitude: 60.000000
longitude: 10.500000
norm: 6f0,4f5,429,429,453,4cf,5fb,694,72d,85f,991
normEv: 6f0,4f5,429,429,453,4cf,5fb,694,72d,85f,991
pendingUpdate: False
soc: 29.70800018310547
socMax: 29.699997
vehicleMass: 1260
vehicleTracking: True
--------------END CAR NAV--------------
--------------START CAR EFFICIENCY--------------
characteristicList: [{'characteristic': 'TOTAL_CONSUMPTION', 'quantity': 0}, {'characteristic': 'AUXILIARY_CONSUMPTION', 'quantity': 0}, {'characteristic': 'DRIVING_MODE', 'quantity': 0}, {'characteristic': 'ACCELERATION', 'quantity': 2}, {'characteristic': 'ANTICIPATION', 'quantity': 2}]
communitySwitch: True
efficiencyQuotient: 20
lastTripList: [{'name': 'LASTTRIP_DELTA_KM', 'unit': 'KM', 'lastTrip': '3.0'}, {'name': 'ACTUAL_DISTANCE_WITHOUT_CHARGING', 'unit': 'KM', 'lastTrip': '--'}, {'name': 'AVERAGE_ELECTRIC_CONSUMPTION', 'unit': 'KWH_PER_100KM', 'lastTrip': '25.7'}, {'name': 'AVERAGE_RECUPERATED_ENERGY_PER_100_KM', 'unit': 'KWH_PER_100KM', 'lastTrip': '5.0'}, {'name': 'CUMULATED_ELECTRIC_DRIVEN_DISTANCE', 'unit': 'KM', 'lastTrip': '7147.0'}]
lifeTimeList: []
modelType: I3
scoreList: [{'attrName': 'AVERAGE_ELECTRIC_CONSUMPTION', 'attrUnit': 'KWH_PER_100KM', 'minValue': 9.5, 'averageValue': 16.5, 'maxValue': 25.6, 'lifeTime': 16.3}, {'attrName': 'AVERAGE_RECUPERATED_ENERGY_PER_100_KM', 'attrUnit': 'KWH_PER_100KM', 'minValue': 0.3, 'averageValue': 3.1, 'maxValue': 10.6, 'lifeTime': 1.8}, {'attrName': 'CUMULATED_ELECTRIC_DRIVEN_DISTANCE', 'attrUnit': 'KM', 'minValue': 22.0, 'averageValue': 14845.3, 'maxValue': 97810.0, 'lifeTime': 7147.0}, {'attrName': 'LONGEST_DISTANCE_WITHOUT_CHARGING', 'attrUnit': 'KM', 'minValue': 0.0, 'averageValue': 163.4, 'maxValue': 270.0, 'lifeTime': 152.0}]
--------------END CAR EFFICIENCY--------------
--------------START CAR SERVICEPARTNER--------------
businessPartnerId: 00212581
businessPhone: +47 11 111111
city: Oslo
country: NO
countryIsoCode: NO
dealerName: Nameofdealer AS
email: [email protected]
lastChangeDate: 2017-04-09T09:04:58.000+02
partnerNumber: 43948
portfolioCodes: B1,BI,MI
portfolioNames: BMW Cars,BMW i,MINI
street: Nameofstreet 2
subsidiaryNumber: 1
url: http://nameofcardealer.bmw.no/no/nameofcardealer/no/index.html
zipCode: 
--------------END CAR SERVICEPARTNER--------------

GPS position, states of doors, charging status, climate control is on my wish list.

Model: i3 (REX)
E-Code: I01
Production Code: 1Z41
Manufactured: 2017

Keep up the good work and let me know if a novice like myself can help out :slight_smile:

@Svellem, thanks for the output of your i3. This will help me to put the specific values for an electric car in the code :slight_smile:
Can you help me a bit more by sending some screenshots from your BMW ConnectedDrive app with the relevant values and another output of the script which contains the same data? That makes mapping the data from the API a bit easier :relieved:.

Yes thatā€™s possible. Place the script somewhere in the config dir and SSH into hass.io (there is an addon for that). Then you can start the script.
And you can of course also run it from a Windows PC with Python.

No problem, there is already a post with the output of an i3 in the meanwhile. The script isnā€™t changed for that part as I think it will not work without the customer.bmwgroup.com part. I have added a link in the first post which points to the instructions.

Will try to share a version which can be used as custom component asap, but currently itā€™s still work in progress.

See my comments above, it is currently not available as a custom component yet. You can try to run the script (see first post for instructions) to see if you get data. If thatā€™s the case then this component will work for your car.

I will add interaction with the car is well :sunglasses:
The following actions are possible from the API: lock doors, unlock doors, light signal, sound horn, climate.
The locking and unlocking of the doors is something that I already tried, but now to add it to Home Assistant as a lock. The other actions I will add as a switch.