I’ve been playing with this script to get it working on a bmw 535 from 2011, untill now without success.
Filled in the required details in the .items file like username, password, VIN. I have a working ConnectedDrive account.
Copied all the files but having some issues.
my OH 2.4 is complaining about ImportError: No module named ‘requests’
when running “/usr/bin/python3 /etc/openhab2/scripts/bmw.py” I Get the error:
Traceback (most recent call last):
File “/etc/openhab2/scripts/bmw.py”, line 24, in
import requests
ImportError: No module named ‘requests’
I do not read I have to manually install python-3, I assume it is alreayd installed on OH2.4 (running on a RaspberryPi3B)
Any suggestions?
I’m not familiair with any coding, I can read and understand it a little bit.
Thank you, after some googling I managed to install Python3 using: sudo apt install python3-pip
After this I could install the module using sudo pip3 install requests
And now I can start my script. Nothing really happens yet, I’ll investigate further.
Please have a look at the .py script and search for the logging. There‘s a line to enable direct output.
Otherwise the script only trys to send the values to openHAB.
Thanks guys, all this info on getting the Python3 env setup for it helped. I can now get it to run properly.
Still not working for me though… I am getting could not authenticate, user or password wrong?
I have just used the same UN and PW to log into the ConnectedDrive web site and can see my car in there. Any clue to what may be the issue?
After I completed the register process I am no longer getting the UN & PW error. However, when I try to add my vehicle there it says it cannot validate this vehicle. So obviously this plugin was written for EU based cars but has issues with the US ConnectedDrive version.
Unfortunately I can’t provide working entries for you right now.
There are some similar scripts for other smarthome software, AFAIR they have urls that are work for other parts of the world as well.
Will have a look into my records an report back if I find something promising.
Thank you!
I tried to do a plain replace for your URL suffixes with this prefix: https://connecteddrive.bmwusa.com but that just returned error messages. Whatever you can find and would like me to “beta test” I am more than happy to!
don’t think it helped…
I tried this as suggested: VEHICLE_API = 'https://b2vapi.bmwgroup.us/api/vehicle'
then, since it didn’t work, tried this as well: AUTH_API = 'https://customer.bmwgroup.us/gcdm/oauth/authenticate'
doesn’t see to do the trick… I still just see this in the site map:
Openhab log just has this in it:
2019-01-18 14:27:44.815 [INFO ] [ipse.smarthome.model.script.bmwcdapi] - forced connectedDrive API call
2019-01-18 14:27:46.583 [INFO ] [ipse.smarthome.model.script.bmwcdapi] - …running bmwcdapi.py
Interesting… I get this output on both openhab.log and if running from cli with -p: ...running bmwcdapi.py Traceback (most recent call last): File "bmwcdapi.py", line 303, in <module> main() File "bmwcdapi.py", line 267, in main c = ConnectedDrive() File "bmwcdapi.py", line 49, in __init__ self.generateCredentials() File "bmwcdapi.py", line 77, in generateCredentials myPayLoad=r.headers['Location'] File "/usr/local/lib/python3.5/dist-packages/requests/structures.py", line 52, in __getitem__ return self._store[key.lower()][1] KeyError: 'location'
I have changed the method “generateCredentials” to work with the changed urls (code borrowed from the bimmer_connected lib).
Works for me, so it hopefully would work for you as well.
I’ve made those changes in the development branch.
To try it out to a “git pull” and “git checkout development” or switch to development branch in the github webui.
IMPORTANT:
You have to change to the following lines s.b. for North America (comment in the .us server url and comment out the .com url) :
Works for me!
Thanks so much for getting it fixed so fast!
My prompt looks weird, I’m running it on a Synology NAS.
Now need to figure out the openHAB part…