A slightly convoluted way of getting your vehicle data from TeslaMate to A Better Route Planner.
100K+
A bridge to send your Tesla vehicle data from TeslaMate to A Better Route Planner (ABRP).
Add the teslamate-abrp service to your existing TeslaMate docker-compose.yml:
ABRP:
container_name: TeslaMate_ABRP
image: fetzu/teslamate-abrp:latest
restart: always
environment:
- MQTT_SERVER=mosquitto
- USER_TOKEN=your-abrp-user-token
- CAR_NUMBER=1
# Optional parameters (see Configuration section)
# - CAR_MODEL=tesla:m3:20:bt37:heatpump
# - MQTT_USERNAME=username
# - MQTT_PASSWORD=password
# - MQTT_PORT=1883
# - MQTT_TLS=True
# - STATUS_TOPIC=teslamate-abrp
# - SKIP_LOCATION=True
# - TM2ABRP_DEBUG=True
# - REFRESH_RATE_DRIVING=2.5
# - REFRESH_RATE_CHARGING=6
# - REFRESH_RATE_PARKED=30
Deploy the service:
docker-compose pull ABRP
docker-compose up -d ABRP
For improved security, use Docker secrets to manage sensitive information:
version: '3'
services:
ABRP:
container_name: TeslaMate_ABRP
image: fetzu/teslamate-abrp:latest
restart: always
environment:
- MQTT_SERVER=mosquitto
- CAR_NUMBER=1
- MQTT_USERNAME=username
- MQTT_TLS=True
- MQTT_PORT=8883
secrets:
- USER_TOKEN
- MQTT_PASSWORD
secrets:
USER_TOKEN:
file: ./path/to/abrp-token.txt
MQTT_PASSWORD:
file: ./path/to/mqtt-password.txt
Clone the repository:
git clone https://github.com/fetzu/teslamate-abrp.git
cd teslamate-abrp
Install dependencies:
pip install -r requirements.txt
Run the script:
python teslamate_mqtt2abrp.py USER_TOKEN 1 mqtt-server-address
| Parameter | Description | Default | Required |
|---|---|---|---|
| USER_TOKEN | Your ABRP user token | - | Yes |
| CAR_NUMBER | TeslaMate car number | 1 | No |
| MQTT_SERVER | MQTT server address | - | Yes |
| Parameter | Description | Default | Required |
|---|---|---|---|
| CAR_MODEL | ABRP car model identifier | Auto-detected | No |
| MQTT_PORT | MQTT server port | 1883 | No |
| MQTT_USERNAME | MQTT username | - | No |
| MQTT_PASSWORD | MQTT password | - | No |
| MQTT_TLS | Use TLS for MQTT connection | False | No |
| MQTT_VERIFY_CERT | Verify the broker's TLS certificate (only applies with MQTT_TLS). CLI: --verify-cert/--no-verify-cert. Invalid values fall back to enabled | True | No |
| STATUS_TOPIC | Topic to publish status messages | - | No |
| SKIP_LOCATION | Don't send location data to ABRP | False | No |
| TM2ABRP_DEBUG | Enable debug logging | False | No |
| REFRESH_RATE_DRIVING | Update interval (seconds) while driving; fractional values allowed, min 1 | 2.5 | No |
| REFRESH_RATE_CHARGING | Update interval (seconds) while charging | 6 | No |
| REFRESH_RATE_PARKED | Update interval (seconds) while parked/asleep | 30 | No |
| ABRP_API_KEY | Override the shared ABRP application key (env var or Docker secret). Not a per-user secret | Built-in | No |
For optimal route planning, it's recommended to manually specify your car model using the CAR_MODEL parameter. Get the correct identifier from:
https://api.iternio.com/1/tlm/get_carmodels_list
Examples:
tesla:m3:20:bt37:heatpumptesla:my:19:bt37:perfs100dCheck logs for connection issues:
docker-compose logs ABRP
Verify MQTT connectivity:
docker-compose exec ABRP python -c "import paho.mqtt.client as mqtt; client = mqtt.Client(); client.connect('mosquitto', 1883); print('Connected successfully')"
Common issues:
The application uses different update rates (in seconds) based on car state, with these defaults:
REFRESH_RATE_DRIVING)REFRESH_RATE_CHARGING)REFRESH_RATE_PARKED)ABRP recommends a telemetry point roughly every 5 seconds and advises against
intervals longer than 30 seconds, so the defaults stay within that window. Faster
driving updates (e.g. REFRESH_RATE_DRIVING=1) are supported but, per ABRP, don't
materially improve its predictions. Rates may be fractional (e.g. 2.5) but must
be at least 1 second; out-of-range or invalid values fall back to the default.
These can be customized via environment variables or the equivalent CLI options
(--refresh-driving, --refresh-charging, --refresh-parked). Any value left
unset falls back to the default above. Values must be whole positive seconds;
invalid values are ignored (with a warning) and the default is used instead.
For example, to make driving updates less aggressive:
environment:
- REFRESH_RATE_DRIVING=5
Based on letienne's original code, with improvements by various contributors (see commit history).
Licensed under the MIT license.
Content type
Image
Digest
sha256:ba5714305…
Size
21.5 MB
Last updated
6 days ago
docker pull fetzu/teslamate-abrp