External integration - Teslemetry (Tesla cars and Powerwall)

Hi everyone! :waving_hand:

We continue the North American series :united_states: with something big: Tesla, for cars and Powerwalls. It perfectly fits Gladys’ energy focus :high_voltage:

It goes through Teslemetry: the official Tesla Fleet API requires each user to declare a developer application and host a key on their own domain, which is to say, no one. Teslemetry takes care of all that for a simple token. It’s a paid subscription with them, I prefer to say it right away.

What it does

For each car :

  • :battery: battery, range (km or miles depending on your profile), charging status and power, plug connected or not;
  • :thermometer: interior and exterior temperatures, mileage, car awake or asleep;
  • :control_knobs: from Gladys: start or stop charging, set the charging limit and intensity, the climate control and its temperature, lock, activate Sentry Mode.

For the Powerwall and solar : production, home consumption, grid (drawing / injection), battery charge and discharge, grid presence, adjustable operating mode, and energy tracking in kWh.

Two widgets : « Tesla Vehicle » and « Energy Flow ».

The cool thing

Car plugged in and solar surplus → start charging :sun::automobile:
Power outage → notification, and cut off the big consumers :electric_plug:
Charge completed → « Your Tesla is ready » on the phone :white_check_mark:

And I promise: fetching data never wakes up the car. It is only woken up for a command you have requested, so no battery drained secretly :wink:

Installation

:warning: Gladys 5.1 minimum.

  1. Create an account on teslemetry.com, link your Tesla and generate an access token.
  2. In Gladys: Integrations → Tesla → Install, paste the token, then the Discovery tab to add the car and the energy site.

Small honest reservations: no GPS position (on purpose), nor trunk, windows or heated seats for now, and the energy indexes start from zero on installation.

:warning: Developed without the hardware : I don’t have a Tesla or a Powerwall. Tests are based on the test data of the Home Assistant integration and the official documentation, but nothing replaces a real test.

Like the previous ones, it is developed with Claude Code :robot:. Independent project, not affiliated with Tesla or Teslemetry.

Repository: GitHub - guim31/gladys-tesla: Tesla vehicles and Powerwall energy sites (via Teslemetry) for Gladys Assistant · GitHub

Do you have a Tesla or a Powerwall? I count on you for the first feedback :folded_hands: @mutmut, I saw that you have a Powerwall gen3: if you feel like testing the energy part, I’m interested :wink:

:weary_face: I got my wires crossed, it’s a Wall Connector gen3 that I have, I don’t know what I was thinking when I wrote that, maybe I want one :joy:
So I won’t be able to test it, sorry.
But if you add the chargers, I’d be happy to help!

Small remark with Teslametry, isn’t it possible to go through GladysPlus instead?

No problem @mutmut :grinning_face_with_smiling_eyes:

The Wall Connector: good news: the gen3 has a small local API, without an account or cloud. I’ll add it to the Tesla integration, and it will even work without a Teslemetry subscription: charging power, vehicle connected or charging, total energy. So you’ll be the ideal tester :wink: I’ll let you know as soon as it’s ready.

Gladys Plus instead of Teslemetry: not for now. To go through Tesla’s official API, you need a developer application registered with Tesla, a domain name that hosts a key, and the signing of commands. Gladys Plus could play this role if a Tesla application was registered for the entire Gladys community, like Teslemetry does. That’s a project on the Gladys Plus side, so a question for @pierre-gilles :slightly_smiling_face:

@mutmut, it’s ready :tada: The 1.1.0 Tesla integration reads your Wall Connector gen3 directly on your local network, without Teslemetry or subscription.

To install it

  1. Set the IP address of your charger in your box (so it doesn’t change).
  2. In Gladys: Integrations → Tesla → Configuration, enter the IP address of the charger (the Teslemetry token is now optional), then click on Test Wall Connectors.
  3. Discovery tab: add your charger.

