Skip to content
Closed
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
15 changes: 13 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ typescript-teslemetry/
│ ├── api/ # Core TypeScript/JavaScript SDK
│ ├── node-red-contrib-teslemetry/ # Node-RED integration
│ ├── n8n-nodes-teslemetry/ # n8n workflow integration
│ └── homebridge-teslemetry/ # Homebridge plugin (published to npm)
│ ├── homebridge-teslemetry/ # Homebridge plugin for Teslemetry (published to npm)
│ └── homebridge-tessie/ # Homebridge plugin for Tessie (published to npm)
├── pnpm-workspace.yaml # Workspace configuration
├── tsconfig.json # Root TypeScript config
├── package.json # Monorepo root package
Expand All @@ -26,7 +27,7 @@ See each package's own `package.json`/`README.md` for its purpose, structure, an

The ioBroker adapter (`iobroker.teslemetry`) lives in its own repo, [Teslemetry/ioBroker.teslemetry](https://github.com/Teslemetry/ioBroker.teslemetry) - not in this monorepo.

All integration packages (`node-red`, `n8n`, `homebridge-teslemetry`) depend on `@teslemetry/api` via `"@teslemetry/api": "workspace:*"`, so they always build against the local SDK during development.
`node-red`, `n8n`, and `homebridge-teslemetry` depend on `@teslemetry/api` via `"@teslemetry/api": "workspace:*"`, so they always build against the local SDK during development. `homebridge-tessie` is the exception: it talks to the Tessie service (a different backend from Teslemetry) via the standalone `tesla-fleet-api` npm package directly, not `@teslemetry/api` - don't wire it onto the shared SDK.

## Packages

Expand Down Expand Up @@ -155,6 +156,16 @@ pnpm link --global n8n-nodes-teslemetry

**Gotcha**: `WallConnectorService`'s `connectors` map is otherwise only populated by `live_status`, so per-DIN sensors that already exist in Homebridge's persisted accessory cache from a prior run are invisible to `setStreamFault()` until this run's first `live_status` - its constructor hydrates `connectors` from any matching cached `ContactSensor` services up front (parsed off their `wall-connector-{fault,connected}-<din>` subtype) and immediately applies `TeslemetryPlatform.streamFault` (a public getter over the platform's private terminal-fault flag), so a fault already raised before this accessory was constructed still reaches them. Any other lazily-hydrated per-entity service map should follow the same hydrate-from-cache-at-construction pattern rather than assuming the live stream is the only source of a map's keys.

### 5. `homebridge-tessie` - Homebridge Plugin for Tessie

**Location**: `packages/homebridge-tessie/`

