[APP]PRO] Tesla - Zero emissions. Zero compromises

Zero emissions. Zero compromises

Log your vehicle data, air conditioning before driving or optimize charging…
Countless ways to make your Tesla even smarter and integrate it into your smart home.

App Image CommunityThread


Preconditions
This app is using the Tesla Fleet-API. This API has a pricing based on usage. You get 10$ free for every month and if you need more data usage, you can add a payment to cover your costs.
To use this API, you need a Tesla developer account.

You can find instructions on my Blog or a short version in the car’s pair view.


How to start?

This app offers several devices you can add.
Start with the car device. This connects to your car and allows some central functions to be controlled.
Then add devices for special purposes you want to control like battery/charging, climate or location.

Every device has its own set of sensors, controls and flows.

First add a car device. The pair view gives you some instructions how to create a Tesla deleoper account and it will request the client_id and client_secret from your Tesla app.

Then you have to authenticate with your tesla account. Set set the scopes, the app should be able to use (select all as default).

After adding the car to Homey, continue the pair view and register the app in your car (if you want to send commands).
Klick the button to start the app registration.
The link opens in Tesla app. If it’s opened in the browser, please scroll up and open it in the app.



Additional infomation

On my website you can find additional information. Additional information will be added as Blog posts.

grafik

https://rwdevelopment.de

I will provide basic information about the app and the api (technology and security).
And in the blog I plan to show use cases and examples.
There you can register for a newsletter to get updated when a new blog post is published.
And you can ask for further blog posts about examples, HowTo’s and technical insights


:warning: Current Limitations

  • The command logic changed for the new personal API usage.
    Not all commands are working.
    Details: check next post

What API is used?

This app uses the Tesla Fleet API.

Details...

You authenticate with your Tesla account (oAuth) and allow the app to connect to your car.
In addition you have to register the app in your car (like a key card) to allow the app to send commands.

Vehicle data is determined using interval retrievals. These request won’t wake up the car. But if the car is asleep or offline, the app won’t get updated data.

To control you car, commands are sent. There are two variants:

  • Fleet API: The app sends simple https requests to the Fleet-API. Pre 2021 S/X models have to use this option
  • Tesla Vehicle Command Protocol: The app sends encrypted and signed commands to your car. If the app is registered in your car as key, these commands are allowed and processed. This allows an end-to-end encryption and security policies. You can remove app command access in car security settings or remove the app completely in your Tesla account.

Dependent on your role (owner/driver) your car access could be restricted and it’s not allowed to register the app in your car. This can happen if the leasing company is the car owner. Please contact the leasing company and/or Tesla in this case.


Contributions:
The thanks go to…

  • Bjørnar Almli for the Tesla smart charger app
  • My beta testers who help find bugs and bring in good ideas
  • Emanuele Iannone who built a good CommandAPI interface I could use

Help getting this app even better!

btn_donate_LG1
paypal-logo-png-transparent
Please use “send to friends” to avoid fees.
This helps me to finance the necessary server that’s needed to provide the apps public key and the proxy server that is used for the command API.
Thanks.

10 Likes

Current status of commands:

Car:

  • vehicleControlSetSentryModeAction :white_check_mark:
  • vehicleControlFlashLightsAction :white_check_mark:
  • vehicleControlHonkHornAction :warning:
    Not tested, please report if it’s working or not
  • door lock/unlock :no_entry_sign:
    currently not possible with commandAPI
  • vehicleControlWindowAction :white_check_mark: (2.0.3)
  • vehicleControlScheduleSoftwareUpdateAction :white_check_mark:

Battery:

  • commandChargeLimit :white_check_mark:
  • chargePortDoorOpen, chargePortDoorClose :white_check_mark:
  • chargingStartStopAction, chargingStartStopAction :white_check_mark: (2.0.2)
  • setChargingAmpsAction :white_check_mark: (2.0.2)
  • scheduledChargingAction: :white_check_mark: (2.2.0) :new:
  • scheduledDepartureAction :white_check_mark: (2.2.0) :new:

Location:

  • API commandNavigateGpsRequest :white_check_mark: (via REST)
    No signed commands yet

