Plugin: Tesla Car integration

Thanks @Sorin, however the problem is still there. When doing a commit it gives the message the commit failed and I cannot view the files of previous versions. Something is not quite right with the plugin storage.

Cheers Rene

@reneboer could you check one more time ?

Hello Rene, recently when I use the heater device to turn the climate on it doesn’t work. All other commands still work like unlock/lock and even if I go into the parent device and turn climate on from there it works just fine. The heater device won’t seem to always turn the climate on. This usually happens after a while of inactivity from the plugin. I will PM you the logs once I get them.

Thanks @Pabla, I’ll check on that one too.

Hi @Pabla,

I published version 1.5 that uses a door lock device (without PIN) for the doors. After I did some more testing on Vera (I develop and run my plugins on openLuup to limit the load on my Vera’s) i found that on the Vera the plugin was keeping the car awake. This is now also fixed. Not sure if that is related to the Climate control issue you are seeing.

The plugin is in the ALTUI App store and pending approval in the Mios App market. You can update your Vera using http://[your Vera IP]/port_3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreatePlugin&PluginNum=9290&Version=39668

Cheers Rene

Perfect I updated will monitor. That explains why recently my car has been losing a lot of range when parked!

Hi Rene, the heating controls work fine now. As said before, each command requires it to be pressed twice before the changes take effect. I understand it usually happens because the first command simply wakes up the car and gets a status update, then after redoing the command a second time it successfully goes through. Is there anyway you can add the logic to have the command sent —> status update and wake car up —> then repeat the previous command. This way I won’t have to repeat each command manually.

Hi @Pabla,

The plugin has logic to wake the car if needed and only then send the command. You should not need to click things twice if the car is in sleep mode. I do see that with the Climate control the On/Off button does not get updated until the command has been sent and the car polled for the new status. I will correct this so you see an immediate change on the screen.

Cheers Rene

It seems that the ok acknowledgement is too short. Aside from the heating if I toggle the sunroof open the command takes a few seconds to go through but by then the switch is turned back on. When realistically the sunroof was successfully opened, that’s why on the second try the switch stays in the correct position because the car is already in the desired state.

Hi Pable,

I’ll have a look. My model 3 does not have a sunroof so I’ll have to look. But yes, there is a chance some commands and updates cross each other and a state will (briefly) flip back. In a next release I will take a look at improving that., but it does require an bit of complex scheduling as you also do not want to miss anything.

Cheers Rene

This holds true for any state change not just sunroof. To combat this I’ve done one of two things so far, I have used reactor to simply resend the same command 15 seconds after the first one was sent to insure the command goes through and the changes reflect relatively immediately. I was also thinking of polling the car once when the command is sent, then a second time a few seconds after to confirm all the states of the switches/locks/climate are correct. Also in my testing the states of the switches etc will not update correctly even after a few minutes of the command being sent even though the car has received the command.

Way Cool!!! Can’t wait to get the operational part of the system (MY). My wife expressed her great pleasure to know that we can now have our window shades open the frunk! LOL

Seriously, great idea. Many of my devices show up as light bulb icons. Is there a way to change that?

For me it did not increase the WAF sadly. She is not a car person :grin:.

With the current Vera firmware it is not possible to change the icons (well into a power plug or garage door, but that does not make much sense either). For that you need to make custom devices, but then you loose control in the Vera app. They have plans to change this some day. Who knows if I still drive a Tesla by then.

Cheers Rene

This is a bit odd as you are almost mimicking what the plugin does. When you click the plugin looks to see if the car is awake, if not it wakes it up and then sends the command. 15 seconds later it polls for the latest status and then you will see if the command was really picked up by the car. I see cases where the API returns ok, but that car does not agree.
I did find one scenario if the http call to the API fails there would be a bug, but for me that does not seem to happen often. Maybe I need to build in a little delay after the wake up and not send the command immediately. Maybe a model S is a tad slower with processing than the model 3. Who knows.

Cheers Rene

I think a delay may be needed. My model s is a 2014 running on a 3G network so maybe that adds a bit of delay vs a newer model 3 on LTE. I have the gen 1 MCU too, which I quite a bit slower than the newest MCU

Hi Pabla,

Ok, yes I was going to ask how it is connected. I will add some retry logic over the next week or so.

I just pushed version 1.6 and increased the http request time out on that. Can you see how that goes?

Cheers Rene

Hi,

Version 1.7 is now available. The communication is more solid and includes retries if a API call failed.

Cheers Rene

Hi Rene,

Unfortunately I’m still experiencing issues with the plugin. Any command needs a second try for it to go through when the cars asleep. Also I do believe on Vera it’s keeping the car awake more often now, I’ve been experiencing a lot of battery drain ever since the update when the cars parked.

Hi @Pabla,

Can you set the logging to Test Debug. It will then write all logging to /tmp/TeslaCar.log. Let it run for a day or two and send it to me via a PM so I can have a look. For me the car sleeps like a baby, but maybe the 1200 seconds for a poll if awake keeps your S awake much longer and I need to tweak that.

The log will also show if the commands indeed fail when the car is asleep. My model 3 wakes up pretty fast, typically less than ten seconds. But the plugin does not give up for 45 seconds and sends the wake up command up to 3 times before giving up.

With the wake up and the time for the car to update its status it can take up to half a minute before you see that the command has truly started so make sure to wait. But the logs will show all that.

Cheers Rene

Rene,

I bought a new Vera Plus as an upgrade from a 7 year old Vera and ran across this app today. I am very excited to test a few things out! I am not a programmer so will stick to the basics (ie no coding for me!).

One thing that I am interested in is the Charging time window. I have a Niteflex rate in which it is much cheaper to charge from 12am to 6am. One of the shortcomings on the Model 3 is that you can not set an END time for charging. You can set a start time (ie Midnight) but only set a maximum charge % to reach. If I start charging at 10%, I may only get to 50% by 6am. So when I get fairly low, I have to manually update the charge % in the app or in the car so I won’t go beyond 6am. I would like to automate this!

Is the best way to do this to just set a trigger (scene, Reactor, PLEG, etc.) for 6am to update the Charge variable to OFF? Is there anything else that I should be aware of or is it pretty simple?

Many thanks,
Sidney