|
| 1 | +# @teslemetry/homebridge-teslemetry |
| 2 | + |
| 3 | +[](https://badge.fury.io/js/%40teslemetry%2Fhomebridge-teslemetry) |
| 4 | +[](https://github.com/homebridge/homebridge/wiki/Verified-Plugins) |
| 5 | + |
| 6 | +Teslemetry platform plugin for Homebridge with **real-time streaming support** for Tesla vehicles and energy sites. |
| 7 | + |
| 8 | +## Features |
| 9 | + |
| 10 | +🚗 **Tesla Vehicle Control** |
| 11 | +- Real-time status updates via Server-Sent Events (SSE) |
| 12 | +- Lock/unlock doors |
| 13 | +- Climate control (heat/cool) |
| 14 | +- Charge management |
| 15 | +- Sentry mode control |
| 16 | +- Window control |
| 17 | +- And more... |
| 18 | + |
| 19 | +⚡ **Energy Site Support** *(Coming Soon)* |
| 20 | +- Powerwall monitoring |
| 21 | +- Solar production tracking |
| 22 | +- Grid control |
| 23 | + |
| 24 | +🔄 **Real-time Streaming** |
| 25 | +- Instant updates when vehicle state changes |
| 26 | +- No polling - efficient and responsive |
| 27 | +- Built on Teslemetry's Fleet Telemetry API |
| 28 | + |
| 29 | +## Requirements |
| 30 | + |
| 31 | +- **Active Teslemetry Subscription**: Create an account and get an access token at [teslemetry.com](https://teslemetry.com) |
| 32 | +- **Node.js**: Version 18 or higher |
| 33 | +- **Homebridge**: Version 1.8.0 or higher |
| 34 | +- **Fleet Telemetry Support**: Your vehicle must support Fleet Telemetry (most recent Tesla vehicles) |
| 35 | + |
| 36 | +## Installation |
| 37 | + |
| 38 | +### Via Homebridge Config UI X (Recommended) |
| 39 | + |
| 40 | +1. Search for "Teslemetry" in the Homebridge Config UI X plugin search |
| 41 | +2. Click **Install** |
| 42 | +3. Configure the plugin with your Teslemetry access token |
| 43 | + |
| 44 | +### Via Command Line |
| 45 | + |
| 46 | +```bash |
| 47 | +npm install -g @teslemetry/homebridge-teslemetry |
| 48 | +``` |
| 49 | + |
| 50 | +Or if using pnpm: |
| 51 | + |
| 52 | +```bash |
| 53 | +pnpm add -g @teslemetry/homebridge-teslemetry |
| 54 | +``` |
| 55 | + |
| 56 | +## Configuration |
| 57 | + |
| 58 | +### Via Homebridge Config UI X |
| 59 | + |
| 60 | +The easiest way to configure this plugin is through the Homebridge Config UI X interface. All options are available through the visual interface. |
| 61 | + |
| 62 | +### Manual Configuration |
| 63 | + |
| 64 | +Add the following to your Homebridge `config.json`: |
| 65 | + |
| 66 | +```json |
| 67 | +{ |
| 68 | + "platforms": [ |
| 69 | + { |
| 70 | + "platform": "Teslemetry", |
| 71 | + "name": "Teslemetry", |
| 72 | + "accessToken": "your_teslemetry_access_token_here", |
| 73 | + "prefixName": true, |
| 74 | + "latitude": 37.7749, |
| 75 | + "longitude": -122.4194, |
| 76 | + "ignoreVehicles": [], |
| 77 | + "ignoreEnergySites": [] |
| 78 | + } |
| 79 | + ] |
| 80 | +} |
| 81 | +``` |
| 82 | + |
| 83 | +### Configuration Options |
| 84 | + |
| 85 | +| Option | Type | Required | Default | Description | |
| 86 | +|--------|------|----------|---------|-------------| |
| 87 | +| `platform` | string | **Yes** | - | Must be `"Teslemetry"` | |
| 88 | +| `accessToken` | string | **Yes** | - | Your Teslemetry API access token from [teslemetry.com](https://teslemetry.com) | |
| 89 | +| `name` | string | No | `"Teslemetry"` | Display name for the platform | |
| 90 | +| `prefixName` | boolean | No | `true` | Whether to prefix accessory names with the vehicle name | |
| 91 | +| `latitude` | number | No | - | Latitude for Homelink activation (required if using Homelink) | |
| 92 | +| `longitude` | number | No | - | Longitude for Homelink activation (required if using Homelink) | |
| 93 | +| `ignoreVehicles` | string[] | No | `[]` | Array of vehicle VINs to ignore | |
| 94 | +| `ignoreEnergySites` | number[] | No | `[]` | Array of energy site IDs to ignore | |
| 95 | + |
| 96 | +## Getting a Teslemetry Access Token |
| 97 | + |
| 98 | +1. Go to [teslemetry.com](https://teslemetry.com) |
| 99 | +2. Create an account or log in |
| 100 | +3. Navigate to your account settings |
| 101 | +4. Generate a new API access token |
| 102 | +5. Copy the token and paste it into your Homebridge configuration |
| 103 | + |
| 104 | +## Supported Vehicles |
| 105 | + |
| 106 | +This plugin supports all Tesla vehicles that have Fleet Telemetry capability: |
| 107 | + |
| 108 | +- Model 3 (2017+) |
| 109 | +- Model Y (2020+) |
| 110 | +- Model S (2021+ refresh) |
| 111 | +- Model X (2021+ refresh) |
| 112 | +- Cybertruck (2023+) |
| 113 | + |
| 114 | +Older Model S and Model X vehicles may have limited support. |
| 115 | + |
| 116 | +## HomeKit Accessories |
| 117 | + |
| 118 | +Each Tesla vehicle will appear as multiple accessories in HomeKit: |
| 119 | + |
| 120 | +### Current Implementation (Phase 1) |
| 121 | +- **Vehicle Discovery** - Automatic discovery and registration of vehicles |
| 122 | +- **Real-time Streaming** - Connection to Teslemetry's streaming API |
| 123 | + |
| 124 | +### Coming Soon (Phase 2) |
| 125 | +- **Battery Service** - Battery level and charging status |
| 126 | +- **Lock Service** - Lock/unlock doors |
| 127 | +- **Climate Service** - Temperature control and HVAC |
| 128 | +- **Charge Port** - Open/close charge port |
| 129 | +- **Charge Switch** - Start/stop charging |
| 130 | +- **Charge Limit** - Set charge limit percentage |
| 131 | +- **Defrost Service** - Activate max defrost |
| 132 | +- **Door Sensors** - Individual door status |
| 133 | +- **Window Control** - Vent/close windows |
| 134 | +- **Sentry Mode** - Enable/disable sentry mode |
| 135 | +- **Homelink** - Trigger Homelink (requires location config) |
| 136 | + |
| 137 | +## Troubleshooting |
| 138 | + |
| 139 | +### Plugin Not Discovering Vehicles |
| 140 | + |
| 141 | +1. Verify your access token is correct |
| 142 | +2. Check that you have an active Teslemetry subscription |
| 143 | +3. Ensure your vehicle supports Fleet Telemetry |
| 144 | +4. Check Homebridge logs for error messages |
| 145 | + |
| 146 | +### Streaming Connection Issues |
| 147 | + |
| 148 | +1. Verify network connectivity |
| 149 | +2. Check that Teslemetry streaming is enabled for your account |
| 150 | +3. Restart Homebridge |
| 151 | +4. Check firewall settings (SSE requires persistent connections) |
| 152 | + |
| 153 | +### Accessories Not Responding |
| 154 | + |
| 155 | +1. Check if vehicle is asleep (may take a moment to wake) |
| 156 | +2. Verify streaming connection status in logs |
| 157 | +3. Try restarting the Homebridge service |
| 158 | + |
| 159 | +## Development |
| 160 | + |
| 161 | +This package is part of the [Teslemetry TypeScript monorepo](https://github.com/Teslemetry/typescript-teslemetry). |
| 162 | + |
| 163 | +### Local Development |
| 164 | + |
| 165 | +```bash |
| 166 | +# Clone the repository |
| 167 | +git clone https://github.com/Teslemetry/typescript-teslemetry.git |
| 168 | +cd typescript-teslemetry |
| 169 | + |
| 170 | +# Install dependencies |
| 171 | +pnpm install |
| 172 | + |
| 173 | +# Build the package |
| 174 | +pnpm --filter @teslemetry/homebridge-teslemetry build |
| 175 | + |
| 176 | +# Watch mode for development |
| 177 | +pnpm --filter @teslemetry/homebridge-teslemetry watch |
| 178 | +``` |
| 179 | + |
| 180 | +### Testing Locally |
| 181 | + |
| 182 | +```bash |
| 183 | +# Link globally for testing |
| 184 | +cd packages/homebridge-teslemetry |
| 185 | +pnpm link --global |
| 186 | + |
| 187 | +# In your Homebridge directory |
| 188 | +cd ~/.homebridge |
| 189 | +pnpm link --global @teslemetry/homebridge-teslemetry |
| 190 | + |
| 191 | +# Run Homebridge in debug mode |
| 192 | +homebridge -D |
| 193 | +``` |
| 194 | + |
| 195 | +## Contributing |
| 196 | + |
| 197 | +Contributions are welcome! Please read the [contributing guidelines](../../CONTRIBUTING.md) before submitting pull requests. |
| 198 | + |
| 199 | +## Support |
| 200 | + |
| 201 | +- **Issues**: [GitHub Issues](https://github.com/Teslemetry/typescript-teslemetry/issues) |
| 202 | +- **Documentation**: [Teslemetry Docs](https://teslemetry.com/docs) |
| 203 | +- **Community**: [Teslemetry Discord](https://discord.gg/teslemetry) |
| 204 | + |
| 205 | +## License |
| 206 | + |
| 207 | +Apache-2.0 - see [LICENSE](../../LICENSE) for details. |
| 208 | + |
| 209 | +## Credits |
| 210 | + |
| 211 | +- Built with [@teslemetry/api](https://www.npmjs.com/package/@teslemetry/api) |
| 212 | +- Powered by [Teslemetry](https://teslemetry.com) |
| 213 | +- Part of the [Homebridge](https://homebridge.io) ecosystem |
| 214 | + |
| 215 | +## Related Projects |
| 216 | + |
| 217 | +- [@teslemetry/api](../api) - Core TypeScript SDK |
| 218 | +- [node-red-contrib-teslemetry](../node-red-contrib-teslemetry) - Node-RED integration |
| 219 | +- [n8n-nodes-teslemetry](../n8n-nodes-teslemetry) - n8n workflow integration |
| 220 | +- [homey](../homey) - Homey smart home app |
| 221 | + |
| 222 | +## Changelog |
| 223 | + |
| 224 | +See [CHANGELOG.md](./CHANGELOG.md) for release history. |
0 commit comments