**Purpose**: Exposes vehicles and energy sites as HomeKit accessories for users of the [Tessie](https://tessie.com) service, structurally parallel to `homebridge-teslemetry` (service classes under `src/vehicle-services/*`/`src/energy-services/*`) but talking to Tessie's API surface via `tesla-fleet-api`'s `Tessie` client instead of `@teslemetry/api`.

**Publishing note**: migrated from a standalone hand-published repo; ships to npm as `homebridge-tessie`, superseding that legacy package via a same-name hard cut (no dual-maintain, no rename), same as `homebridge-teslemetry`'s cutover. CI publish requires npm trusted publishing to be registered for this package name on npmjs.com (only an npm org owner can do that) before the changesets flow can publish it.

**No shared code with `homebridge-teslemetry`** beyond following the same file layout by convention - the two plugins target different backend APIs (Tessie vs. Teslemetry) with different client libraries, so service classes are not deduplicated between them despite the structural similarity.

## Technology Stack

- **pnpm** (workspaces) - package management; version pinned via `packageManager` in root `package.json`
Expand Down
176 changes: 176 additions & 0 deletions packages/homebridge-tessie/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS
28 changes: 28 additions & 0 deletions packages/homebridge-tessie/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Tessie for Homebridge

Connect Homekit with all your Tesla vehicles using Tessie

## Installation

If you're running a Homebridge UI like [`homebridge-ui-config-x`](https://github.com/oznu/homebridge-config-ui-x) then you can use it to install `homebridge-tessie` and configure it there. All configuration options should be supported.

## Manual Installation

```sh
npm install --global homebridge-tessie
```

Example config.json:

```json
{
"platforms": [
{
"platform": "Tessie",
"name": "My Tessie",
"accessToken": "YOUR_TESSIE_TOKEN",
"prefixName": true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove the trailing comma from the example config

The documented manual configuration is invalid JSON because its final property has a trailing comma. Users who copy this example into config.json will get a parse failure instead of a working Homebridge configuration.

Useful? React with 👍 / 👎.

}
]
}
```
57 changes: 57 additions & 0 deletions packages/homebridge-tessie/config.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"pluginAlias": "Tessie",
"pluginType": "platform",
"singular": false,
"headerDisplay": "Requires an active subscription to Tessie. Please login and create an access token at https://my.tessie.com/settings/api",
"schema": {
"type": "object",
"properties": {
"name": {
"title": "Name",
"description": "A unique name for the platform",
"type": "string",
"required": true,
"default": "Tessie"
},
"accessToken": {
"title": "Access Token",
"type": "string",
"required": true
},
"prefixName": {
"title": "Prefix Name",
"description": "Prefix the name of each service with the name of the vehicle",
"type": "boolean",
"default": true
},
"latitude": {
"title": "Latitude",
"type": "string",
"default": "",
"description": "Latitude of your Homelink device. Required to use Homelink."
},
"longitude": {
"title": "Longitude",
"type": "string",
"default": "",
"description": "Longitude of your Homelink device. Required to use Homelink."
},
"ignore_vin": {
"title": "Ignore Vehicles",
"type": "array",
"items": {
"title": "VIN",
"type": "string"
}
},
"ignore_site": {
"title": "Ignore Energy Site",
"type": "array",
"items": {
"title": "Site ID",
"type": "number"
}
}
}
}
}
56 changes: 56 additions & 0 deletions packages/homebridge-tessie/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "homebridge-tessie",
"displayName": "Tessie",
"version": "0.4.4",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add a changeset for the migrated package

Because this same-name migration retains the already-published 0.4.4 version and adds no changeset naming homebridge-tessie, the changesets action has no pending version bump for the package and will skip publishing the repository build. Add a patch changeset so the Version Packages PR advances the package beyond the legacy release.

AGENTS.md reference: AGENTS.md:L198-L198

Useful? React with 👍 / 👎.

"description": "Connect Homebridge to your Tessie account.",
"author": "Teslemetry",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/Teslemetry/typescript-teslemetry.git",
"directory": "packages/homebridge-tessie"
},
"bugs": {
"url": "https://github.com/Teslemetry/typescript-teslemetry/issues"
},
"main": "dist/index.cjs",
"type": "module",
"engines": {
"node": ">=18.0.0",
"homebridge": "^1.6.0 || ^2.0.0-beta.0"
},
"scripts": {
"build": "tsdown --format cjs",
"watch": "tsdown --format cjs --watch",
"tsc": "tsc --noEmit",
"test": "tsx --test test/*.test.ts",
"prepublishOnly": "pnpm build"
},
"keywords": [
"homebridge-plugin",
"tesla",
"tessie"
],
"dependencies": {
"tesla-fleet-api": "^0.3.0"
},
"devDependencies": {
"hap-nodejs": "^0.14.0",
"homebridge": "^1.8.0",
"tsdown": "^0.22.4",
"tsx": "^4.20.6",
"typescript": "^7.0.2"
},
"peerDependencies": {
"homebridge": "^1.6.0 || ^2.0.0-beta.0"
},
"files": [
"dist",
"config.schema.json",
"LICENSE"
],
"publishConfig": {
"access": "public",
"provenance": true
}
}
20 changes: 20 additions & 0 deletions packages/homebridge-tessie/src/energy-services/autonomous.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { EnergyAccessory } from "../energy.js";
import { BaseService } from "./base.js";

export class Autonomous extends BaseService {
constructor(parent: EnergyAccessory) {
super(parent, parent.platform.Service.Switch, "Autonomous Mode", "autonomous");

const on = this.service
.getCharacteristic(this.parent.platform.Characteristic.On)
.onSet(async (value) => {
await this.energy.operation(value ? "autonomous" : "self_consumption")
.then(() => on.updateValue(value))
.catch((e) => this.log.error(`${this.name} energy operation failed: ${e}`));
});

this.parent.emitter.on("site_info", (data) => {
on.updateValue(data.default_real_mode === "autonomous");
});
}
}
Loading
Loading