Files
archived-teslamate/website/docs/configuration/environment_variables.md
jlestel c8159cfc51 Customize intervals between vehicle_data calls (#3940)
* feat: endpoints by env

* fix: typo

* fix: useless env

* fix: format

* fix: distinct auth domain and url

* format

* fix: force issuer url if needed

* feat: new streaming based on vin

* fix refresh

* revert

* up

* feat: no need for access token / refresh token if the TOKEN env var is present

* feat: update login if token env var exists

* feat: add ENV var to allow insecure wss

* fix: remove TESLA_CN

* fix(naming): TESLA_API_URL to TESLA_API_DOMAIN

* feat: add an env var to allo invalid certs on WSS

* doc: add API domains env vars description

* fix: typo

* feat: add env var to change log level

* fix: APP_LOG_LEVEL

* feat: add TOKEN documention and wording

* fix: refacto insecure param

* feat: naming and doc

* fix: missing env var usage

* fix: rebound variable issuer_url

* fix: compilation warning on the issuer_url variable

* fix: format code

* fix: issuer_url assignments

* feat: customize polling intervals

* typo

* update doc

* typo

* add online interval

* add POLLING_ONLINE_INTERVAL

* format

* add minimum interval

* Add minimum on fetch parameter

* typo

* format

* respect immediate fetch, add charging interval

* add log level

* Respect log_level

* format

* use LOG_LEVEL env var to facilitate debug

* revert on log_level

* format

* typo

* format again

* revert on default error intervals

* Add a note in MD about polling settings

* not let the user set intervals via env variables shorter than our defaults

---------

Co-authored-by: Julien <julien@citio.digital>
2024-07-02 15:36:46 +02:00

20 KiB

id, title, sidebar_label
id title sidebar_label
environment_variables Environment Variables Environment Variables

TeslaMate accepts the following environment variables for runtime configuration:

Variable Name Description Default Value
ENCRYPTION_KEY A key used to encrypt the Tesla API tokens (required)
DATABASE_USER Username (required)
DATABASE_PASS User password (required)
DATABASE_NAME The database to connect to (required)
DATABASE_HOST Hostname of the database server (required)
DATABASE_PORT Port of the database server 5432
DATABASE_POOL_SIZE Size of the database connection pool 10
DATABASE_TIMEOUT The time in milliseconds to wait for database query calls to finish 60000
DATABASE_SSL Set to true if SSL should be enabled or noverify if certificate verification should not be performed. false
DATABASE_SSL_CA_CERT_FILE Path to a file containing PEM-encoded CA certificates (required if DATABASE_SSL is set to true)
DATABASE_SSL_SNI set SNI for host undel ssl mode
DATABASE_IPV6 Set to true if IPv6 should be used false
VIRTUAL_HOST Host part used for generating URLs throughout the app localhost
URL_PATH Path used for generating URLs (can be used with a reverse proxy) /
CHECK_ORIGIN Configures whether to check the origin header or not. May be true (recommended), false (default) or a comma-separated list of hosts that are allowed (e.g. https://example.com,//another.com:8080). Hosts also support wildcards. If true, it will check against the host value in VIRTUAL_HOST. false
PORT Port where the web interface is exposed 4000
HTTP_BINDING_ADDRESS IP address where the web interface is exposed, or blank (default) meaning all addresses.
DISABLE_MQTT Disables the MQTT feature if true false
MQTT_HOST Hostname of the broker (required unless DISABLE_MQTT is true)
MQTT_PORT Port of the broker 1883 (8883 for MQTT over TLS)
MQTT_USERNAME Username
MQTT_PASSWORD Password
MQTT_TLS Enables TLS if true false
MQTT_TLS_ACCEPT_INVALID_CERTS Accepts invalid certificates if true false
MQTT_IPV6 Set to true if IPv6 should be used false
MQTT_NAMESPACE Inserts a custom namespace into the MQTT topic . For example, with MQTT_NAMESPACE=account_0: teslamate/account_0/cars/$car_id/state.
IMPORT_DIR The path of the directory for the import of data (e.g. TeslaFi) ./import
TZ Used to establish the local time zone, e.g. to use the local time in logs. See List of tz database time zones.
DEFAULT_GEOFENCE The default GEOFENCE to send via GEOFENCE if car not in geofence. Overrides the default of "" which will delete any retained value. "" (no quotes)
TESLAFI_IMPORT_VEHICLE_ID The default Vehicle ID used when importing from TeslaFi. If it is not defined and the import source does not contain the data, 1 is used.
TESLA_API_HOST Hostname of the Tesla API https://owner-api.teslamotors.com (or for chinese: https://owner-api.vn.cloud.tesla.cn)
TESLA_AUTH_HOST Hostname of the Tesla authentication API https://auth.tesla.com
TESLA_AUTH_PATH The Tesla authentication path /oauth2/v3
TESLA_AUTH_CLIENT_ID Client ID of the application registered on developer.tesla.com ownerapi
TESLA_WSS_HOST Hostname of the Tesla streaming wss://streaming.vn.teslamotors.com (or for chinese: wss://streaming.vn.cloud.tesla.cn)
TESLA_WSS_TLS_ACCEPT_INVALID_CERTS Accepts invalid certificates on TESLA_WSS_HOST if true
TESLA_WSS_USE_VIN Use the vin field instead of vid to connect stream if true
TOKEN Token given by a third party Tesla API provider. This TOKEN is added to each API request and the format must be ?token=xxxx-xxxx-xxxx
POLLING_ASLEEP_INTERVAL Interval between API fetch when the vehicle is asleep (in seconds). Important: Do not alter this setting unless you are certain of the implications. 30
POLLING_CHARGING_INTERVAL Minimum interval between API fetch when the vehicle is charging (in seconds). Important: Do not alter this setting unless you are certain of the implications. 5
POLLING_DRIVING_INTERVAL Interval between API fetch when the vehicle is driving (in seconds). Important: Do not alter this setting unless you are certain of the implications. 2.5
POLLING_ONLINE_INTERVAL Interval between API fetch when the vehicle is online (in seconds). Important: Do not alter this setting unless you are certain of the implications. 60
POLLING_DEFAULT_INTERVAL Default interval between API fetch (in seconds). Important: Do not alter this setting unless you are certain of the implications. 15
POLLING_MINIMUM_INTERVAL Minimum interval between API fetch. No minimum by default. Important: Do not alter this setting unless you are certain of the implications. 0