Tesla Integration to Query Status and Send Commands to Your Car

i have changed the "unlock" function to unlock the charge port, because i dont need unlock of the car...

change the App to this where it says "def unlock(child)":

def unlock(child) {
wake(child)
pause(1000)
return executeApiCommand(child, "charge_port_door_open")
}

I'm trying to change the code to have 'unlock' unlock the charge port instead. The previous post from @diondp has a mod, but for the life of me in the code I can't find that section and don't know what to change. Any help would be greatly appreciated.

Presence works fine for me. I am trying to create a tesla dashboard panel.. I cannot get the button presses to work reliably, even adding an extra wake command. i think when the car is in deep sleep nothing works. There must be yet another api call as the app itself can wake up the car..
Anyway I made the following changes to the tesla driver..

  • lgk kahn@lgk.com 10/13/20 Added user selectable refresh update schedule instead of default 15 minutes.
  • also add custom lastupdate time attribute and refreshTime so that info is displayable on dashboards.
  • also round mileage off to whole number so again it appears better on dashboard.
  • same for temp, round off so that we can do custom colors on dashbaord based on temp.
  • Same for temp setpoint. showing non integer makes no sens.

new version.. car was having trouble sleeping.. added a start and end time to stop polling/refreshing to let the car sleep. Note doesnt handle crossing midnight so schedule accordingly.hubitat/tesladriver.groovy at master ยท lgkahn/hubitat ยท GitHub

Thanks for a great driver @kahn-hubitat. Any possibility you can add a 'charge port' unlock/lock command?

sure i'll add it in the next day or two.. but i didnt write the driver.. i just did some modifications recently

Cool thanks!

new version of both app and driver to support unlock/open charge port as custom action in rule machine or from device panel. You need to upgrade both

Awesome..worked for me! Thanks!

@kahn-hubitat ... Help I've installed the App and Driver and the App activated correctly after I enter in my Tesla Account user-id/PW it then asked me to select my car (M3) which all worked without error. I then added a Virtual Driver with "Tesla" as drier type and it is not able to return any status. Checking the logs shows the following:

dev:4422020-11-23 03:23:08.286 pm errorjava.lang.NullPointerException: Cannot invoke method lock() on null object on line 213 (lock)

dev:4422020-11-23 03:23:08.262 pm debugExecuting 'lock'

dev:4422020-11-23 03:23:06.370 pm errorjava.lang.NullPointerException: Cannot invoke method refresh() on null object on line 200 (refresh)

dev:4422020-11-23 03:23:06.337 pm debugExecuting 'refresh'

Any ideas how to resolve this error?

you dont install any virtual driver.. it will automatically install a child device if it all worked correct with the name of the car you selected..

1 Like

@kahn-hubitat thanks so much for creating this app/driver. It is really nice to be able to walk-up to my tablet on the wall and quickly look at status of my Tesla and issue some commands. Do you have any plans to add more attributes & commands to the driver that are available in the API Commands - Tesla JSON API (Unofficial) as it would be great to also know if a Software Update is available, turn Sentry Mode on/off, Outside Air temp, set seat heaters on/off, etc. With the Hubitat rule engine there are a lot of cool automation that could be created based on more Tesla API attributes and commands being available to reference.

i didnt create it.. just modified it.. i will look at the api and see about adding more attributes and commands.

1 Like

@kahn-hubitat Can you please provide screen shots how you created your Button Actions (1-8) e.g. what did you select for "Action Type" and then the drop box that comes down to the right after you picked an Action Type. I was able to create a button actions to lock and unlock by selecting "Control HSM, Garage Doors, Locks or Valves" but I can't figure out how you created your other buttons actions. BTW I don't know if this is related but I created virtual device called "Tesla Button" with Device Type = Virtual Button and then entered 8 for the "number of physical buttons" in the Preferences section for that device.

you pick run custom action, then custom action,, then actuator , then tesla device, then the command from the device.

@kahn-hubitat thanks so much for the help and support. What you have done to get this driver to work in Hubitat and the examples of how to use it is great. I'm having a lot of fun creating a Tesla specific dashboard and Alexa automation rules with this driver.

1 Like

Shouldn't "Set Thermostat Setpoint" provide an option to load a value e.g. 74 degrees

you are correct that is a bug,

new version in my github

lgk add misssing parameter to sethermostatsetpoint.. note it is in fahrenheit so be aware of that.. in the future i can look at supporting both
with option to convert.

1 Like

Thanks for the quick turn-around. Fix is working great. Now just need to add the button to my dashboard and I will be all set

1 Like

I see there is a preference switch to enable debug logging, but the app and driver code dont honor it. Could this be implemented? I get a lot of debug lines in my logs Id prefer not to see.