cause I was not satified with the existing possibilties to access the car data of my BMW i3 in openhab, I’ve made the python script bmwcdapi.py
You can query various properties as the state of charge, the mileage and the remainig range.
For insiders, “socMax” can also be queried.
To use the script, you need a running OH2 instance and python3, a BMW ConnectedDrive login and, of course, a supported car. I’ve tested it with my BMW i3, but as far as I know, there are also other BMW’s that are supported by the ConnectedDrive portal.
It’s now possible to execute services as to climate the car or lock / unlock it.
Also the error handling is slightly improved.
For those of you that are already using the script:
The naming of the OH-items was not very smart IMO, so I’ve renamed all items ( added leading “Bmw_”). That is a breaking change of course, but better now then never
I think that it works with all BMWs that could be adressed through CD, but I only own an i3, so I could not test it
Maybe there are some other segments or properties for cars with combustion engine.
You could figure it out by calling the script directly from the shell with the “-p” parameter.
That prints out all available data.
If there are important things missing, just drop me a PR (or an example of the data) to add it.
Just to let you know that it works like charm, I have accessed my i3 withing 15 minutes from starting the idea to implementation.
Many thanks for sharing.
I just have problem with the icons. I did put them into the icons dir but they do not display properly. Where do I put them to display nicely in BasicUI
The icons are vector graphics (svg). To use them, copy them into your icon folder (mine is located under /etc/openhab2/icons/classic).
And than it is important to configure the basic UI (and maybe the openhab-app) to use vector icons. For the basic UI that can be done through paper UI. Just set “icon format” to vector under configuration / services / UI.
The icon thing is kind of strange, as I only have problems with them in Vivaldi , and after multiply purges of cache I still miss 2 icons (unlock and for car icon) In Chrome, Edge they are fine.
Is there a way to get the same nice icons in the Android app?
Anyone has problems with the ConnectedDrive recently? 3 days ago the script stopped updating, but I look into the BMW portal over web and it is missing most of the information on the current range and SOC. Claims GPS possition is not activated in the car, while it is activated. I have error frames over charge schedule. but remote comands do work, so I can honk the car but that’s nothing else. Did they change something?
Thanks for sharing this - just implemented it on my 2016 X5 30d. For a diesel vehicle obviously the EV related fields are not populated, also for some reason the mileage and remaining fuel figures are incorrect. But other than that I can send the lock, unlock, climate, light and horn commands just fine.
One field that I find very useful is gps_lat and gps_lng - you can combine these two in a new PointType item and use it in your presence / location rules if your car exposes them to you.
Also, instead of using simple switches and rules to send the lock, unlock etc commands, I have used switches linked to the Exec binding so there is no need for separate rules, and as a bonus, the switches revert back to OFF themselves.
Notice how interval = 600 on BMW_Refresh - that tells exec binding to automatically execute the command every 10 minutes, which means you won’t need a separate rule triggered via cron.
One thing that I would add to the scripts (i3 specific) would a switch for the “charge immediately/off peak charging”
Had multiple cases that I left a car with home settings (off-peak) on a public charger and it did not charge. I could have openhab detect this case and send me a notification on my Telegram home alert channel.