BMW Connected Drive exporter for Prometheus.io, written in Python 3.
This exporter uses M1n3rva's bimmer_connected library.
usage: bmw_cd_exporter.py [-h] [--user xxx@gmail.com] [--password abc123]
[--port 9488] [--region rest_of_world]
BMW Connected Drive exporter for Prometheus available arguments:
optional arguments:
-h, --help show this help message and exit
--user xxx@gmail.com Username (email address) for logging on to BMW
Connected Drive
--password abc123 Password for logging on to BMW Connected Drive
--port 9488 Exporter listens on this port
--interval 5 Polling interval in minutes
--region rest_of_world
BMW Connected Drive region
(north_america/china/rest_of_world)
--attributes attributes.json
Override path to the JSON file containing all
attributes (optional)
The arguments can also be set as env variables instead. Useful if you're using it in a Docker container.
- BMWCD_USER
- BMWCD_PASSWORD
- BMWCD_REGION
- BMWCD_PORT
- BMWCD_INTERVAL
Note that the region must be one of the 3.
- north_amercia
- china
- rest_of_world
The default is rest_of_world.
git clone git@github.com:wywywywy/bmw_cd_exporter.git
cd bmw_cd_exporter
pip install -r requirements.txt
Use pip3 if your pip is for Python 2.
docker run -d --restart=always -p 9488:9488 -e "BMWCD_USER=xxx@gmail.com" -e "BMWCD_PASSWORD=abc123" -e "BMWCD_REGION=rest_of_world" wywywywy/bmw_cd_exporter:latest
Change the environment variables to what you need.
Add this to prometheus.yml and change the IP/port if needed.
- job_name: 'bmw_cd_exporter'
metrics_path: /
static_configs:
- targets:
- '127.0.0.1:9488'
It supports multiple vehicles in the same BMW Connected Drive account.
Please make sure the pooling rate to set to maybe once every couple of minutes, to avoid overloading BMW's servers. Default is 5.
Currently supported metrics are -
- mileage
- remaining_range_total
- remaining_range_electric
- remaining_range_fuel
- remaining_fuel
- charging_level_hv
If there's anything you want to add, let me know by submitting an issue, or just edit the JSON file directly.
The units seem to be in metric rather than imperial no matter where the vehicle is.
This obviously isn't endorsed by BMW, and they don't have a public API. So they could make breaking changes any time. Remember to not rely on this exporter for anything critical.
Docker- More metrics
Yes, contributions are always welcome.
Fork it & submit a pull request.
This is licensed under the Apache License 2.0.
This project is not affiliated with or endorsed by BMW Group.