website/docs/import/tesla_apiscraper.md
This is a multi-step process to export your data from a tesla-apiscraper InfluxDB backend, convert it to a format that can be imported into TeslaMate (specifically TeslaFi CSV) while fixing up some typical data glitches the scraper produces, and then import it.
A copy of the data stored by tesla-apiscraper - specifically the /opt/apiscraper/influxdb folder mounted in the standard apiscraper Docker configuration. Create a backup of this before attempting the export and conversion, just in case.
A system running Docker with sufficient RAM for InfluxDB to perform the CSV export. This does not need to be the same machine where API Scraper and/or TeslaMate was/is running - you can do the export and conversion on your PC/Mac. The important thing is to give the Docker machine more than 2GB of RAM, otherwise the InfluxDB export may fail.
CREATE A BACKUP OF YOUR DATA before attempting to import anything into TeslaMate. This is all highly experimental and has only been successfully done once :)
:::note Troubleshooting All of this is experimental and has not been extensively tested. If you encounter an error during Part 1 or Part 2, please create an issue in the tesla-apiscraper-to-teslafi-export project on GitHub, since it's not directly related to TeslaMate. :::
Download or clone the tesla-apiscraper-to-teslafi-export repository into a folder on your machine.
Place the tesla-apiscraper data folder contents (data, meta and wal folders) into the influxdb-data folder, next to the influxdb-export.sh file. The folder structure must look like this:
.
├── influxdb-export.sh
├── influxdb-export.bat
├── (other stuff)
└── influxdb-data
├── README.md
├── data
├── meta
└── wal
Run the influxdb-export.sh script (or influxdb-export.bat if you're on Windows). You may need to sudo it / run it in an Administrator command line prompt if your Docker install needs root. It will do the following:
influxdb-csv output folder, if it doesn't exist yetinfluxdb-data and influxdb-csv folders mounted (on Windows, you may need to allow your Docker to access the drive you are working on for the mounts to work)influxdb-csv folderThis may take a little while. After the process has finished, if there are no errors reported, continue with the next part of the instructions.
Obtain your Tesla's vehicle ID number. It's a 10- or 11-digit number that uniquely identifies your car, and is part of the TeslaFi data format, but it's not included in tesla-apiscraper data - so you need to source it separately. There are several ways you can get it:
vehicle_id in the vehicles response, as documented here: https://tesla-api.timdorr.com/api-basics/vehicles.Run the teslafi-convert.sh script (or teslafi-convert.bat if you're on Windows). You may need to sudo it / run it in an Administrator command line prompt if your Docker install needs root. It will do the following:
teslafi-csv output folder, if it doesn't exist yetconverter app and its few dependencies, with the influxdb-csv and teslafi-csv folders mounted (on Windows, you may need to allow your Docker to access the drive you are working on for the mounts to work)influxdb-csv folder. This may take a couple minutes. Progress is displayed as the converter works its way through the filesThe finished TeslaFi-compatible CSV files are now located in the teslafi-csv folder.