|
1 | 1 | # Node-RED Teslemetry Integration |
2 | 2 |
|
3 | | -Node-RED nodes for interacting with Tesla vehicles and energy sites via [Teslemetry](https://teslemetry.com). |
| 3 | +[](https://www.npmjs.com/package/@teslemetry/node-red-contrib-teslemetry) |
| 4 | +[](https://opensource.org/licenses/Apache-2.0) |
| 5 | + |
| 6 | +Node-RED nodes for controlling Tesla vehicles and energy sites via the [Teslemetry](https://teslemetry.com) API. |
| 7 | + |
| 8 | +## Features |
| 9 | + |
| 10 | +- 🚗 **Vehicle Control**: Lock/unlock, climate, charging, navigation, and more |
| 11 | +- ⚡ **Energy Management**: Monitor and control Powerwall and Solar systems |
| 12 | +- 📡 **Real-Time Events**: React to vehicle state changes via Server-Sent Events |
| 13 | +- 🎯 **Signal Monitoring**: Track specific vehicle data fields (speed, battery, etc.) |
| 14 | +- 🔄 **Full API Coverage**: Access all Teslemetry API features |
4 | 15 |
|
5 | 16 | ## Installation |
6 | 17 |
|
7 | | -Local installation (for development): |
| 18 | +### From npm (Recommended) |
| 19 | + |
| 20 | +Navigate to your Node-RED user directory (usually `~/.node-red`) and install: |
| 21 | + |
| 22 | +```bash |
| 23 | +cd ~/.node-red |
| 24 | +npm install @teslemetry/node-red-contrib-teslemetry |
| 25 | +``` |
| 26 | + |
| 27 | +Then restart Node-RED. |
| 28 | + |
| 29 | +### From Node-RED Palette Manager |
| 30 | + |
| 31 | +1. Open Node-RED in your browser |
| 32 | +2. Go to **Menu** → **Manage palette** |
| 33 | +3. Click the **Install** tab |
| 34 | +4. Search for `@teslemetry/node-red-contrib-teslemetry` |
| 35 | +5. Click **Install** |
| 36 | + |
| 37 | +### Local Development |
8 | 38 |
|
9 | 39 | ```bash |
10 | 40 | cd ~/.node-red |
11 | 41 | npm install /path/to/packages/node-red-contrib-teslemetry |
12 | 42 | ``` |
13 | 43 |
|
| 44 | +## Prerequisites |
| 45 | + |
| 46 | +1. **Teslemetry Account**: Sign up at [teslemetry.com](https://teslemetry.com) |
| 47 | +2. **Access Token**: Generate an API access token from your Teslemetry dashboard |
| 48 | +3. **Tesla Virtual Key**: Configure virtual key access for your vehicle(s) |
| 49 | + |
| 50 | +## Configuration |
| 51 | + |
| 52 | +1. Drag a Teslemetry node onto your flow |
| 53 | +2. Double-click to edit and add a new **Teslemetry Config** |
| 54 | +3. Enter your Teslemetry access token |
| 55 | +4. Save and deploy |
| 56 | + |
14 | 57 | ## Nodes |
15 | 58 |
|
16 | 59 | ### teslemetry-config |
@@ -54,20 +97,101 @@ Listen for real-time Server-Sent Events (SSE) from Teslemetry. |
54 | 97 |
|
55 | 98 | **Configuration:** |
56 | 99 | - **VIN**: Filter events for a specific vehicle (optional). |
57 | | -- **Event Type**: The type of event to listen for (e.g., `vehicle_data`, `state`, `alerts`). |
| 100 | +- **Event Type**: The type of event to listen for. |
| 101 | + |
| 102 | +**Event Types:** |
| 103 | +- **all**: Stream all events |
| 104 | +- **data**: Real-time telemetry data updates |
| 105 | +- **state**: State changes (online/asleep/charging) |
| 106 | +- **vehicle_data**: Full vehicle data snapshots |
| 107 | +- **errors**: Vehicle error events |
| 108 | +- **alerts**: Vehicle alerts and notifications |
| 109 | +- **connectivity**: Connection status changes |
| 110 | +- **credits**: API credit usage updates |
| 111 | +- **config**: Configuration changes |
58 | 112 |
|
59 | 113 | **Outputs:** |
60 | | -- `msg.payload`: The event data object. |
61 | | -- `msg.topic`: The event type. |
| 114 | +- `msg.payload`: The event data object |
| 115 | +- `msg.topic`: The event type |
62 | 116 |
|
63 | 117 | ### teslemetry-signal |
64 | 118 | Listen for specific signal changes from a vehicle. |
65 | 119 |
|
66 | 120 | **Configuration:** |
67 | | -- **VIN**: The vehicle to monitor. |
68 | | -- **Field**: The specific signal field to listen for (e.g., `speed`, `odometer`). |
| 121 | +- **VIN**: The vehicle to monitor |
| 122 | +- **Field**: The specific signal field to listen for (e.g., `speed`, `odometer`, `battery_level`) |
69 | 123 |
|
70 | 124 | **Outputs:** |
71 | | -- `msg.payload`: The new value of the signal. |
72 | | -- `msg.topic`: `signal`. |
73 | | -- `msg.field`: The name of the field. |
| 125 | +- `msg.payload`: The new value of the signal |
| 126 | +- `msg.topic`: `signal` |
| 127 | +- `msg.field`: The name of the field |
| 128 | + |
| 129 | +## Usage Examples |
| 130 | + |
| 131 | +### Example 1: Lock Vehicle When Leaving Home |
| 132 | + |
| 133 | +1. Add a **geofence** or **location** trigger node |
| 134 | +2. Add a **function** node to set `msg.command = "lockDoors"` |
| 135 | +3. Add a **teslemetry-vehicle-command** node with your VIN configured |
| 136 | +4. Connect them together |
| 137 | + |
| 138 | +### Example 2: Start Climate Control on Schedule |
| 139 | + |
| 140 | +1. Add an **inject** node configured for your departure time |
| 141 | +2. Add a **teslemetry-vehicle-command** node |
| 142 | +3. Set Command to **Start HVAC** |
| 143 | +4. Set temperatures using **setTemps** with `msg.driver_temp` and `msg.passenger_temp` |
| 144 | + |
| 145 | +### Example 3: Monitor Charging and Send Notifications |
| 146 | + |
| 147 | +1. Add a **teslemetry-event** node |
| 148 | +2. Set Event Type to **data** |
| 149 | +3. Add a **function** node to filter charging-related updates |
| 150 | +4. Add an **email** or **pushover** node for notifications |
| 151 | +5. Send alert when charging completes |
| 152 | + |
| 153 | +### Example 4: Alert on Low Battery |
| 154 | + |
| 155 | +1. Add a **teslemetry-signal** node |
| 156 | +2. Set Field to `battery_level` |
| 157 | +3. Add a **switch** node to check if value < 20 |
| 158 | +4. Add notification node (email/SMS/Pushover) |
| 159 | + |
| 160 | +## Available Vehicle Commands |
| 161 | + |
| 162 | +- **Get Vehicle Data**: Retrieves comprehensive vehicle information |
| 163 | +- **Wake Up**: Wakes up the vehicle from sleep |
| 164 | +- **Flash Lights**: Flashes the headlights |
| 165 | +- **Honk Horn**: Honks the horn |
| 166 | +- **Lock/Unlock Doors**: Controls door locks |
| 167 | +- **Remote Start**: Enables keyless driving |
| 168 | +- **Actuate Trunk**: Opens/closes front or rear trunk |
| 169 | +- **Climate Control**: Start/stop HVAC, set temps, seat heaters, steering wheel heater |
| 170 | +- **Charging**: Start/stop, open/close port, set limit, set amps |
| 171 | +- **Sentry Mode**: Enable/disable Sentry Mode |
| 172 | +- **Homelink**: Trigger Homelink at specific coordinates |
| 173 | +- **Navigation**: Send destination to vehicle navigation |
| 174 | + |
| 175 | +## Available Energy Commands |
| 176 | + |
| 177 | +- **Get Live Status**: Live power usage details |
| 178 | +- **Get Site Info**: Configuration and site details |
| 179 | +- **Set Backup Reserve**: Set battery reserve percentage |
| 180 | +- **Set Operation Mode**: Self Consumption, Backup, or Autonomous |
| 181 | +- **Set Storm Mode**: Enable/disable Storm Mode |
| 182 | +- **Grid Import/Export**: Configure grid export rules (Everything, Solar Only, Nothing) |
| 183 | +- **Off-Grid Reserve**: Set vehicle charging reserve for off-grid operation |
| 184 | + |
| 185 | +## Resources |
| 186 | + |
| 187 | +- **Teslemetry Documentation**: https://teslemetry.com/docs |
| 188 | +- **API Reference**: https://developer.teslemetry.com |
| 189 | +- **Support**: https://github.com/Teslemetry/typescript-teslemetry/issues |
| 190 | + |
| 191 | +## License |
| 192 | + |
| 193 | +Apache-2.0 License - see [LICENSE](LICENSE) file for details |
| 194 | + |
| 195 | +## Contributing |
| 196 | + |
| 197 | +Contributions are welcome! Please see the [main repository](https://github.com/Teslemetry/typescript-teslemetry) for contribution guidelines. |
0 commit comments