The files that directly interact with the Tesla API are:
- connection.py - low level access
- controller.py - high level access and api
The controller provides a managed connection to a logged in session and will control access to all vehicles. It also performs throttling on certain commands to avoid overloading the Tesla API and will return cached copies of the JSON datastructure through the following commands.
- get_climate_params
- get_charging_params
- get_state_params
- get_config_params
- get_drive_params
- get_gui_params
If you want access to the API for your own app, you will likely only need to access these files. The other files are examples of an implementation.
If you're looking to add functionality to Home Assistant you will need to do the following:
- Check the controller file to see if an appropriate API call exists. If necessary add them. Check out these references:
- Build a proper abstraction inheriting from the vehicle.py. Check out lock.py.
- Add abstraction to the controller _add_components so it will be discoverable.
- Add changes to Home Assistant to access your abstraction and submit a PR per HA guidelines.
Tesla has deprecated the Owner API for modern vehicles.
https://developer.tesla.com/docs/fleet-api#2023-10-09-rest-api-vehicle-commands-endpoint-deprecation-warning
To use the HTTP Proxy, you must provide your Client ID and Proxy URL (e.g. https://tesla.example.com). If your proxy uses a self-signed certificate, you may provide the path to that certificate as a config parameter so it will be trusted.
The proxy server requires the command URL to contain the VIN, not the ID. Reference. Otherwise you get an error like this:
[teslajsonpy.connection] post: https://local-tesla-http-proxy:4430/api/1/vehicles/xxxxxxxxxxxxxxxx/command/auto_conditioning_start {}
[teslajsonpy.connection] 404: {"response":null,"error":"expected 17-character VIN in path (do not user Fleet API ID)","error_description":""}