Climate:

  • hvacTemperatureAdjustmentAction :white_check_mark: (2.0.3)
  • hvacClimateKeeperAction: :white_check_mark: (2.2.0) :new:
  • setCabinOverheatProtectionAction :white_check_mark:
  • setCopTempAction :white_check_mark:
  • hvacAutoAction (preconditioning): :white_check_mark: (2.0.3)
  • hvacSetPreconditioningMaxAction :white_check_mark:
  • hvacSteeringWheelHeaterAction :white_check_mark: (2.2.0) :new:
    :warning: No auto/level, only on/off possible!
  • autoSeatClimateAction :white_check_mark: (2.2.0) :new:
  • hvacSeatHeaterActions :white_check_mark: (2.2.0) :new:

Media:

  • next/prev track :white_check_mark: (2.2.0) :new:
  • next/prev favorite :white_check_mark: (2.2.0) :new:
  • play/pause :white_check_mark: (2.2.0) :new:
  • volume :white_check_mark: (2.2.0) :new:

Reserved 02

Reserved 03

Hi @RonnyW, thanks for building a brand new Tesla app.
Is there a way to make a “and” card for sentry mode and child lock?

There are not flow conditions added for “simple” values. Best would be to use logic cards and the global tokens. FLow conditiosn are added for complex checks (location) or value lists.

The Sentry mode is available for car device. Child lock is not added yet as capability.

Hi @RonnyW . This new app appears innovative, thanks. I’ve added the car device and battery/charging. I don’t see options like smart charging in the old app. Does it exist, or are there plans to implement this functionality?

There are no price dependet charge plans. The app only represents the car.
You can/should use flows to start/stop charging based on other triggers/apps (Tibber etc.).

Is ther a way to thank you whitout paypal?

1 Like

Thanks for creating this new app, after a brief check, it looks like it will work brilliantly for me!

One possible issue, added both the car and the batter and then started charging the car via the Tesla app. All the information regarding charging speed, voltage, amps and so on is show correctly but it seems like the power usage is not being included properly, it is not showing up for the device or the zone.

You are right. The app doesn’t use the standard capability.
I’ll check possibilities, e.g. device settings to add it individually.

I could share an IBAN via PM.

1 Like

An additional question: How are you using the energy consumption now?

I use the wallbox usage charging and the smart meter for the house itself (and PV).
If you are charging outside, Homey would still count your usage as it would be in your house.

Hi Ronny, I tried to create a device with the Tesla app, but I get an error 403 Forbidden when trying to connect. I had it connected at first, but then I realized I did not want to give it full access, so I removed the device and deinstalled the app, and then re-installed and trying to do it the correct way, but now I cannot add the car anymore

I have a meter for the entire house (Tibber Norway) and a bunch of smart devices, each individually measuring the power usage. My charging device is a Tesla charger v2 which does not allow for any kind of monitoring so the the charging power gets categorized into the generic “Other” bucket.

So maybe the solution would be to have an option for using the values from the Tesla charging device as a smart meter?

Guess you misunderstood me question. Would you make an en card for sentry mode and child lock?

You can use the logic card for that
Bildschirmfoto vom 2024-01-16 17-08-42

@RonnyW I can see the miscommunication already. Sentry Mode has been translated into Dutch which is not the intention. Sentry Mode is an international feature that’s why I couldn’t find it. I will do a PR. See Correct translation Sentry mode in Dutch by LRvdLinden · Pull Request #1 · RonnyWinkler/homey.tesla · GitHub

Hello and thank you for this application, I have a quick question, if I create a driver account for the application, does it work? I would like to keep my proprietary rights. Sorry for my broken English.

I’m not sure what happened in your case. The error (from diagnostics log) is raised during oAuth/authority check. Perhaps it’s buffered in browser popup.
The Tesla login popup remembers your session in the browser cache. I assume the login popup is not shown a second time (just closes). Perhaps clearing the browser cache helps.

To remove the rights, you have to remove the Homey app in your Tesla accont (Tesla website, not the app). If it’s removed, start device pairing again. You don’t need to delete the device or app. The login popup should appear again.

If you want to use the app to send commands to your car ( start/stop charging etc.) you will need all scopes. If you only want to read some data, some read-only scopes are ok.