What you get

  • :electric_plug: the status of the connector and charging (available, vehicle connected, charging…) and a clear status;
  • :high_voltage: charging power, session energy, voltage, current, and handle temperature;
  • :bar_chart: total energy delivered, connected to Gladys’ energy tracking, like a sub-meter of your main meter;
  • :puzzle_piece: a « Tesla Charger » widget;
  • :clapper_board: four scene triggers all to itself: vehicle connected, disconnected, charging started, charging finished (with session energy).

Small honest reservations: the charger is read-only (its local API does not allow controlling the charging), and in the consumption widget, do not check both your main meter and the charger at the same time if you want an accurate total, otherwise the recharge counts twice.

:warning: Developed without the hardware: your feedback will be precious to me, especially the displayed power compared to that of the Tesla app, and what happens during a real connection and a real end of charge. The update will be proposed to you as soon as the store has seen it, within the day. Thanks in advance :folded_hands:

Top @guim31, thanks!
I only see 1.0.1 in Gladys, so I’ll be back as soon as I’ve been able to test.

I had a thought regarding Telasmetry. I think a lot of people also use Tessie or other third-party applications.
@Terdious was on it: Intégration Tessie API (contrôle Tesla via Tessie)
In my opinion, in a future dev, it will be necessary to provide the possibility to choose your provider.

Personally, I also have a Tesla but I only control it via the official app.
However, I use Teslamate (free and open source) for everything related to tracking, that would also be a future dev to implement, I don’t know, knowing that you can also retrieve the data via MQTT.

EDIT: forcing the update works well :joy: 1.1.0 installed, I’m testing everything I can!

What about this idea: wouldn’t it be possible to have auto-discovery?

There’s an API in the external integrations to request a Gladys Plus webhook, so no need for me :grin:

Users just need to create their application on the Teslemetry side to get their API keys and specify their webhook.

However, in terms of naming, it would be better to call this integration « Teslemetry » rather than Tesla, because there are other services!

Thanks to both of you for the feedback :folded_hands:

@pierre-gilles well spotted on the name, I’m cleaning up:

  • the current integration will be called Teslemetry (Tesla cars and Powerwall via Teslemetry);
  • the Wall Connector charger goes into its own integration, Tesla Wall Connector, 100% local, no account or subscription. It makes more sense, a local charger has nothing to do under the name of a cloud service. That’s how Home Assistant does it, by the way.

For the Gladys Plus webhook, thanks for the info, I’ll look into it. The issue with Tesla’s official API is that it requires a public key hosted on the application’s domain, plus pairing a « virtual key » in each car. I’ll see if we can work around that.

@mutmut:

  • Automatic discovery will come with the new Tesla Wall Connector integration. The charger doesn’t announce itself on the network, so the integration will look for it on your local network itself, with a « Search for chargers » button.
  • Migration: you can keep your charger in 1.1.0 for now. As soon as Tesla Wall Connector is online, I’ll let you know: you’ll just need to install it and remove the charger from the old integration.
  • Tessie and TeslaMate: very good ideas. These would be separate integrations, each with its own name, as suggested by @pierre-gilles. I’ll note them for later :wink:

@mutmut it’s online :tada: The charger has its own integration: Intégration externe - Tesla Wall Connector

While waiting for the store to add it, you can install it right away via Integrations → Install from GitHub, using GitHub - guim31/gladys-tesla-wall-connector: Tesla Wall Connector gen 3, read locally without any account, for Gladys Assistant · GitHub

To migrate your charger:

  1. install Tesla Wall Connector, then click on Search for chargers (or enter its IP address) and add it from the Discovery tab;
  2. in this integration, now called Teslemetry (1.2.0), the charger is no longer managed: you can remove the old charger device.

A little honest clarification: for Gladys, it’s a new device, the history from 1.1.0 doesn’t carry over. Since you only had it for a few hours, it should be fine :wink:

Let me know how the automatic search, the power compared to the Tesla app, and a real connection go. Thanks again :folded_hands: