jupe76 / bmwcdapi Goto Github PK
View Code? Open in Web Editor NEWa python script to access the BMW ConnectedDrive portal in openhab
a python script to access the BMW ConnectedDrive portal in openhab
Hi, some quite useful information are stored here:
lifeTimeList []
scoreList [{'attrUnit': 'KWH_PER_100KM', 'attrName': 'AVERAGE_ELECTRIC_CONSUMPTION', 'lifeTime': 14.9, 'minValue': 0.0, 'maxValue': 40.0}, {'attrUnit': 'KWH_PER_100KM', 'attrName': 'AVERAGE_RECUPERATED_ENERGY_PER_100_KM', 'lifeTime': 4.9, 'minValue': 0.0, 'maxValue': 20.0}, {'attrUnit': 'KM', 'attrName': 'CUMULATED_ELECTRIC_DRIVEN_DISTANCE', 'lifeTime': 64.0, 'minValue': 0.0, 'maxValue': 65.0}, {'attrUnit': 'KM', 'attrName': 'LONGEST_DISTANCE_WITHOUT_CHARGING', 'lifeTime': 24.0, 'minValue': 0.0, 'maxValue': 170.0}]
execStatusCode=0
Could you explain how to add them in bmwcdapi.py or integrate them by yourself?
BTW: The LASTTRIP_DELTA_KM out of lastTripList was deactived? Why? I added it again - worked fine
The website used does not work anymore, the script needs to be updated with the new login system.
I am based in the US and using https://connecteddrive.bmwusa.com where I can login and see my car. As a test I figured I would look for a global ConnectedDrive site and found this one: https://www.bmw-connecteddrive.my
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.
This is the error message I am getting in the openhab log:
2019-01-04 15:16:03.513 [INFO ] [ipse.smarthome.model.script.bmwcdapi] - forced connectedDrive API call
2019-01-04 15:16:03.674 [INFO ] [ipse.smarthome.model.script.bmwcdapi] - Traceback (most recent call last):
File "/etc/openhab2/scripts/bmwcdapi.py", line 23, in <module>
import requests
ImportError: No module named 'requests'
Trying to run the command manually with '-p' I am getting the following:
[15:20:32] openhabian@openHAB:/etc/openhab2$ sudo python scripts/bmwcdapi.py -p
[sudo] password for openhabian:
Traceback (most recent call last):
File "scripts/bmwcdapi.py", line 25, in <module>
import urllib.parse
ImportError: No module named parse
Any thoughts what may be the reason.
I don't know if this is the right place to post this but here goes.....
Has anyone managed to send a request to their BMW to setup charging?
Ideally I would like to replicate the ConnectedDrive functionality with the off-peak charging option and a departure time.
I'm able to hack around with Python code but I can't find any examples of this to get me started.
Thanks
Jez
Hello, My name is Kenneth Whymns, I was testing this using a BMW I3 and works like a charm, is it possible to add the M8 competition support for this? thank you
Hello,
Got a problem when i'm running the script.
It only shows the message: ...running bmwcdapi.py could not authenticate, user or password wrong?
The passwort is correct and i can login at https://www.bmw-connecteddrive.de/
Is there anything i have to change in the script to access the german API?
Thank You for keeping this alive.
Can you tell why you removed soc_hv_percent from integration?
if('soc_hv_percent' in map): self.ohPutValue("Bmw_socHvPercent",map['soc_hv_percent'])
As far as i can see that value is still available on "-p" call:
mileage 52159 Segment_LastTrip_time_segment_end_formatted_time 18:00 beMaxRangeElectricMile 55.0 Segment_LastTrip_time_segment_end_formatted 08.01.2020 18:00 lastChargingEndResult UNKNOWN check_control_messages unitOfEnergy kWh beRemainingRangeElectric 89.0 soc_hv_percent 77.5 single_immediate_charging isUnused updateTime_converted_time 22:47
Thank You!
same with title
Please can anyone say whether this still works or whether BMW has finally denied us access to our data?
Hi, I'm receiving this error in Europe (using default URL) when running the python script:
...running bmwcdapi.py
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 343, in _make_request
self._validate_conn(conn)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 841, in validate_conn
conn.connect()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 344, in connect
ssl_context=context)
File "/usr/lib/python3/dist-packages/urllib3/util/ssl.py", line 344, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib/python3.7/ssl.py", line 412, in wrap_socket
session=session
File "/usr/lib/python3.7/ssl.py", line 853, in _create
self.do_handshake()
File "/usr/lib/python3.7/ssl.py", line 1117, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:1056)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='b2vapi.bmwgroup.com', port=443): Max retries exceeded with url: /gcdm/oauth/token (Caused by SSLError(SSLError(1, '[SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:1056)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "bmwcdapi.py", line 332, in
main()
File "bmwcdapi.py", line 296, in main
c = ConnectedDrive()
File "bmwcdapi.py", line 69, in init
self.generateCredentials()
File "bmwcdapi.py", line 100, in generateCredentials
r = requests.post(url, data=data, headers=headers,allow_redirects=False)
File "/usr/lib/python3/dist-packages/requests/api.py", line 116, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='b2vapi.bmwgroup.com', port=443): Max retries exceeded with url: /gcdm/oauth/token (Caused by SSLError(SSLError(1, '[SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:1056)')))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.