Files
archived-hipudding-teslamate/website/docs/import/teslafi.md
Wilfried Chauveau 0db778e06c feat: Update TeslaFi importer to accept newer export formats (#3431)
* Update TeslaFi importer to accept newer export formats

* Update documentation
2024-05-24 09:01:50 +02:00

57 lines
2.6 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: Import from TeslaFi (BETA)
sidebar_label: TeslaFi
---
## Requirements
- **CREATE A [BACKUP](../maintenance/backup_restore.md) OF YOUR DATA‼**
- If you have been using TeslaMate since before the 1.16 release, the [docker-compose.yml](../installation/docker.md) needs to be updated. Add the following volume mapping to the `teslamate` service:
```yml {4-5}
services:
teslamate:
# ...
volumes:
- ./import:/opt/app/import
```
- Export your TeslaFi data (for one car) as CSV by month: `Settings -> Advanced -> Download TeslaFi Data`.
- If you have a ton of TeslaFi data and don't want to deal with the UI, you can run this python script to export all data: [Export from TeslaFi #563](https://github.com/teslamate-org/teslamate/issues/563)
## Instructions
1. Copy the exported CSV files (in the format "TeslaFixxxxxx.csv") into a **directory named `import`** next to the _docker-compose.yml_:
```console
.
├── docker-compose.yml
└── import
├── TeslaFi82019.csv
├── TeslaFi92019.csv
├── TeslaFi102019.csv
├── TeslaFi112019.csv
└── TeslaFi122019.csv
```
:::tip
The path of the import directory can be customized with the **IMPORT_DIR** [environment variable](../configuration/environment_variables.md).
:::
2. **Restart** the teslamate service and open the TeslaMate admin interface. Now the import form should be displayed instead of the vehicle summary.
3. Since the raw data is in the local timezone (assigned by the home address in the TeslaFi settings page) you need to **select your local timezone**. Then start the import. On low-end hardware like the Raspberry Pi, importing a large data set spanning several years will take a couple of hours.
4. After the import is complete, **empty the `import` directory** (or remove but ensure docker doesn't have a volume mapping) and **restart** the `teslamate` service.
:::note
If there is an overlap between the already existing TeslaMate and TeslaFi data, only the data prior to the first TeslaMate data will be imported.
:::
:::note
If the CSV files are missing the vehicle ID, the imported will default to `1`. You can alter this behavior by setting the environment variable `TESLAFI_IMPORT_VEHICLE_ID`.
:::
:::note
Since the exported CSV files do not contain addresses, they are added automatically during and after the import. So please note that not all addresses are visible immediately after the import/restarting. Depending on the amount of data imported, it may take a while before they appear. The same applies to elevation data.
:::