Basic Tesla Integration

I love your work Trent! But living in Norway, I try to change fahrenheit to Celcius, without luck… Can you point me in the right direction where I should make changes in the code?

Trent, I wanted to let you know that your changes for the polling are working great for me. I’ve been running it since you made the change and the car is going to sleep like normal. I haven’t had time to write up my webcore process to start the heating at a specific time, but plan to soon and will let you know how it works. My plan is to send a wake up command and then 3 minutes later send the heating command. That should give the car enough time to wake up. Out of curiosity, how long does it take for your M3 to wake up? Mine seems to be anywhere from 30 seconds to 3 minutes.

Hi Trent and many thanks for the hard work!Mine upon using the device handler and smart app was sleeping but recently this has stopped. Any ideas why this may be? Also, can you share the code with the temperature set as celsius at all?



at first after connecting my M3, it would stay awake. removed it from smartthings and trying it again and it is working as expected. My M3 goes to sleep when it should.

Update: if its charging it will go to sleep if its not plugged in it will stay awake.

Did this stop working for anyone else the other day?

Its not updating status anymore, when I try and connect again it doesn’t find any cars to connect to.

1 Like

Yes — not able to find my car during the authentication process any more. :frowning:

I fixed it by totally removing it, and readding it. Give it a try.

I recently installed the app to pull data in from my Model S and it appears to be working great. TY! My question, which I cant seem to find an example of is related to presence. I can see the Lat and Long being reported, but don’t see a way to build a straight forward Presence Piston to trigger off of or set Presence.

Looking to achieve a simple: When Tesla arrives, open Garage door 2, wait 5 minutes, close door.

I have a 3 car garage, my car is tied to my phone presence and door 3, this is can only go in bay 2 and bay 1 is used for the SUV that can’t self report. Don’t want to tie it to the wife’s phone as she bounce between the SUV and Tesla.

@trentfoley Hey ! thanks for your job. It looks great. I just tried it but cannot see my M3 :frowning: what do I miss ? thanks

Hey Trent. Fantastic work on this. Thank you very much for sharing it. I’m working on integrating Tesla control with the work you also did for Griddy integration. Specifically, I’d like to automate starting a charge cycle when the price / kWh drops below a given threshold or to stop charging in the event of a price spike. I’m thinking that this should be feasible in SmartThings using the device handlers that you’ve created for each, but I’m new to the platform and am not sure how to hook those up entirely.

Given that you have both a Tesla and Griddy service, I’m guessing this is something you’ve been working on as well. Have you had any luck fully automating it?

Hey @trentfoley - Installed the app and it’s awesome. Just wanted to say thanks.

Just wanted to circle back and provide some feedback.

I’m using ActionTiles and wanted to add a Tile displaying the Tesla Battery % and Drive Range (batteryRange). I was not able to add the batteryRange with the current coding as the Attribute for batteryRange was not associated to a Capability.

I’m new to ST and coding, so there may be another way to achieve this but what I ended up doing was adding the Voltage Measurement Capability, then updating the DTH and SmartApp to have the drive_range value feed into the voltage attribute.

With this in place the Voltage Measurement is an option in AT and within it are the two attributes of Battery and Voltage (Drive Range). Works perfectly!

If anyone is interested…

In the DTH:

  1. add a new line for capability “Voltage Measurement”
  2. comment out existing attribute line for batteryRange
  3. Change line 92 as follows

state(“voltage”, label:’${currentValue} mi range’, unit:"-")

  1. update line 145 - change “batteryRange” to “voltage”
  2. Change line 174 as follows

sendEvent(name: “voltage”, value: data.chargeState.voltage)

In SmartApp

  1. Update line 272 as follows

voltage: chargeState.battery_range,

  1. End of steps

Note: in AT the reading shows as valueV (ex. 127.45V – the “V” is the default ENUM for the value of the voltage attribute). I haven’t figured out how to drop it in AT but with the unit:"-" specified in the above line it’s dropped in the ST App. I just updated the AT Tile Header to says “Miles of Range”.

Hope this is helpful.

1 Like

Hi Ryan

Just wondering how you were doing on automating PowerWall2 charging based on Griddy prices?

I’d be interested in seeing how this goes since in the UK we have a similar tariff from a company called Octopus - they have half-hourly pricing which of course does not work too well on the PW2

Working great :slight_smile: Any option to change the temp to °C and KM vs °F and Miles?


I am trying to create a Core Piston that sends me a notification it it’s 8PM, the car is Present but the Battery is in the state “Unplugged”. However, when I go to Core, I cannot find a capability that lists the battery state. Is there anyone doing the same thing?

Help Trent, your awesome device handler stopped working after their last update :frowning:
I relied on it so heavily for charging reminders etc… Any chance you can dig into why it stopped updating? I love your work. Thanks for everything.

its working again, just had to remove the device and re-add through the smartapps. works like charm.
I wonder if the 45 day access token has anything to do with it.

thought I would share my piston as contribution.
thanks again Trent, its my favorite smartthings device.


Hi Trent and Jeremy, thanks for the SmartApp, DH, and sample piston. I was curious to know if you were able to find away the 45 day access token expiration. I noticed that I have the same problem as well and had to re-add through every 45 days. I just started getting into HA and any guidance would be appreciated. Thanks!

Not sure if this with your particular situation, but the first piston in this post maintains a current token.