Skip to content

Latest commit

 

History

History
152 lines (94 loc) · 5.81 KB

DOCS.md

File metadata and controls

152 lines (94 loc) · 5.81 KB

Home Assistant Add-on: TeslaMate

A self-hosted data logger for your Tesla 🚘

About

TeslaMate is a powerful, self-hosted data logger for your Tesla.

  • Written in Elixir
  • Data is stored in a Postgres database
  • Visualization and data analysis with Grafana
  • Vehicle data is published to a local MQTT Broker

This add-on allows you to run TeslaMate on your Home Assistant server based on the the official TeslaMate docker image.

Configuration

The configuration is self-explanatory, but essentially we need details about accessing the PostgreSQL database, Grafana and optionally MQTT.

Options

Remember to restart the add-on when the configuration is changed.

Database Options

  • database_user: The username used to connect to your PostgreSQL server.

  • database_pass: The password for the user to connect to your PostgreSQL server.

  • database_port: The port your PostgreSQL server is listening on. Default: 5432.

  • database_host: The hostname of your PostgreSQL server.

  • database_name: The name of the PostgreSQL database. Default: teslamate.

  • database_ssl: Use SSL to connect to the database.

MQTT Options (Optional)

If you are going to use MQTT, you must have a username and password defined for your MQTT user; do not use the HA local login (thanks quach128).

You must also specify an access control list entry for the teslamate user, for example:

user teslamate
topic readwrite teslamate/#

See the official docs on how to configure access control with Mosquitto

  • disable_mqtt: Disable MQTT?

  • mqtt_host: The hostname of your MQTT server.

  • mqtt_user: The username used to connect to your MQTT server.

  • mqtt_pass: The password for the user to connect to your PostgreSQL server.

  • mqtt_tls: Use TLS to connect to MQTT?

  • mqtt_tls_accept_invalid_certs: MQTT TLS Accepts invalid certificates

  • mqtt_namespace: MQTT Namespace

Grafana Options

I recommend you use the existing Grafana add-on from the community add-ons, if you do, please enable the following plugins in your yaml configurations, e.g.

plugins:
  - natel-discrete-panel
  - natel-plotly-panel
  - pr0ps-trackmap-panel
  - grafana-piechart-panel
custom_plugins:
  - name: panodata-map-panel
    url: https://github.com/panodata/panodata-map-panel/releases/download/0.16.0/panodata-map-panel-0.16.0.zip
    unsigned: true
custom_plugins: []
env_vars:
  - name: GF_SECURITY_ADMIN_USER
    value: <youruser>
  - name: GF_SECURITY_ADMIN_PASSWORD
    value: <yourpass>
ssl: true                 # optional if you are using TLS
certfile: fullchain.pem    # optional if you are using TLS
keyfile: privkey.pem       # optional if you are using TLS

Note that the security admin password and usernames can only be set on the first start of the Grafana add-on, so if you already have it configured you'll need to use the same details or remove the add-on and re-add it.

  • grafana_import_dashboards: (Optional, but recommended) Automatically import the grafana dashboards on startup?

  • grafana_folder_name: Folder within Grafana to store all the dashboards. Default: TeslaMate.

  • grafana_host: The hostname of your Grafana server. Default: a0d7b954-grafana.

  • grafana_port: The port your Grafana server is listening on. Default: 3000.

  • grafana_user: The username used to connect to your Grafana server.

  • grafana_pass: The password for the user to connect to your Grafana server.

  • timezone: Timezone to use for Granafa dashboards.

Once you have Grafana up and running, you'll need to configure a data source to read data from the PostgreSQL database:

Grafana Postgres data source

Other Options

  • default_geofence: (Optional) The default geofence to send via GEOFENCE if the car is not in a geofence.

  • encryption_key: (Optional) A random string used as encrypt and protect the Tesla API keys. This will be auto-generated on first run if not set.

  • import_dir: (Optional) The path to the directory where TeslaMate should look for the TeslaMate export CSV file. Default: /share/teslamate.

  • env_vars: (Optional) Set additional environment variables for TeslaMate which aren't currently exposed by the configuration options in this add-on.

    Each entry is made up of a name and value:

    • name: The case-sensitive environment variable name.
    • value: The value to be set in the environment variable.

    Note: These will also overwrite any environment variable set using the configuration options above.

Data Import from TeslaFi

It is now possible to import CSV data from TeslaFi, refer to the official docs.

Follow this process:

  1. Copy the CSV data to the /share/teslamate folder on your Home Assistant instance. You can do this using the Samba or SSH add-ons.

  2. Make sure the import_path configuration setting is set to /share/teslamate.

  3. Restart the TeslaMate add-on and navigate to the web UI, you should be presented with the import screen.

  4. Import the data

  5. Once imported sucessfully, delete the CSV files to avoid the import screen being presented.