Skip to main content

Environment Variables

TeslaMate accepts the following environment variables for runtime configuration:

Variable NameDescriptionDefault Value
ENCRYPTION_KEYA key used to encrypt the Tesla API tokens (required)
DATABASE_USERUsername (required)
DATABASE_PASSUser password (required)
DATABASE_NAMEThe database to connect to (required)
DATABASE_HOSTHostname of the database server (required)
DATABASE_PORTPort of the database server5432
DATABASE_POOL_SIZESize of the database connection pool10
DATABASE_TIMEOUTThe time in milliseconds to wait for database query calls to finish60000
DATABASE_SSLSet to true if SSL should be enabled or noverify if certificate verification should not be performed.false
DATABASE_SSL_CA_CERT_FILEPath to a file containing PEM-encoded CA certificates (required if DATABASE_SSL is set to true)
DATABASE_SSL_SNIset SNI for host undel ssl mode
DATABASE_IPV6Set to true if IPv6 should be usedfalse
VIRTUAL_HOSTHost part used for generating URLs throughout the applocalhost
URL_PATHPath used for generating URLs (can be used with a reverse proxy)/
CHECK_ORIGINConfigures 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
PORTPort where the web interface is exposed4000
HTTP_BINDING_ADDRESSIP address where the web interface is exposed, or blank (default) meaning all addresses.
DISABLE_MQTTDisables the MQTT feature if truefalse
MQTT_HOSTHostname of the broker (required unless DISABLE_MQTT is true)
MQTT_PORTPort of the broker1883 (8883 for MQTT over TLS)
MQTT_USERNAMEUsername
MQTT_PASSWORDPassword
MQTT_TLSEnables TLS if truefalse
MQTT_TLS_ACCEPT_INVALID_CERTSAccepts invalid certificates if truefalse
MQTT_IPV6Set to true if IPv6 should be usedfalse
MQTT_NAMESPACEInserts a custom namespace into the MQTT topic . For example, with MQTT_NAMESPACE=account_0: teslamate/account_0/cars/$car_id/state.
IMPORT_DIRThe path of the directory for the import of data (e.g. TeslaFi)./import
TZUsed to establish the local time zone, e.g. to use the local time in logs. See List of tz database time zones.
DEFAULT_GEOFENCEThe 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_IDThe 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_HOSTHostname of the Tesla APIhttps://owner-api.teslamotors.com (or for chinese: https://owner-api.vn.cloud.tesla.cn)
TESLA_AUTH_HOSTHostname of the Tesla authentication APIhttps://auth.tesla.com
TESLA_AUTH_PATHThe Tesla authentication path/oauth2/v3
TESLA_AUTH_CLIENT_IDClient ID of the application registered on developer.tesla.comownerapi
TESLA_WSS_HOSTHostname of the Tesla streamingwss://streaming.vn.teslamotors.com (or for chinese: wss://streaming.vn.cloud.tesla.cn)
TESLA_WSS_TLS_ACCEPT_INVALID_CERTSAccepts invalid certificates on TESLA_WSS_HOST if true
TESLA_WSS_USE_VINUse the vin field instead of vid to connect stream if true
TOKENToken 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_INTERVALInterval 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_INTERVALMinimum 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_INTERVALInterval 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_INTERVALInterval 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_INTERVALDefault interval between API fetch (in seconds). Important: Do not alter this setting unless you are certain of the implications.15
POLLING_MINIMUM_INTERVALMinimum interval between API fetch. No minimum by default. Important: Do not alter this setting unless you are certain of the implications.0