Plugin: Tesla Car integration

Hi @lennier, @Pabla,

I found the cause of the startup problem (code error) and the Trunk/Frunk status. For the latter closed has value zero and I assumed that open was 1. It’s not :slight_smile: You can unzip the attached and upload to your Vera for a test.(latest is on GitHub)

Unless you find more problems (hope not). I will push a new version this weekend for the app stores.

Cheers Rene

1 Like

The update seems to be working perfectly now thanks for the hard work. In the polling settings what does ‘polling; active’ mean?

Thanks Rene, Uploaded the new lua file but I seem to still get the same startup error. Mine wasn’t a new install it was running for a few weeks or so before the 1.10 and 1.11 updates came out, one of which (I think 1.11) caused the problem. My LogLevel variable is also not blank (re the update notes) it’s currently set to debug.

I note though that the version variable is still showing 1.5, does that indicate something has not updated properly perhaps?:

image

Sounds like the plugin files you have maybe corrupted. Try uninstalling the plugin, deleting the Plugin files via ssh and redownloading it

Ok so a clean install from the app store of 1.11 had the same startup lua error. The only variables existing at that point were email and password, I’d made no other changes to the installed state of the plugin. Uploading the new 1.12 test lua file added LogLevel to the variables, but the startup error persists and it’s clearly failing prior to creating any of the other variables. Changing the log level under Settings appears to have no affect on the LogLevel variable.

Log still shows this as before:

01 04/02/20 9:10:03.796 LuaInterface::CallFunction_Startup-1 device 282 function TeslaCarModule_Initialize failed [string “–[[…”]:440: attempt to compare number with nil <0x2bcfd680>
01 04/02/20 9:10:03.797 LuImplementation::StartLua running startup code for 282 I_TeslaCar1.xml failed <0x2bcfd680>

Puzzling!

Just wanted to confirm that you deleted the plugin files (via SSH) before re-installing

Yep I did.

Hmm this is odd, i guess well let Rene solve it. I installed from Github if you wanted to try using those files even though it shouldn’t make a difference. What vera are you using and what FW?

It’s a Vera 3 on the final firmware. Plugin worked fine out of the box when I first installed it (I assume that must have been 1.5) so most likely something simple changed that broke it in my environment. Could also be car data related since I have a 5yo S, but given the startup error occurs before the Tesla account information is even entered that seems unlikely. The comparison error in the log (previously number with string, now number with nil) should give Rene some avenues to explore knowing what changed in 1.10 or 1.11.

I too am using the plugin with a 5 year old S, so that should not be giving you issues. My guess is that it has something to do with the FW on your Vera 3 and subsequent changes from v1.5 to 1.11, but then again I’m not the dev for this plugin :stuck_out_tongue:

I might have resolved this. Even though the latest lua file caused the LogLevel variable to be created it had no value, so after looking through the code on a hunch I edited this manually and set it to 1. The startup errors seem to have gone and the plugin runs and fetches an update from the car again. I’ll now try reconfiguring it as per the previous installation and confirm if things are still working.

Thanks @reneboer and @Pabla for your help.

1 Like

Hi Pabla,

Polling active is when one of the following is true: Unlocked, Climate on, or car woke up (for example if you used the Tesla App, and just for 200 seconds to find any status changes)

I started on the Wiki to document all this.

Cheers Rene

Hi Iennier,

I found that it indeed would still not be right with a fresh install. So fixed that now too. I’ll publish the updates later today.

The update can be installed via ALTUI or Can be downloaded from the ALTUI Apps store. The Mios App Market should be availbe Monday, or install now using
http://[your Vera IP]/port_3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreatePlugin&PluginNum=9290&Version=39872

Cheers.

Hi,

Just release V1.13. (forgot plugin version number, that still says 1.12)
Changes:

  • Fix for auto software install.
  • Units correction for ChargeRate if not mi/hr
  • Added HTTP return code 400 to the list of retry reason codes.

Hi Rene, the plugin is working flawlessly, most of the time even better than the app. May I make one request, I know there are icons representing each state the car is in (ie. sleeping, climate, etc) is it possible to add one for when a command is in process/sent? Sometimes in the mobile app its hard to tell whether the plugin received and/or sent the command.

Hi Pabla,

Good suggestion. It is added to my to-do list.

Cheers Rene

1 Like

Hi All,

Added control of Sentry Mode via the plug-in. New actions are startSentryMode and stopSentryMode, as well as a new child device to control it.

Can be downloaded from the ALTUI Apps store. The Mios App Market should be availbe Monday, or install now using
http://[your Vera IP]/port_3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreatePlugin&PluginNum=9290&Version=40316

Cheers Rene

Hi All,

Added a busy icon to show the plugin is still communicating with the car to send a command.

Can be downloaded from the ALTUI Apps store. The Mios App Market should be available Monday, or install now using
http://[your Vera IP]/port_3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreatePlugin&PluginNum=9290&Version=40322

Cheers Rene

1 Like

Hi Rene,

I have a question as to how the app determines the LocationHome variable. The latitude and longitude reported by the plugin is correct but the plugin still says Away (screenshot below). The AtLocationRadius is still at the default of .5. The car itself knows I’m at home as the Location Address on the Tesla App is correct and it also correctly activated the HomeLink garage opener.

The reason why I ask this is because I have a Reactor configured to only allow my car to charge between Midnight and 6am since I have a cheaper electricity rate at these times. Unfortunately, the Reactor kicked in on me yesterday when I was trying to charge at a Supercharger on a road trip. I lost 15-20 minutes before realizing what had happened and disabling the Reactor. I would like to add the LocationHome variable to my Reactor logic so it only kicks in when I am at home.

I think the best solution is to leverage the AtHome variable but need to ensure that it is accurately derived.

Thanks in advance!
Sidney

Hi @sidmsmith,

The plugin looks if the lat/long is within 0.5 KMs of the lat/long configured for your controller. Is the latter configured accurately? I know the defaults are often not accurate. (Settings/Location). The distance used is set in the AtLocationRadius variable, so you can also make that larger.

If your controller is in a different place that what you consider at home for your car I can add lat/lon variables to overrule the controller location. Let me know if that would help.

Cheers Rene