Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryanburnette/tesla-fleet-homeassistant
https://github.com/ryanburnette/tesla-fleet-homeassistant
Last synced: 17 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ryanburnette/tesla-fleet-homeassistant
- Owner: ryanburnette
- License: apache-2.0
- Created: 2024-11-10T18:57:27.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-11-10T19:01:27.000Z (3 months ago)
- Last Synced: 2024-11-19T19:52:18.474Z (3 months ago)
- Language: Shell
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tesla Fleet API Utilities for Home Assistant
This guide provides instructions on setting up utilities for the Tesla Fleet API integration with Home Assistant. These scripts help complete steps 3 and 4 of the Home Assistant Tesla setup.
## Prerequisites
Before running the scripts, you’ll need to install two dependencies: `dotenv` and `jq`. You can install them with `webi` as follows:
```bash
curl -sS https://webinstall.dev/jq | bash
curl -sS https://webinstall.dev/dotenv | bash
```## Setup
### Environment Variables
Create a `.env` file in the same directory as the scripts to securely store your Tesla API credentials. The `.env` file should include:
```plaintext
CLIENT_ID=your_client_id_here
CLIENT_SECRET=your_client_secret_here
```Replace `your_client_id_here` and `your_client_secret_here` with your actual Tesla client credentials.
## Scripts
### 1. `generate-partner-token.sh`
This script generates a partner token for authentication with Tesla’s Fleet API. It outputs the token to `partner-token.json`.
#### Usage
```bash
./generate-partner-token.sh > partner-token.json
```This command requests an access token using your client credentials from the `.env` file and saves it in `partner-token.json`.
### 2. `register.sh`
This script registers a partner account with a specified domain, using the partner authentication token from `partner-token.json`.
#### Usage
```bash
./register.sh
```Replace `` with your actual domain name. For example:
```bash
./register.sh example.com
```If the token retrieval fails, the script will provide an error message. The script requires `jq` to extract the token from `partner-token.json`.
---
By following these steps, you’ll be able to integrate the Tesla Fleet API with your Home Assistant setup successfully.