### Install Dependencies
Source: https://github.com/bassmaster187/teslalogger/blob/master/TeslaLogger/GrafanaPlugins/teslalogger-timeline-panel/dist/README.md
Use this command to install the necessary project dependencies before building or running the plugin.
```bash
yarn install
```
--------------------------------
### Install rclone
Source: https://github.com/bassmaster187/teslalogger/blob/master/backup_to_google_drive.md
Installs the rclone utility on your system. This is a prerequisite for managing cloud storage.
```bash
sudo apt-get install -y rclone
```
--------------------------------
### Compile the plugin
Source: https://github.com/bassmaster187/teslalogger/blob/master/TeslaLogger/GrafanaPlugins/discrete-panel/dist/README.md
Use these commands to install dependencies and build the project.
```bash
yarn install
yarn build
```
--------------------------------
### Install PHPMYADMIN via SSH
Source: https://github.com/bassmaster187/teslalogger/blob/master/phpmyadmin-howto.md
Use this command to install PHPMYADMIN. Confirm all prompts with the default options.
```bash
sudo apt-get install phpmyadmin
```
--------------------------------
### Build TrackMap Panel from Source
Source: https://github.com/bassmaster187/teslalogger/blob/master/TeslaLogger/GrafanaPlugins/pR0Ps-grafana-trackmap-panel/dist/README.md
Install npm dependencies and build the plugin for development or unreleased versions. Ensure you have npm installed and have checked out the desired branch or commit.
```bash
npm install
npm run build
```
--------------------------------
### Download Configuration Files
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Use wget to download the .env and docker-compose.yml files for TeslaLogger setup.
```bash
wget https://raw.githubusercontent.com/bassmaster187/TeslaLogger/refs/heads/NET8/.env -O .env
wget https://raw.githubusercontent.com/bassmaster187/TeslaLogger/refs/heads/NET8/docker-compose.yml
```
--------------------------------
### Start TeslaLogger Docker Containers
Source: https://github.com/bassmaster187/teslalogger/blob/master/docker_setup.md
After configuring the .env file, use this command to start the TeslaLogger services in detached mode. Allow ample time for initial database setup, especially on slower systems.
```bash
docker compose up -d
```
--------------------------------
### Start TeslaLogger Services with Docker Compose
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Pull the latest Docker images and start the services in detached mode.
```bash
docker compose pull
docker compose up -d
```
--------------------------------
### Initial Docker Installation and Configuration
Source: https://github.com/bassmaster187/teslalogger/blob/master/docker_setup.md
Prepare directories, download configuration files, pull Docker images, and set up the environment for TeslaLogger. Ensure you have the latest Docker and Docker Compose versions.
```bash
mkdir backup
mkdir mysql
mkdir invoices
chmod 777 backup
chmod 777 mysql
chmod 777 invoices
wget https://raw.githubusercontent.com/bassmaster187/TeslaLogger/refs/heads/NET8/.env -O .env
wget https://raw.githubusercontent.com/bassmaster187/TeslaLogger/refs/heads/NET8/docker-compose.yml -O docker-compose.yml
docker compose pull
```
--------------------------------
### Create TeslaLogger Directories on Synology NAS
Source: https://github.com/bassmaster187/teslalogger/blob/master/docker_setup.md
Use these commands to create the necessary directories for TeslaLogger on a Synology NAS before proceeding with Docker setup.
```bash
sudo -i
cd /volume1/docker
mkdir teslalogger
cd teslalogger
```
--------------------------------
### Verify LucidLogger Log Output
Source: https://github.com/bassmaster187/teslalogger/blob/master/docs/en/lucid-install.md
Example of successful log output confirming the vehicle connection and stream initialization.
```text
06.05.2025 22:00:20 : #10[Car_10:22]: Country Code: de
06.05.2025 22:00:20 : #10[Car_10:22]: Voltage at 50% SOC:0V Date:1/1/0001 12:00:00 AM
06.05.2025 22:00:20 : #10[Car_10:22]: Car: Lucid Air PURE - 0.19 Wh/km
06.05.2025 22:00:20 : #10[Car_10:22]: VIN decoder: n/a 2023 AWD:False MIC:False battery:LFP motor:3 single MIG:False
06.05.2025 22:00:20 : #10[Car_10:22]: Vehicle Config: car_type:'LUCID' car_special_type:'' trim_badging:'PURE'
06.05.2025 22:00:20 : #10[Car_10:22]: No meter config
06.05.2025 22:00:20 : #10[StreamAPIThread_10:24]: StartStream
06.05.2025 22:00:20 : #10[.NET Long Running Task:25]: GetChargingHistoryV2Service initializing ...
06.05.2025 22:00:20 : #10[Car_10:22]: CloseDriveState EndDate: 2025-05-06 22:00:09
06.05.2025 22:00:20 : Reverse geocoding by GeocodeCache
06.05.2025 22:00:21 : #10[.NET TP Worker:15]: GetChargingHistoryV2: NotFound CarState: Start (OK: 0 - Fail: 1)
06.05.2025 22:00:21 : #10[.NET Long Running Task:25]: GetChargingHistoryV2Service initialized
06.05.2025 22:00:22 : #10[Car_10:22]: change TeslaLogger state: Start -> Sleep
```
--------------------------------
### Get All Cars
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Returns information about all registered vehicles in the TeslaLogger instance.
```APIDOC
## GET /getallcars
### Description
Retrieves a list of all registered vehicles.
### Method
GET
### Endpoint
`/getallcars`
### Response
#### Success Response (200)
- **id** (integer) - The unique ID of the car.
- **display_name** (string) - The display name of the car.
- **vin** (string) - The Vehicle Identification Number (VIN).
- **model_name** (string) - The model name of the car.
- **car_type** (string) - The type of the car (e.g., 'model3').
- **fleetAPI** (integer) - Indicates if Fleet API is enabled (1 for enabled, 0 for disabled).
- **inactive** (integer) - Indicates if the car is inactive (1 for inactive, 0 for active).
### Response Example
```json
[
{
"id": 1,
"display_name": "My Model 3",
"vin": "5YJ3E1EA0LF123456",
"model_name": "Model 3",
"car_type": "model3",
"fleetAPI": 1,
"inactive": 0
}
]
```
```
--------------------------------
### Force Update on Raspberry Pi
Source: https://github.com/bassmaster187/teslalogger/blob/master/docs/en/faq.md
Use these commands to manually trigger an update on a Raspberry Pi installation.
```bash
cd /etc/teslalogger
sudo ./update.sh
```
--------------------------------
### Get Static Trip Map
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Generates a static PNG map image showing a trip route between two positions.
```bash
# Get map for trip (start position 1000, end position 1500)
curl "http://raspberry:5000/get/map?start=1000&end=1500&width=400&height=300&carid=1" \
-o trip_map.png
# Dark mode map
curl "http://raspberry:5000/get/map?start=1000&end=1500&mode=dark&carid=1" \
-o trip_map_dark.png
```
--------------------------------
### GPX Export Format
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Example of the GPX XML structure used for exporting trip data, including timestamps, coordinates, and elevation.
```xml
teslalogger.gpx2024-01-153538
```
--------------------------------
### MySQL/MariaDB Query for TrackMap Panel
Source: https://github.com/bassmaster187/teslalogger/blob/master/TeslaLogger/GrafanaPlugins/pR0Ps-grafana-trackmap-panel/dist/README.md
Example MySQL/MariaDB queries to retrieve latitude and longitude for the TrackMap panel. Two separate queries are required, one for each data series, ordered by timestamp.
```sql
A: SELECT "latitude" as value, $__time(timestamp) FROM "location" WHERE $__timeFilter(timestamp) ORDER BY timestamp ASC
B: SELECT "longitude" as value, $__time(timestamp) FROM "location" WHERE $__timeFilter(timestamp) ORDER BY timestamp ASC
```
--------------------------------
### MQTT Settings Management
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Configure MQTT broker connection for smart home integration.
```bash
# Get current MQTT settings
curl "http://raspberry:5000/mqtt/info"
# Response:
{
"mqtt_host": "192.168.1.100",
"mqtt_port": 1883,
"mqtt_user": "teslalogger",
"mqtt_passwd": "secret",
"mqtt_topic": "teslalogger",
"mqtt_publishjson": true,
"mqtt_singletopics": true,
"mqtt_discoveryenable": true,
"mqtt_discoverytopic": "homeassistant"
}
# Update MQTT settings
curl -X POST "http://raspberry:5000/mqtt/set" \
-H "Content-Type: application/json" \
-d '{
"mqtt_host": "192.168.1.100",
"mqtt_port": 1883,
"mqtt_user": "teslalogger",
"mqtt_passwd": "secret",
"mqtt_topic": "teslalogger",
"mqtt_publishjson": true,
"mqtt_singletopics": true,
"mqtt_discoveryenable": true,
"mqtt_discoverytopic": "homeassistant"
}'
```
--------------------------------
### Get POI Information
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Retrieve Point of Interest information for a specific GPS coordinate.
```APIDOC
## GET /admin/GetPOI
### Description
Retrieves Point of Interest (POI) information for a given latitude and longitude.
### Method
GET
### Endpoint
/admin/GetPOI
### Parameters
#### Query Parameters
- **lat** (number) - Required - The latitude coordinate.
- **lng** (number) - Required - The longitude coordinate.
### Request Example
```bash
curl "http://raspberry:5000/admin/GetPOI?lat=52.308921&lng=13.444712"
```
### Response
#### Success Response (200)
- **name** (string) - The name of the POI.
- **rawName** (string) - The raw name of the POI.
- **lat** (number) - The latitude of the POI.
- **lng** (number) - The longitude of the POI.
- **radius** (integer) - The radius of the POI in meters.
- **IsHome** (boolean) - Whether the POI is marked as home.
- **IsWork** (boolean) - Whether the POI is marked as work.
- **IsCharger** (boolean) - Whether the POI is a charging station.
- **NoSleep** (boolean) - Whether 'Do Not Sleep' is enabled for this POI.
- **SpecialFlags** (object) - Object containing special flags for the POI.
- **ocp** (string) - Example: 'R->P'
- **hfl** (string) - Example: '5m'
#### Response Example
```json
{
"name": "Supercharger DE-Berlin",
"rawName": "Supercharger DE-Berlin",
"lat": 52.308921,
"lng": 13.444712,
"radius": 50,
"IsHome": false,
"IsWork": false,
"IsCharger": true,
"NoSleep": false,
"SpecialFlags": {
"ocp": "R->P",
"hfl": "5m"
}
}
```
```
--------------------------------
### Home Assistant MQTT Configuration
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Discovery topics and manual configuration for Home Assistant integration.
```yaml
# When mqtt_discoveryenable is true, TeslaLogger publishes discovery configs to:
homeassistant/sensor/teslalogger_{VIN}_battery_level/config
homeassistant/sensor/teslalogger_{VIN}_odometer/config
homeassistant/binary_sensor/teslalogger_{VIN}_charging/config
# ... and more sensors
# Example Home Assistant configuration.yaml for manual setup:
mqtt:
sensor:
- name: "Tesla Battery Level"
state_topic: "teslalogger/car/5YJ3E1EA0LF123456/battery_level"
unit_of_measurement: "%"
device_class: battery
- name: "Tesla Odometer"
state_topic: "teslalogger/car/5YJ3E1EA0LF123456/odometer"
unit_of_measurement: "km"
binary_sensor:
- name: "Tesla Charging"
state_topic: "teslalogger/car/5YJ3E1EA0LF123456/charging"
payload_on: "true"
payload_off: "false"
```
--------------------------------
### Get POI Information
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Retrieve Point of Interest information for a specific GPS coordinate.
```bash
curl "http://raspberry:5000/admin/GetPOI?lat=52.308921&lng=13.444712"
# Response:
{
"name": "Supercharger DE-Berlin",
"rawName": "Supercharger DE-Berlin",
"lat": 52.308921,
"lng": 13.444712,
"radius": 50,
"IsHome": false,
"IsWork": false,
"IsCharger": true,
"NoSleep": false,
"SpecialFlags": {
"ocp": "R->P",
"hfl": "5m"
}
}
```
--------------------------------
### Build Plugin in Production Mode
Source: https://github.com/bassmaster187/teslalogger/blob/master/TeslaLogger/GrafanaPlugins/teslalogger-timeline-panel/dist/README.md
Execute this command to create an optimized build of the plugin for production deployment. This typically includes minification and other optimizations.
```bash
yarn build
```
--------------------------------
### Wallbox/Electricity Meter Configuration
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Configure external electricity meters for accurate charging energy tracking.
```bash
# Test wallbox connection
curl -X POST "http://raspberry:5000/wallbox" \
-H "Content-Type: application/json" \
-d '{
"test": true,
"type": "go-e",
"host": "192.168.1.50",
"param": ""
}'
# Response:
{"Version": "1.5.2", "Utility_kWh": 1234.5, "Vehicle_kWh": 567.8}
# Save wallbox configuration for car 1
curl -X POST "http://raspberry:5000/wallbox" \
-H "Content-Type: application/json" \
-d '{
"save": true,
"carid": 1,
"type": "go-e",
"host": "192.168.1.50",
"param": ""
}'
# Load wallbox configuration
curl -X POST "http://raspberry:5000/wallbox" \
-H "Content-Type: application/json" \
-d '{"load": true, "carid": 1}'
# Supported wallbox types: go-e, openWB, openWB2, EVCC, cfos, shelly3EM, shellyEM,
# TeslaGen3WallConnector, keba, smartEVSE3, WARP
```
--------------------------------
### Execute OS upgrade script
Source: https://github.com/bassmaster187/teslalogger/blob/master/docs/en/os_upgrade.md
Run the upgrade script located in the TeslaLogger directory to transition the OS to Buster.
```bash
cd /etc/teslalogger
sudo chmod 777 upgrade2buster.sh
sudo ./upgrade2buster.sh
```
--------------------------------
### Fleet API Pairing Error
Source: https://github.com/bassmaster187/teslalogger/blob/master/docs/en/faq.md
Example error message indicating that the public key has not been paired with the vehicle.
```json
{„response“:null,„error“:„vehicle rejected request: your public key has not been paired with the vehicle“,„error_description“:„“}
```
--------------------------------
### Run Import in Docker
Source: https://github.com/bassmaster187/teslalogger/blob/master/TeslaFi-Import/README.md
Commands to navigate to the directory and execute the import tool within the container.
```bash
cd /etc/teslalogger/
mono TeslaFi-Import.exe
```
--------------------------------
### MQTT Settings Management
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Configure MQTT broker connection for smart home integration.
```APIDOC
## MQTT Management
### Get MQTT Settings
#### Description
Retrieves the current MQTT broker connection settings.
#### Method
GET
#### Endpoint
/mqtt/info
#### Response
##### Success Response (200)
- **mqtt_host** (string) - The MQTT broker hostname or IP address.
- **mqtt_port** (integer) - The MQTT broker port.
- **mqtt_user** (string) - The MQTT username.
- **mqtt_passwd** (string) - The MQTT password.
- **mqtt_topic** (string) - The base MQTT topic.
- **mqtt_publishjson** (boolean) - Whether to publish messages in JSON format.
- **mqtt_singletopics** (boolean) - Whether to use single topics for messages.
- **mqtt_discoveryenable** (boolean) - Whether to enable MQTT discovery.
- **mqtt_discoverytopic** (string) - The MQTT topic for discovery messages.
#### Response Example
```json
{
"mqtt_host": "192.168.1.100",
"mqtt_port": 1883,
"mqtt_user": "teslalogger",
"mqtt_passwd": "secret",
"mqtt_topic": "teslalogger",
"mqtt_publishjson": true,
"mqtt_singletopics": true,
"mqtt_discoveryenable": true,
"mqtt_discoverytopic": "homeassistant"
}
```
### Update MQTT Settings
#### Description
Updates the MQTT broker connection settings.
#### Method
POST
#### Endpoint
/mqtt/set
#### Parameters
##### Request Body
- **mqtt_host** (string) - Required - The MQTT broker hostname or IP address.
- **mqtt_port** (integer) - Required - The MQTT broker port.
- **mqtt_user** (string) - Required - The MQTT username.
- **mqtt_passwd** (string) - Required - The MQTT password.
- **mqtt_topic** (string) - Required - The base MQTT topic.
- **mqtt_publishjson** (boolean) - Required - Whether to publish messages in JSON format.
- **mqtt_singletopics** (boolean) - Required - Whether to use single topics for messages.
- **mqtt_discoveryenable** (boolean) - Required - Whether to enable MQTT discovery.
- **mqtt_discoverytopic** (string) - Required - The MQTT topic for discovery messages.
#### Request Example
```bash
curl -X POST "http://raspberry:5000/mqtt/set" \
-H "Content-Type: application/json" \
-d
'{
"mqtt_host": "192.168.1.100",
"mqtt_port": 1883,
"mqtt_user": "teslalogger",
"mqtt_passwd": "secret",
"mqtt_topic": "teslalogger",
"mqtt_publishjson": true,
"mqtt_singletopics": true,
"mqtt_discoveryenable": true,
"mqtt_discoverytopic": "homeassistant"
}'
```
```
--------------------------------
### Identify Damaged Transaction Log
Source: https://github.com/bassmaster187/teslalogger/blob/master/docs/en/faq.md
Example log output indicating a corrupted transaction log file.
```text
Mar 12 05:46:17 raspberry mysqld[577]: 2022-03-12 5:46:17 1988878128 [Note] Recovering after a crash using tc.log
Mar 12 05:46:17 raspberry mysqld[577]: 2022-03-12 5:46:17 1988878128 [ERROR] Can’t init tc log
```
--------------------------------
### Run Plugin in Watch Mode
Source: https://github.com/bassmaster187/teslalogger/blob/master/TeslaLogger/GrafanaPlugins/teslalogger-timeline-panel/dist/README.md
Use this command to build the plugin and automatically recompile when changes are detected. Ideal for continuous development.
```bash
yarn watch
```
--------------------------------
### Get Charging State Details
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Retrieves detailed information about a specific charging session including location, energy added, and costs.
```APIDOC
## GET /getchargingstate
### Description
Retrieves detailed information about a specific charging session.
### Method
GET
### Endpoint
`/getchargingstate`
### Parameters
#### Query Parameters
- **id** (integer) - Required - The ID of the charging session.
### Response
#### Success Response (200)
- **id** (integer) - The ID of the charging session.
- **StartDate** (string) - The start date and time of the charging session.
- **EndDate** (string) - The end date and time of the charging session.
- **lat** (float) - The latitude where charging occurred.
- **lng** (float) - The longitude where charging occurred.
- **address** (string) - The address or location name of the charging session.
- **kWh** (float) - The amount of energy added in kWh.
- **cost_total** (float) - The total cost of the charging session.
- **cost_currency** (string) - The currency of the cost.
### Response Example
```json
[
{
"id": 123,
"StartDate": "2024-01-15 10:30:00",
"EndDate": "2024-01-15 12:45:00",
"lat": 52.308921,
"lng": 13.444712,
"address": "Supercharger DE-Berlin",
"kWh": 45.2,
"cost_total": 15.50,
"cost_currency": "EUR"
}
]
```
```
--------------------------------
### Manage Configuration Files via API
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Read and write specific configuration files using the TeslaLogger API.
```bash
curl "http://raspberry:5000/getfile/geofence-private.csv"
```
```bash
curl "http://raspberry:5000/getfile/settings.json"
```
```bash
curl -X POST "http://raspberry:5000/writefile/geofence-private.csv" \
-d 'Home,52.39408,13.54223,,+home+scl:80
Work,52.52000,13.40500,100,+work'
```
--------------------------------
### Configure High Frequency Logging Flag
Source: https://github.com/bassmaster187/teslalogger/blob/master/TeslaLogger/Geofence.md
The +hfl flag enables high-frequency API polling for a set duration or count when charging starts.
```text
+hfl:5m
```
--------------------------------
### Build Plugin in Development Mode
Source: https://github.com/bassmaster187/teslalogger/blob/master/TeslaLogger/GrafanaPlugins/teslalogger-timeline-panel/dist/README.md
Run this command to build the plugin in development mode. This is useful for active development and debugging.
```bash
yarn dev
```
--------------------------------
### Restart TeslaLogger Container for Initialization Issues
Source: https://github.com/bassmaster187/teslalogger/blob/master/docker_setup.md
If database tables are missing due to slow initialization on devices like NAS, restart the TeslaLogger container. This command can be repeated if necessary.
```bash
docker restart teslalogger
```
--------------------------------
### Get Car Current State JSON
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Returns the current real-time state of a vehicle including position, battery level, charging status, and climate information.
```APIDOC
## GET /currentjson/{car_id}
### Description
Retrieves the current real-time state of a vehicle.
### Method
GET
### Endpoint
`/currentjson/{car_id}`
### Parameters
#### Path Parameters
- **car_id** (integer) - Required - The ID of the car to retrieve state for.
### Response
#### Success Response (200)
- **battery_level** (integer) - The current battery percentage.
- **charge_limit_soc** (integer) - The set charge limit SOC.
- **charger_power** (integer) - The current charging power in kW.
- **charging** (boolean) - Indicates if the vehicle is currently charging.
- **driving** (boolean) - Indicates if the vehicle is currently driving.
- **latitude** (float) - The current latitude of the vehicle.
- **longitude** (float) - The current longitude of the vehicle.
- **odometer** (float) - The current odometer reading.
- **outside_temp** (float) - The current outside temperature.
- **speed** (integer) - The current speed of the vehicle.
- **state** (string) - The current state of the vehicle (e.g., 'online').
- **display_name** (string) - The display name of the vehicle.
### Response Example
```json
{
"battery_level": 75,
"charge_limit_soc": 80,
"charger_power": 0,
"charging": false,
"driving": false,
"latitude": 52.308921,
"longitude": 13.444712,
"odometer": 45230.5,
"outside_temp": 18.5,
"speed": 0,
"state": "online",
"display_name": "My Tesla"
}
```
```
--------------------------------
### Get Static Trip Map
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Generates a static PNG map image showing a trip route between two positions. Supports specifying dimensions and car ID.
```APIDOC
## GET /get/map
### Description
Generates a static PNG map image showing a trip route between two positions.
### Method
GET
### Endpoint
/get/map
### Parameters
#### Query Parameters
- **start** (integer) - Required - The starting point of the trip (e.g., trip ID).
- **end** (integer) - Required - The ending point of the trip (e.g., trip ID).
- **width** (integer) - Optional - The desired width of the map image in pixels.
- **height** (integer) - Optional - The desired height of the map image in pixels.
- **carid** (integer) - Optional - The ID of the car for which to generate the map.
- **mode** (string) - Optional - The display mode for the map (e.g., 'dark').
### Request Example
```bash
curl "http://raspberry:5000/get/map?start=1000&end=1500&width=400&height=300&carid=1"
```
### Response
#### Success Response (200)
Returns a PNG image of the trip map.
#### Response Example
(Binary PNG data)
```
--------------------------------
### Verify MariaDB Initialization
Source: https://github.com/bassmaster187/teslalogger/blob/master/docker_setup.md
Confirm that the database schema initialization script has run successfully by checking the logs of the MariaDB container. This is crucial for TeslaLogger to function correctly.
```bash
/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/sqlschema.sql
```
--------------------------------
### Get Car Value by ID or VIN
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Retrieves a specific Tesla API state value for a vehicle using either the internal car ID or the 17-character VIN.
```APIDOC
## GET /get/{car_identifier}/{value_name}
### Description
Retrieves a specific Tesla API state value for a vehicle.
### Method
GET
### Endpoint
`/get/{car_identifier}/{value_name}`
### Parameters
#### Path Parameters
- **car_identifier** (string) - Required - The car ID (integer) or VIN (17-character string).
- **value_name** (string) - Required - The name of the value to retrieve (e.g., 'battery_level').
#### Query Parameters
- **raw** (boolean) - Optional - If present, returns only the raw value without the timestamp.
### Response
#### Success Response (200)
- **response** (object) - Contains the value and timestamp.
- **value** (string) - The requested value.
- **timestamp** (integer) - The Unix timestamp when the value was recorded.
### Response Example (with timestamp)
```json
{
"response": {
"value": "75",
"timestamp": 1699123456789
}
}
```
### Response Example (raw value)
```
75
```
```
--------------------------------
### Execute Import on Raspberry Pi
Source: https://github.com/bassmaster187/teslalogger/blob/master/TeslaFi-Import/README.md
Commands to stop services and run the import tool on a Raspberry Pi.
```bash
sudo pkill mono
sudo service grafana-server stop
sudo service apache2 stop
cd /etc/teslalogger/
mono TeslaFi-Import.exe
```
--------------------------------
### ABRP Integration
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Configure integration with A Better Route Planner for live data sharing.
```bash
# Get ABRP settings for car 1
curl "http://raspberry:5000/abrp/1/info"
# Response:
{"token": "abc123xyz", "mode": 1}
# Set ABRP token and mode
curl -X POST "http://raspberry:5000/abrp/1/set" \
-H "Content-Type: application/json" \
-d '{"abrp_token": "your-abrp-token", "abrp_mode": 1}'
# Or via query string
curl "http://raspberry:5000/abrp/1/set?abrp_token=your-token&abrp_mode=1"
```
--------------------------------
### Configure rclone for Google Drive
Source: https://github.com/bassmaster187/teslalogger/blob/master/backup_to_google_drive.md
Initiates the rclone configuration process. You will be prompted to set up a connection to Google Drive, including authentication.
```bash
sudo rclone config
```
--------------------------------
### Make Backup Script Executable
Source: https://github.com/bassmaster187/teslalogger/blob/master/backup_to_google_drive.md
Sets execute permissions for the backup script, allowing it to be run manually or by the system.
```bash
chmod +x /etc/teslalogger/my-backup.sh
```
--------------------------------
### InfluxDB Query for TrackMap Panel
Source: https://github.com/bassmaster187/teslalogger/blob/master/TeslaLogger/GrafanaPlugins/pR0Ps-grafana-trackmap-panel/dist/README.md
Example InfluxDB query to retrieve median latitude and longitude for the TrackMap panel. The query must return two series: latitude first, then longitude.
```sql
SELECT median("latitude"), median("longitude") FROM "location" WHERE $timeFilter GROUP BY time($interval)
```
--------------------------------
### Release the plugin
Source: https://github.com/bassmaster187/teslalogger/blob/master/TeslaLogger/GrafanaPlugins/discrete-panel/dist/README.md
Execute a patch release to GitHub using a personal access token.
```bash
env GITHUB_TOKEN=your_token yarn release-it patch
```
--------------------------------
### Configure MQTTHost
Source: https://github.com/bassmaster187/teslalogger/blob/master/MQTTClient/readme.md
Sets the IP address or hostname of the MQTT broker.
```xml
192.168.1.35
```
--------------------------------
### Deploy TeslaLogger with Docker Compose
Source: https://github.com/bassmaster187/teslalogger/blob/master/docs/faq/updateFunktioniertNicht.md
Downloads the configuration file and initializes the container services in detached mode.
```bash
wget https://raw.githubusercontent.com/bassmaster187/TeslaLogger/refs/heads/NET8/docker-compose.yml -O docker-compose.yml
docker compose pull
docker compose up -d
```
--------------------------------
### MQTT Topics Structure
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Overview of MQTT topics used for publishing vehicle data and receiving commands.
```bash
# JSON format (full state in single message)
teslalogger/json/{VIN}/currentjson
# Single topics format (individual values)
teslalogger/car/{VIN}/battery_level
teslalogger/car/{VIN}/charge_limit_soc
teslalogger/car/{VIN}/charger_power
teslalogger/car/{VIN}/charging
teslalogger/car/{VIN}/driving
teslalogger/car/{VIN}/latitude
teslalogger/car/{VIN}/longitude
teslalogger/car/{VIN}/odometer
teslalogger/car/{VIN}/outside_temp
teslalogger/car/{VIN}/speed
teslalogger/car/{VIN}/state
# Subscribe to commands (for automation)
teslalogger/command/{VIN}/+
```
--------------------------------
### Configure Topic
Source: https://github.com/bassmaster187/teslalogger/blob/master/MQTTClient/readme.md
Defines the base topic name for MQTT messages.
```xml
mytesla
```
--------------------------------
### Configure MQTT Credentials
Source: https://github.com/bassmaster187/teslalogger/blob/master/MQTTClient/readme.md
Sets the username and password for MQTT broker authentication.
```xml
teslalogger
```
```xml
mypassword123
```
--------------------------------
### Backup PHPMYADMIN SQL Library
Source: https://github.com/bassmaster187/teslalogger/blob/master/phpmyadmin-howto.md
Creates a backup of the sql.lib.php file before making modifications to resolve the 'Countable' error.
```bash
sudo cp /usr/share/phpmyadmin/libraries/sql.lib.php /usr/share/phpmyadmin/libraries/sql.lib.php.bak
```
--------------------------------
### Docker Update and Upgrade Procedure
Source: https://github.com/bassmaster187/teslalogger/blob/master/docker_setup.md
Stop existing containers, fetch the latest configuration files, and restart the services to update TeslaLogger. This ensures you have the most recent code and configurations.
```bash
docker compose stop
wget https://raw.githubusercontent.com/bassmaster187/TeslaLogger/refs/heads/NET8/.env -O .env
wget https://raw.githubusercontent.com/bassmaster187/TeslaLogger/refs/heads/NET8/docker-compose.yml -O docker-compose.yml
docker compose up -d
```
--------------------------------
### Edit Backup Script
Source: https://github.com/bassmaster187/teslalogger/blob/master/docs/installation/backup_to_google_drive.md
Opens the backup script for editing using the nano text editor.
```bash
nano /etc/teslalogger/my-backup.sh
```
--------------------------------
### Test Backup Script
Source: https://github.com/bassmaster187/teslalogger/blob/master/backup_to_google_drive.md
Executes the backup script manually to verify its functionality and check for any errors.
```bash
sudo /etc/teslalogger/my-backup.sh
```
--------------------------------
### Configure Database Connection String
Source: https://github.com/bassmaster187/teslalogger/blob/master/TeslaFi-Import/README.md
Update the DBConnectionstring in the configuration file to point to the TeslaLogger database.
```xml
...
Server=raspberry;Database=teslalogger;Uid=root;Password=teslalogger;
...
```
--------------------------------
### Retrieve Charging Session Details
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Fetches metadata for a specific charging session, including location, energy delivered, and associated costs.
```bash
curl "http://raspberry:5000/getchargingstate?id=123"
# Response:
[
{
"id": 123,
"StartDate": "2024-01-15 10:30:00",
"EndDate": "2024-01-15 12:45:00",
"lat": 52.308921,
"lng": 13.444712,
"address": "Supercharger DE-Berlin",
"kWh": 45.2,
"cost_total": 15.50,
"cost_currency": "EUR"
}
]
```
--------------------------------
### Car Profile Configuration
Source: https://github.com/bassmaster187/teslalogger/blob/master/TeslaLogger/LocalTelemetry.md
Recommended car profile settings defining telemetry data fields, intervals, and delta thresholds for specific VINs.
```json
{
"vins": ["XP7XXXXXXXX0000000"],
"config": {
"hostname": "telemetry.yourdomain.com",
"port": 12345,
"ca": "${ca_data}",
"prefer_typed": true,
"fields": {
"PackVoltage": { "interval_seconds": 10, "resend_interval_seconds": 120, "minimum_delta": 0.5 },
"PackCurrent": { "interval_seconds": 10, "resend_interval_seconds": 120, "minimum_delta": 0.2 },
"ACChargingPower": { "interval_seconds": 10, "resend_interval_seconds": 120, "minimum_delta": 0.1 },
"ACChargingEnergyIn" : { "interval_seconds": 60, "resend_interval_seconds": 600, "minimum_delta": 0.1 },
"DCChargingPower": { "interval_seconds": 1, "resend_interval_seconds": 120, "minimum_delta": 0.1 },
"DCChargingEnergyIn" : { "interval_seconds": 30, "resend_interval_seconds": 120, "minimum_delta": 0.1},
"ChargeLimitSoc": { "interval_seconds": 30, "resend_interval_seconds": 86400, "minimum_delta": 1 },
"FastChargerPresent": { "interval_seconds": 5 },
"Location": { "interval_seconds": 1, "minimum_delta": 3},
"VehicleSpeed": { "interval_seconds": 1 },
"Gear": { "interval_seconds": 5, "resend_interval_seconds": 120 },
"EstBatteryRange": { "interval_seconds": 30 },
"RatedRange": { "interval_seconds": 30 },
"IdealBatteryRange": { "interval_seconds": 30 },
"Soc": { "interval_seconds": 15, "resend_interval_seconds": 300, "minimum_delta": 0.1 },
"ModuleTempMax": { "interval_seconds": 60 , "minimum_delta": 0.1 },
"NumModuleTempMax": { "interval_seconds": 60 },
"ModuleTempMin": { "interval_seconds": 60 , "minimum_delta": 0.1 },
"NumModuleTempMin": { "interval_seconds": 60 },
"NumBrickVoltageMax": { "interval_seconds": 60 },
"BrickVoltageMax": { "interval_seconds": 60, "minimum_delta": 0.001 },
"NumBrickVoltageMin": { "interval_seconds": 60 },
"BrickVoltageMin": { "interval_seconds": 60, "minimum_delta": 0.001 },
"Odometer": { "interval_seconds": 30 },
"EnergyRemaining": { "interval_seconds": 60, "minimum_delta": 0.1 },
"TimeToFullCharge": { "interval_seconds": 60 },
"EstBatteryRange": { "interval_seconds": 60, "minimum_delta": 0.1 },
"SentryMode": { "interval_seconds": 10 },
"ServiceMode": { "interval_seconds": 10 },
"ChargeState": { "interval_seconds": 10 },
"DetailedChargeState": { "interval_seconds": 10, "resend_interval_seconds": 120 },
"BatteryHeaterOn": { "interval_seconds": 10 },
"DoorState": { "interval_seconds": 10, "resend_interval_seconds": 300 },
"FdWindow": { "interval_seconds": 10, "resend_interval_seconds": 300 },
"FpWindow": { "interval_seconds": 10, "resend_interval_seconds": 300 },
"RdWindow": { "interval_seconds": 10, "resend_interval_seconds": 300 },
"RpWindow": { "interval_seconds": 10, "resend_interval_seconds": 300 },
"TpmsPressureFl": { "interval_seconds": 10, "resend_interval_seconds": 300, "minimum_delta": 0.01 },
"TpmsPressureFr": { "interval_seconds": 10, "resend_interval_seconds": 300, "minimum_delta": 0.01 },
"TpmsPressureRl": { "interval_seconds": 10, "resend_interval_seconds": 300, "minimum_delta": 0.01 },
"TpmsPressureRr": { "interval_seconds": 10, "resend_interval_seconds": 300, "minimum_delta": 0.01 },
"SpeedLimitMode": { "interval_seconds": 30 },
"VehicleName": { "interval_seconds": 600 },
"CarType": { "interval_seconds": 600 },
"Trim": { "interval_seconds": 600 },
"Version": { "interval_seconds": 600 },
"InsideTemp": { "interval_seconds": 60, "minimum_delta": 0.1 },
"OutsideTemp": { "interval_seconds": 60, "minimum_delta": 0.1 },
"Locked": { "interval_seconds": 5 },
"ChargePortDoorOpen": { "interval_seconds": 10 },
"PreconditioningEnabled": { "interval_seconds": 30 }
```
--------------------------------
### Deploy TeslaLogger with Docker Compose
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Configuration for running TeslaLogger, MariaDB, and Grafana.
```yaml
# docker-compose.yml
version: '3.8'
services:
teslalogger:
image: teslalogger/teslalogger:latest
container_name: teslalogger
restart: unless-stopped
ports:
- "5000:5000"
- "8888:8888"
volumes:
- ./backup:/etc/teslalogger/backup
- ./invoices:/etc/teslalogger/invoices
environment:
- TZ=Europe/Berlin
depends_on:
- database
database:
image: mariadb:10.4
container_name: teslalogger-db
restart: unless-stopped
environment:
- MYSQL_ROOT_PASSWORD=teslalogger
- MYSQL_DATABASE=teslalogger
- MYSQL_USER=teslalogger
- MYSQL_PASSWORD=teslalogger
volumes:
- ./mysql:/var/lib/mysql
grafana:
image: teslalogger/grafana:latest
container_name: teslalogger-grafana
restart: unless-stopped
ports:
- "3000:3000"
environment:
- TZ=Europe/Berlin
```
```bash
# Installation commands
mkdir -p backup mysql invoices
chmod 777 backup mysql invoices
```
--------------------------------
### Geofence Management
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Reload geofence definitions from configuration files to apply new POI settings.
```bash
# Reload geofence and return JSON response
curl "http://raspberry:5000/admin/ReloadGeofence"
# Response:
{"response":{"reason":"", "result":true}}
# Reload and get HTML table of all geofences
curl "http://raspberry:5000/admin/ReloadGeofence?html"
```
--------------------------------
### Wallbox/Electricity Meter Configuration
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Configure external electricity meters (wallboxes) for accurate charging energy tracking.
```APIDOC
## POST /wallbox
### Description
Configures and tests external electricity meters (wallboxes) for charging energy tracking. Supports testing, saving, and loading configurations.
### Method
POST
### Endpoint
/wallbox
### Parameters
#### Request Body
- **test** (boolean) - Optional - If true, tests the wallbox connection.
- **save** (boolean) - Optional - If true, saves the wallbox configuration.
- **load** (boolean) - Optional - If true, loads the wallbox configuration.
- **carid** (integer) - Required if `save` or `load` is true - The ID of the car.
- **type** (string) - Required - The type of the wallbox (e.g., 'go-e', 'openWB', 'keba').
- **host** (string) - Required for `test` and `save` - The hostname or IP address of the wallbox.
- **param** (string) - Optional - Additional parameters for the wallbox configuration.
### Request Example (Test Wallbox)
```bash
curl -X POST "http://raspberry:5000/wallbox" \
-H "Content-Type: application/json" \
-d
'{
"test": true,
"type": "go-e",
"host": "192.168.1.50",
"param": ""
}'
```
### Request Example (Save Wallbox Configuration)
```bash
curl -X POST "http://raspberry:5000/wallbox" \
-H "Content-Type: application/json" \
-d
'{
"save": true,
"carid": 1,
"type": "go-e",
"host": "192.168.1.50",
"param": ""
}'
```
### Request Example (Load Wallbox Configuration)
```bash
curl -X POST "http://raspberry:5000/wallbox" \
-H "Content-Type: application/json" \
-d '{"load": true, "carid": 1}'
```
### Response
#### Success Response (200)
- **Version** (string) - The version of the wallbox integration.
- **Utility_kWh** (number) - The total energy consumed from the utility in kWh (during test).
- **Vehicle_kWh** (number) - The energy delivered to the vehicle in kWh (during test).
#### Response Example (Test)
```json
{"Version": "1.5.2", "Utility_kWh": 1234.5, "Vehicle_kWh": 567.8}
```
### Supported Wallbox Types
`go-e`, `openWB`, `openWB2`, `EVCC`, `cfos`, `shelly3EM`, `shellyEM`, `TeslaGen3WallConnector`, `keba`, `smartEVSE3`, `WARP`
```
--------------------------------
### Connect to MySQL as Root
Source: https://github.com/bassmaster187/teslalogger/blob/master/phpmyadmin-howto.md
Connect to the MySQL server using the root user with the password 'teslalogger'. This is typically done via SSH.
```bash
mysql -u root -h localhost -p
```
--------------------------------
### ABRP Integration (A Better Route Planner)
Source: https://context7.com/bassmaster187/teslalogger/llms.txt
Configure integration with A Better Route Planner for live data sharing during trips.
```APIDOC
## ABRP Integration
### Get ABRP Settings
#### Description
Retrieves the current A Better Route Planner (ABRP) integration settings for a specific car.
#### Method
GET
#### Endpoint
/abrp/{carid}/info
#### Parameters
##### Path Parameters
- **carid** (integer) - Required - The ID of the car.
#### Response
##### Success Response (200)
- **token** (string) - The ABRP API token.
- **mode** (integer) - The ABRP integration mode.
#### Response Example
```json
{"token": "abc123xyz", "mode": 1}
```
### Set ABRP Settings
#### Description
Configures the A Better Route Planner (ABRP) integration settings for a specific car.
#### Method
POST
#### Endpoint
/abrp/{carid}/set
#### Parameters
##### Path Parameters
- **carid** (integer) - Required - The ID of the car.
##### Request Body (JSON)
- **abrp_token** (string) - Required - Your ABRP API token.
- **abrp_mode** (integer) - Required - The ABRP integration mode.
##### Query Parameters (Alternative to Request Body)
- **abrp_token** (string) - Required - Your ABRP API token.
- **abrp_mode** (integer) - Required - The ABRP integration mode.
#### Request Example (JSON Body)
```bash
curl -X POST "http://raspberry:5000/abrp/1/set" \
-H "Content-Type: application/json" \
-d '{"abrp_token": "your-abrp-token", "abrp_mode": 1}'
```
#### Request Example (Query String)
```bash
curl "http://raspberry:5000/abrp/1/set?abrp_token=your-token&abrp_mode=1"
```
```