Tesla Integration to Query Status and Send Commands to Your Car

In my model 3 there is dual climate for driver and passenger. If I tap on the temp along the bottom of the screen a slider pops up. Just to the right of the slider there is a sync button. If that is toggled it adds two temp controls along the bottom status bar, allowing for dual climate control. Interesting it can be set with Hubitat, because I don't think you can control them separately from the app

1 Like

I have not seen the ability to set dual temperatures on the app, just in the car when the sync button is not selected.

Thank you for the updated driver and app.

Update: I just updated both these and it works flawlessly. Thanks again!

1 Like

Trying to get the token sorted, I've gone through all the steps for the python script above but get this back as a response - I'm on Windows10 for reference.

Traceback (most recent call last):
File "C:\tesla-oauth2-main\tesla.py", line 268, in
login(args)
File "C:\tesla-oauth2-main\tesla.py", line 225, in login
code = parse_qs(resp.headers["location"])["https://auth.tesla.com/void/callback?code"]
File "C:\Python310\lib\site-packages\requests\structures.py", line 54, in getitem
return self._store[key.lower()][1]
KeyError: 'location'

I try to repeat the steps again and now get this error (which I was getting before)
Traceback (most recent call last):
File "C:\tesla-oauth2-main\tesla.py", line 268, in
login(args)
File "C:\tesla-oauth2-main\tesla.py", line 127, in login
raise ValueError(f"Didn't post auth form in {MAX_ATTEMPTS} attempts.")
ValueError: Didn't post auth form in 7 attempts.

Edit - also tried doing it in a WSL fresh install and get the same message

Not sure where to go next?

Ya its no.longer working. I've been just copying my token into the device panel from teslafi periodically.

I use an android app called Tesla Tokens. It is free (I think teslafi is paid?) and seems to work well. Works for 45 days or so then I have to manually set it again. Been using it for a few months now (since I have had my car) and everything seems to work pretty well

Teslafi is free as well

1 Like

I'm pretty sure it's a paid service. There's a 2 week free trial, or 4 weeks if you use someone's referral code (*).

(they did just add an iOS & Android app that will generate an API refresh token for you, and have a Chrome extension that will get one for you)


(*) Personally, I think TeslaFi is really great and use it on both my cars. I describe it here: https://teslamotorsclub.com/tmc/threads/best-tesla-apps.210626/#post-5088042
The map at that link is the lifetime travels of The BlueS, which sadly was in an accident last week.

FWIW, my username is a TeslaFi referral code.

sorry about the car.. you could be right .. i dont remember paying but that must mean it is coming due soon.

Just managed to set it up using TeslaFi.

The other one looks like TeslaPy but not had any luck yet with the code but I'm not a linux person so probably my error not theirs. Don't know if anyones tried it?

Anyone consider adapting the refresh token logic from Pulling data out Tesla Powerwall?

Thanks for this awesome app. Works great doing all of my Tesla automation for Hubitat. I’m wondering if there’s a way to completely disable logging. Turning off debug only eliminates some of the debug logs. Thanks!

With debugging off

dev:6762022-02-24 08:17:34.906 debugprocessData: [state:asleep, motion:inactive, speed:0, vin:5YJYGDEE1MF#####, thermostatMode:off]
app:6262022-02-24 08:17:34.354 debugauthorizedHttpRequest GET /api/1/vehicles/14931015######## attempt 0
dev:6762022-02-24 08:17:34.346 debugExecuting 'refresh'

With debugging on


dev:6762022-02-24 08:17:07.300 debugRefresh time currently set to: 1-Hour
dev:6762022-02-24 08:17:07.297 debugExecuting 'initialize'
dev:6762022-02-24 08:16:43.460 debugprocessData: [state:asleep, motion:inactive, speed:0, vin:5YJYGDEE1MF######, thermostatMode:off]
app:6262022-02-24 08:16:42.770 debugauthorizedHttpRequest GET /api/1/vehicles/14931015######## attempt 0
dev:6762022-02-24 08:16:42.763 debugExecuting 'refresh'

Has this app/driver been updated to adjust charge rate? Would love to automate charging my Tesla on excess solar generation after powerwalls are fully charged. I’m already using Tesla Powerwall Manager https://darwinsden.com/powerwall/ so I can get SOC data from there.

It is possible to set charge limit, but not charge rate. Though if I remember correctly, being able to adjust the charge rate via the app is a fairly recent feature. I'm sure this driver is older than that, but I'm not sure if Tesla even supports adjusting charge rate in their API. Though, I assume they would, since the phone app offers that functionality now.

1 Like

It appears that my vehicle ID with Tesla changed yesterday. Tesla Connect calls started to fail. I had to manually generate a new token, and after re-adding to the app, a different vehicle device with a different ID was created. Has anyone had/seen this happen yesterday (or at all)?

Ok, odd… now the new vehicle device has started to fail and the old one has started working again (luckily I hadn’t yet switched my rules over and removed it).

I think this happened to me once. At one point my automations quit working. In my 'start the car' command I have a loop that tries 3 times, and if it fails all 3 times it notifies me that the climate didn't start. I went in, saved a new token (old one wasn't expired though), and re-added the car. Though, I had to repair it with all my automations and then it started working properly again. Not sure what happened, I just chocked it up to some weird anomaly and didn't think about it any further. Though the last 5 months or so have been completely fine ( I got my car in Aug of 2021, so I haven't had it that long)

I've had this a couple of times. it went so.far as to delete the old one. now i.save the.network id.

When it happens you can change the network id of the new device to the old one, thus leaving all rules and automations intact.

Genius! Saving my network ID now, incase this happens again

I am interested in learning more about how to do this. I just installed the Tesla drivers and was able to see my car within HE, but I need to know the location of the car in order to do what I want.

My ultimate goal is if the car is at home, charging, and it is between 4 PM and 9 PM, stop charging.

My utility company charges an arm and a leg between 4 PM and 9 PM. I have the car se to start charging at 9, but sometimes during the mid-day I need a little top off and don't want the top off to run into the high peak $$ time. If you have anything on how you fed the data from TeslaMate's MQTT into HE, I'd love to see it. I too am a TM user. Just need this last integration information.

All that can.be done with only this. Go back and look at my rule examples.