Plugin: Tesla Car integration

Hi Rene,

Updated and everything seems to be working well. May I make a recommendation to change the door lock device type of an actual door lock type? Would make it easier to decipher whether the door are locked or not. Other than that I am very pleased with the plugin thanks!

So I’ve been testing the commands and have run into an issue. If the car is asleep for a while, and I try to unlock the car, the switch will turn off indicating it’s unlocked. What actually happens a minute or two after the car updates status and the command doesn’t go through. Once the status updates and the cars awake then I can unlock the car. This holds true for any other command. Also when the car is asleep too all the switches are turned on regardless of the state.

Hi @Pabla,

Having the state of the child devices change state when you click is by design. Else you do not see any response on the GUI when you click. When you click the, command gets send to your car and after about 15 seconds a status request is send to see what the actual car state is. If the command has failed for what ever reason the switch will go back to the original position indeed. All these evens take their time and are far from real time, thus the GUI and real state can be out of sync for a while. Not much I can do about that. On top of that I am finding the car sometimes does not wake up. The plugin sends up to 5 wake up commands, but if that fails it gives up. I can build in some retry scheme, but I know that is challenging as well. I also see some errors with the communication especially after plugin start up i still have to find a better way to handle.

Thanks for the suggestion on the lock device type. I’ll have a look.

Cheers Rene

Your plugin should be approved Rene. Thank you for the patience.

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