Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/n8n-cloud-safe-nodes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@teslemetry/n8n-nodes-teslemetry": minor
---

Rebuild the nodes on n8n's own HTTP helper so the package passes n8n's verification scanner. The package no longer bundles `@teslemetry/api`.

- **Teslemetry Vehicle** and **Teslemetry Energy** now group their operations by resource. Operation values are unchanged, so saved workflows keep running; the editor may ask you to pick the resource again for an operation outside the default resource.
- **Teslemetry Trigger** is now a polling trigger. Vehicle events read the cached telemetry (no credits, never wakes the car); energy events read `live_status`/`site_info`. A VIN or site is now required, and the stream-only events Credits, Config and Energy Totals are gone.
6 changes: 4 additions & 2 deletions .claude/skills/add-command-to-integrations/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ Only **commands** (writes) need this. A new telemetry field needs no code: the N
- Add a case to `test/teslemetry-vehicle-command.test.ts` (or `teslemetry-energy-command.test.ts`).

3. **n8n** (`packages/n8n-nodes-teslemetry`):
- In `src/nodes/TeslemetryVehicle.node.ts` (energy: `TeslemetryEnergy.node.ts`), add an `options` entry (`name`, `value`, `action`) to the operation list.
- The package does not use `@teslemetry/api` (n8n's verification forbids it); it calls the endpoint itself through `teslemetryRequest()` in `nodes/shared.ts`. Copy the path and body from the SDK method.
- In `nodes/TeslemetryVehicle/TeslemetryVehicle.node.ts` (energy: `nodes/TeslemetryEnergy/TeslemetryEnergy.node.ts`), add an `options` entry (`name`, `value`, `action`) to the operation list of the matching resource, keeping it alphabetical.
- Add one property per argument, shown only for that operation with `displayOptions: { show: { operation: ['<method>'] } }`.
- Add a `case '<method>':` to the `execute` switch. Read arguments with `this.getNodeParameter('<name>', itemIndex)`.
- Add an `OPERATIONS` entry that builds the request (`command('<endpoint>', (param) => ({ ... }))` for `command/<endpoint>`). Read arguments with `param('<name>')`.
- Run `pnpm --filter @teslemetry/n8n-nodes-teslemetry validate` (n8n's lint).
- Add the operation to `README.md`.
- Add a row (operation, params, expected path and body) to the table in `test/vehicleExecute.test.ts` (or `energyExecute.test.ts`).

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: pnpm test

- name: Verify the n8n package loads from its packed tarball
# The tests import the node classes from src/. n8n instead reads only
# The tests import the node classes from nodes/. n8n instead reads only
# the files the manifest lists and takes each class name from its file
# name, so this packs the tarball and loads it with n8n's own
# PackageDirectoryLoader, failing unless 3 nodes and 1 credential load.
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Teslemetry TypeScript Monorepo

pnpm workspaces + changesets. `packages/api` is the `@teslemetry/api` SDK; the other packages depend on it via `workspace:*`. The ioBroker adapter lives in its own repo, [Teslemetry/ioBroker.teslemetry](https://github.com/Teslemetry/ioBroker.teslemetry).
pnpm workspaces + changesets. `packages/api` is the `@teslemetry/api` SDK; the other packages except `n8n-nodes-teslemetry` depend on it via `workspace:*`. The ioBroker adapter lives in its own repo, [Teslemetry/ioBroker.teslemetry](https://github.com/Teslemetry/ioBroker.teslemetry).

## Development

Expand Down
46 changes: 24 additions & 22 deletions packages/n8n-nodes-teslemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ n8n community nodes for controlling Tesla vehicles and energy sites via the [Tes

- 🚗 **Vehicle Control**: Lock/unlock, climate, charging, navigation, and more
- ⚡ **Energy Management**: Monitor and control Powerwall and Solar systems
- 📡 **Real-Time Events**: Trigger workflows based on vehicle state changes
- 🔄 **Full API Coverage**: Access all Teslemetry API features
- 📡 **Change Events**: Trigger workflows when vehicle telemetry or energy site status changes

## Installation

Expand Down Expand Up @@ -51,7 +50,7 @@ Then restart your n8n instance.
## Nodes

### Teslemetry Vehicle
Perform operations on your Tesla vehicles.
Perform operations on your Tesla vehicles. Operations are grouped by resource: **Vehicle**, **Doors and Closure**, **Climate** and **Charging**.

**Operations:**
- **Get Vehicle Data**: Retrieves comprehensive data.
Expand All @@ -68,7 +67,7 @@ Perform operations on your Tesla vehicles.
- **Navigation Request**: Send a destination to the vehicle navigation.

### Teslemetry Energy
Interact with Tesla Energy sites (Solar/Powerwall).
Interact with Tesla Energy sites (Solar/Powerwall). Operations are grouped by resource: **Status** and **Setting**.

**Operations:**
- **Get Live Status**: Live power usage details.
Expand All @@ -81,19 +80,22 @@ Interact with Tesla Energy sites (Solar/Powerwall).
- **Off-Grid Reserve**: Set vehicle charging reserve for off-grid operation.

### Teslemetry Trigger
Trigger workflows based on real-time vehicle events via Server-Sent Events (SSE).

**Event Types:**
- **All Events**: Stream all events
- **Data**: Real-time telemetry data updates
- **State**: State changes (online/asleep/charging)
- **Vehicle Data**: Full vehicle data snapshots
- **Errors**: Vehicle error events
- **Alerts**: Vehicle alerts and notifications
- **Connectivity**: Connection status changes
- **Credits**: API credit usage updates
- **Config**: Configuration changes
- **Signal**: Monitor specific fields (e.g., `speed`, `odometer`, `battery_level`)
A polling trigger: it checks Teslemetry on the node's **Poll Times** schedule (every minute by default) and starts the workflow once for each value that changed since the previous check. The first check after you activate the workflow only records the current values. A manual test run returns the current values.

**Vehicle events** read the vehicle's cached telemetry (`GET /api/1/vehicles/{vin}/telemetry`). This read never wakes the vehicle, never calls Tesla, and costs no credits, so a short poll interval is free. The vehicle must stream the fields you watch (add them in the Teslemetry console).
- **Any Change**: Any change to the topics below
- **Data**: Any telemetry field changed (the item lists only the changed fields)
- **Signal**: One telemetry field changed (choose the field)
- **State**: The vehicle went online, asleep or offline
- **Connectivity**: A network interface connected or disconnected
- **Alerts**, **Errors**, **Vehicle Data**: The topic's cached value changed

**Energy site events** read the site's `live_status` or `site_info`. Teslemetry serves both from its own cache, which it refreshes about every 30 seconds (live status) and every 5 minutes (site info), so polling faster than that returns the same values. Credits are charged only when Teslemetry fetches fresh data from Tesla, not for cache reads.
- **Live Status**: Power flows, battery level and grid status
- **Site Info**: Settings such as backup reserve and operation mode
- **Tariff Content**: The site tariff changed, or was removed (`tariff_content_v2: null`)

Earlier versions streamed events over Server-Sent Events (SSE). n8n Cloud does not allow the long-lived reconnecting connection a stream needs, so the trigger now polls. The stream-only events **Credits**, **Config** and **Energy Totals**, and the "all vehicles"/"all sites" choice, are no longer available.

## Usage Examples

Expand All @@ -114,16 +116,16 @@ Trigger workflows based on real-time vehicle events via Server-Sent Events (SSE)
### Example 3: Monitor Charging Status

1. Add a **Teslemetry Trigger** node
2. Set event type to **Data**
3. Filter for charging-related updates
4. Send notifications when charging completes
2. Set event type to **Signal** and the field to `DetailedChargeState`
3. Add an **IF** node that checks `{{ $json.value }}` is `DetailedChargeStateComplete`
4. Send a notification when charging completes

### Example 4: Alert on Low Battery

1. Add a **Teslemetry Trigger** node
2. Set event type to **Signal**
3. Select signal: `battery_level`
4. Add an **IF** node to check if battery < 20%
3. Select the field `BatteryLevel`
4. Add an **IF** node to check if `{{ $json.value }}` < 20
5. Send notification via email/SMS

## Resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
Icon,
INodeProperties,
} from 'n8n-workflow';

export class TeslemetryApi implements ICredentialType {
name = 'teslemetryApi';
displayName = 'Teslemetry API';
documentationUrl = 'https://teslemetry.com/docs';
icon: Icon = 'file:teslemetry.svg';
properties: INodeProperties[] = [
{
displayName: 'Access Token',
Expand Down
3 changes: 3 additions & 0 deletions packages/n8n-nodes-teslemetry/credentials/teslemetry.svg

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading